Skip to content
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

Specifying CMAKE_ASM_COMPILER to /usr/bin/cc on macOS cause build failures #99

Closed
fanzeyi opened this issue Jun 8, 2020 · 1 comment

Comments

@fanzeyi
Copy link

fanzeyi commented Jun 8, 2020

I have seen an error similar to #95 while building grpc-sys. It looks like with cmake-rs 0.1.43 & 0.1.44, CMAKE_ASM_COMPILER will be explicitly specified to /usr/bin/cc, and for some reason this made CMake to not able to identify the assembler type. This subsequently caused incorrect compiler flag being generated.

From CMake's record, with cmake-rs == 0.1.44. The generated configration is:

running: "cmake" "/Users/fanzeyi/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.3/grpc" "-DgRPC_INSTALL=false" "-DgRPC_BUILD_CSHARP_EXT=false" "-DgRPC_BUILD_CODEGEN=false" "-DgRPC_BENCHMARK_PROVIDER=none" "-DgRPC_ZLIB_PROVIDER=package" "-DCMAKE_INSTALL_PREFIX=/Users/fanzeyi/GitHub/project/target/debug/build/grpcio-sys-2c04b4ba668021f3/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -stdlib=libc++ -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"
-- The ASM compiler identification is unknown
-- Found assembler: /usr/bin/cc
-- Warning: Did not find file Compiler/-ASM
...

With cmake-rs == 0.1.42, CMake has:

running: "cmake" "/Users/fanzeyi/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.3/grpc" "-DgRPC_INSTALL=false" "-DgRPC_BUILD_CSHARP_EXT=false" "-DgRPC_BUILD_CODEGEN=false" "-DgRPC_BENCHMARK_PROVIDER=none" "-DgRPC_ZLIB_PROVIDER=package" "-DCMAKE_INSTALL_PREFIX=/Users/fanzeyi/GitHub/project/target/debug/build/grpcio-sys-1925f40788408223/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -stdlib=libc++ -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=Debug"
...
-- The ASM compiler identification is AppleClang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
...

If you compare the CMake command executed, in 0.1.44 it is specifying -DCMAKE_ASM_COMPILER to /usr/bin/cc (at the very end) while 0.1.42 does not.

@fanzeyi
Copy link
Author

fanzeyi commented Jun 8, 2020

Nevermind, I think this is a CMake bug. CMake should be able to detect the assembler correctly.

@fanzeyi fanzeyi closed this as completed Jun 8, 2020
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

No branches or pull requests

1 participant