-
Notifications
You must be signed in to change notification settings - Fork 125
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
Build fails on osx with /usr/bin/cc is not able to compile a simple test program. #95
Comments
The error message there indicates |
I don't think this is a problem with the linker. I build C and C++ on my machine all day via cmake. something is wrong with the emited cmake. Here's my output: running: "cmake" "/Users/henso/source/aws-crt-rust/aws-common-runtime/aws-c-common" "-DCMAKE_OSX_ARCHITECTURES=x86_64" "-DCMAKE_OSX_SYSROOT=macosx" "-DCMAKE_OSX_DEPLOYMENT_TARGET=" "-DCMAKE_INSTALL_PREFIX=/Users/henso/source/aws-crt-rust/target/debug/build/aws-crt-rust-1e31957a34af6229/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug" --- stderr
is not able to compile a simple test program. It fails with the following output:
This exact cmake project builds perfectly fine for c and c++. |
fwiw, adding the following line:
fixed my build. I pulled that directly from the CMakeCache.txt on the same exact project that was build using vanilla cmake: cmake <source> I think the issue is the default value you're adding is incorrect. |
Thanks for the workaround @JonathanHenson... It's working for me as well.
Btw, I wasn't cross compiling either, but I do have two versions of cmake on my system - one installed using brew and the other compiled from sources. Not sure if this has something to do with the issue. |
Oh oops I missed that, sorry about that! This looks like it's a regression from #93 unfortunately. I've reverted that so this should be fixed now, sorry for the breakage! I'll open a follow-up for re-landing. |
Any opensource repo with which it is possible to reproduce problem? |
Should work for any cmake project. Mine won’t be ready for a little while. |
Oh, I should mention this before. I can not reproduce this issue on macOS 10.15.4 with recent XCode. Can you try then this cmake hello world: https://github.com/Dushistov/cmake_rs_hello_world I can build it for macos and cross-compile for iOS without any issues. |
I think the issue has already been fixed as of a week ago. |
From my perspective is was broken a week ago :) So I need find out what is wrong with |
If you grab GitHub.com/awslabs/aws-c-common and try to build it on 10.14, it should break. I suspect would break regardless of the cmake project though. |
I updated my test project
Any other hints to reproduce this build problem, please? what |
Hi, I'd like to get the iOS support re-instated. I'm currently trying to add iOS support for the Bevy Engine here and had some trouble building I have done some research on specifying sysroot as CMake does it here Kitware/CMake@777d364#diff-5464a2a0787149bc084bebd2dbfe2f31 (example of them switching to Rust itself does it here https://github.com/rust-lang/rust/blob/9f3c96b869b48ecd0bb556c6ad9cd603b4dacfb9/src/librustc_target/spec/apple_sdk_base.rs LLVM doesn't do it https://github.com/llvm/llvm-project/blame/f6510a01a663a2e249462ef0ca98a5b94c22f59b/clang/lib/Driver/ToolChains/Darwin.cpp#L1178 but the comment in the Rust code says The logs in the OP show that @hu55a1n1 @JonathanHenson do either of you still have a repro of the problem? The only guess fix I can come up with is to just omit SYSROOT entirely for mac builds since it seems to work fine without it.
This way, normal mac builds should hopefully be unaffected, and iphone builds can work for others like @Dushistov and myself. Thoughts? |
I also ran into some issues with CMake ios defaults (see https://gitlab.kitware.com/cmake/cmake/-/issues/20956) that if we do re-instate the reverted code I'd like to suggest adding in
so that it doesn't by default try to build a "GUI executable that can be launched from the Finder" for library builds. Given that |
cc-rs is dependency of cmake-rs, and it is also uses and also, may be it is completly underlated, but I found out during fixing rust-lang/cc-rs#530, |
My build script fails only on Mac (macOS Mojave 10.14.6). It works fine on linux.
Also tried setting
CMAKE_C_COMPILER_WORKS
but then I get errors likefatal error: 'stdio.h' file not found
.Here's the relevant part of my build.rs -
Here's the output -
The text was updated successfully, but these errors were encountered: