• D dcr
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • mos.track
    • mos.track
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 2
    • Запросы на слияние 2
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • mos.wiki
    • mos.wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • probrovova1
  • dcr
  • Запросы на слияние
  • !16

Fix macOS host target linking on Apple Silicon

  • Ревью изменений

  • Скачать
  • Почтовые патчи
  • Простое отличие
Слиты probrovova1 запросил слияние github/fork/XiaoPengYouCode/codex/fix-macos-host-target-link в master Июн 07, 2026
  • Обзор 3
  • Коммиты 1
  • Конвейеры 0
  • Изменения 4

Created by: XiaoPengYouCode

Root cause

On macOS, DCR defaulted builds to x86_64-apple-darwin even when the host binary was running on Apple Silicon (aarch64-apple-darwin). The build path injected --target=<triple> only into clang compile flags, while the link command did not receive the same target flag.

That produced an x86_64 object file, then invoked clang/ld with the host default arm64 linker settings. The linker ignored the x86_64 object and reported _main as undefined for arm64.

Fix

  • Add a shared default_target_triple() helper that uses std::env::consts::ARCH for host defaults, including macOS.
  • Reuse that helper in build, run, and clean so they agree on the same default target directory.
  • Add a shared clang target flag helper and apply --target=<triple> to both compile flags and link flags.
  • Add unit coverage for host default target generation and clang target flag insertion.

Verification

  • cargo fmt --all --check
  • cargo check --all-targets --all-features
  • cargo test utils::build::tests -- --test-threads=1
  • Built local DCR with cargo build
  • Verified a minimal C project on Apple Silicon with:
    • target/debug/dcr run --force --verbose
    • default target printed as aarch64-apple-darwin
    • compile command included --target=aarch64-apple-darwin
    • link command included --target=aarch64-apple-darwin
    • binary ran and printed Hello World!

Notes

On this macOS machine, cargo clippy --all-targets --all-features -- -D warnings is currently blocked by pre-existing macOS-only clippy::needless_return diagnostics in src/platform/mod.rs.

Full cargo test is also blocked locally by pre-existing collect_sources_* tests that compare /var/... temp paths against /private/var/... resolved paths on macOS. The new utils::build tests pass.

Ответственный
Назначить
Проверяющие
Запросить ревью
Оценка трудозатрат
Исходная ветка: github/fork/XiaoPengYouCode/codex/fix-macos-host-target-link