-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Cannot build with cmake -DCMAKE_ASM_COMPILER=as or llvm-as #3193
Comments
The .S files contain preprocessor statements and other compiler flags, so need to be handled by cc unlike the .s files that are handled by as. The Makefile does the right thing, by using COMPILE.S instead of COMPILE.s So CMake should use CMAKE_C_COMPILER, instead of CMAKE_ASM_COMPILER |
Fixes cmake build when the C compiler isn't used as the assembler. We need to explicitly set the flag `-x assembler-with-cpp` to enable the preprocessor. Fixes facebook#3193.
I believe that PR #3382 fixes this issue. But I'm not a CMake expert, so please @afbjorklund, @rkitover let me know if this fixes the issue for you. |
Tell CMake to explicitly compile our assembly as C code, because we require it is compiled by a C compiler, and it is only enabled for clang/gcc. Fixes facebook#3193.
Tell CMake to explicitly compile our assembly as C code, because we require it is compiled by a C compiler, and it is only enabled for clang/gcc. Fixes facebook#3193.
Tell CMake to explicitly compile our assembly as C code, because we require it is compiled by a C compiler, and it is only enabled for clang/gcc. Fixes #3193.
Describe the bug
Build of assembly sources fails if cmake is invoked with
-DCMAKE_ASM_COMPILER=as
using theas
from GNU binutils. My version ofas
is 2.38.It also fails in a different way with
clang
andllvm-as
.Originally reported here:
ccache/ccache#1113
.
To Reproduce
For
gcc
, running:, gives:
. For
clang
andllvm-as
(from llvm 14.0.5) running:, produces in the cmake messages:
, while running the build with
LANG=C ninja -v
produces:.
Expected behavior
Assembly sources to compile successfully using binutils or llvm assembler.
Desktop (please complete the following information):
gcc
andclang
cmake
Additional context
I suspect that not passing the C/C++ flags when compiling the assembly sources and using only the minimal required flags for the assembler would fix this issue. I can probably fix this in a PR if you would like.
The text was updated successfully, but these errors were encountered: