-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom CC/CXX args #18
Comments
I guess it's only needed when linking frameworks? |
Not just frameworks, but also bundled libraries (like openssl). This isn't required for projects that are fully Rust, but for anything more involved, it may be necessary, |
Does |
Alternative we can add support to download a MacOS SDK automatically and set up |
I think I can set Regarding the SDK, I'm not sure we can rely on that reposity to last forever without Apple DMCAing it. They allowed to download the SDKs (as part of Command Line Tools for Xcode) freely before, but now you need to be authenticated now to download e.g. https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_13.3/Command_Line_Tools_for_Xcode_13.3.dmg. |
If we need to add
https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html |
I tried setting I managed to compile without setting sysroot in the linker script with just: |
Can you try #20 ? |
Hey, thanks for the swift implementation! I tried it out and can confirm it works for sufficiently new versions of zig (at least 0.9.1 ziglang/zig#10568, https://ziglang.org/download/0.9.1/release-notes.html#zig-cc--zig-c) |
Currently, in order to cross-compile macos targets, additional arguments are required (see ziglang/zig#1349 (comment)).
As a cargo zigbuild user, I have to manually modify the generated linker script
~/.cargo/bin/cargo-zigbuild zig c++ -- -target aarch64-macos-gnu -g $@
to e.g.
~/.cargo/bin/cargo-zigbuild zig cc -- -target aarch64-macos --sysroot=${MACOS_SDK} -I${MACOS_SDK}/usr/include -L${MACOS_SDK}/usr/lib -F${MACOS_SDK}/System/Library/Frameworks -framework Corefoundation -g $@
when I want to compile to a macos target, and link a framework. Then I manually add it to.cargo/config
as the linker, along with the CC/CXX env vars, instead of simply running runningcargo zigbuild --cc-args ...
or something.It would be nice to support this feature, I think, or maybe even have a couple of macos-only flags.
The text was updated successfully, but these errors were encountered: