Skip to content

Fix Issue #23356 - ImportC: The preprocessor is improperly invoked, on macOS, when cross-compiling.#23357

Open
just-harry wants to merge 1 commit into
dlang:masterfrom
just-harry:fix-macos-cross-compilation-preprocessor
Open

Fix Issue #23356 - ImportC: The preprocessor is improperly invoked, on macOS, when cross-compiling.#23357
just-harry wants to merge 1 commit into
dlang:masterfrom
just-harry:fix-macos-cross-compilation-preprocessor

Conversation

@just-harry

Copy link
Copy Markdown
Contributor

When DMD is run on macOS, the preprocessor is expected to be clang instead of GCC, and clang requires a different command-line than GCC does to solely preprocess a file without compiling and linking it.

DMD currently uses the clang-logic when the target is macOS--this is the wrong way 'round: the clang-logic should be used when the host is macOS.

@just-harry just-harry force-pushed the fix-macos-cross-compilation-preprocessor branch from 5a21394 to bb2bafa Compare July 3, 2026 21:13
@kinke

kinke commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

This is a bit too simplistic - you don't want to run the Apple host clang as preprocessor either, but some proper cross-compiler with the right headers and predefines for the cross-compilation target (or a -target … clang flag at the very least). It looks like DMD doesn't have something like LDC's -gcc switch (which controls both preprocessor and linker drivers), only supporting the CC (linker driver) and CPPCMD (preprocessor) env vars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportC: The preprocessor is improperly invoked, on macOS, when cross-compiling

2 participants