-
Notifications
You must be signed in to change notification settings - Fork 469
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
crosscompiling macos -> ios + xcodebuild + build-script problem #530
Comments
Yes this is where build processes using env vars aren't really always the best equipped for cross compilation. I'm not really sure what this crate could do, since it can't blindly remove |
I suppose it should detect |
Now that you mention it I recall that rustc does something similar, and that seems reasonable to add here too |
Is this the same as rust-lang/cargo#7283 ? |
It is roughly the same. Problem with include search, not linking problem. In solution I set environment variable to right value, instead of removing variable etc. But it is roughly the same problem: problem of building build script if the whole build is run via |
I call
cargo build
from my XCode project and build project for iOS.One of my crates depend on bindgen, which depend on clang-sys,
which depend on libloading.
And build failed, with such error:
cargo:warning=In file included from src/os/unix/global_static.c:1:
cargo:warning=In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/pthread.h:60:
cargo:warning=In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/time.h:69:
cargo:warning=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types/_clock_t.h:31:9: error: unknown type name '__darwin_clock_t'
cargo:warning=typedef __darwin_clock_t clock_t;
libloading is part of build-script, so it should not be compiled for iOS,
it should be compiled for macOS, but for some reason it compiled for iOS instead of macOS.
Interesting thing that if I run
cargo build --target=aarch64-apple-ios
manually all works fine.After analysing what environment variable set
xcodebuild
I thing culprit isSDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk
because of with it
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/tmp/global_static.o" "-c" /Users/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.5.2/src/os/unix/global_static.c
report the same problem, and if I change it into
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
all works fine if I call
cc
manually.The text was updated successfully, but these errors were encountered: