Closed dslm4515 closed 3 years ago
Conflict with libcxx's math header
I figured as such, but I haven't figured out what to change.
Removing this should fix most issue
-DCMAKE_CXX_FLAGS="-I/llvmtools/include"
-DCMAKE_C_FLAGS="-I/llvmtools/include"
but there are still one (currently: at 72%) problems still appears because of not including linux API headers
/mnt/cmlfs/sources/llvm/projects/libcxx/src/atomic.cpp:19:10: fatal error: 'linux/futex.h' file not found
#include <linux/futex.h>
^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/cxx_static.dir/build.make:104: src/CMakeFiles/cxx_static.dir/atomic.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 72%] Building CXX object src/CMakeFiles/cxx_shared.dir/bind.cpp.o
/mnt/cmlfs/sources/llvm/projects/libcxx/src/atomic.cpp:19:10: fatal error: 'linux/futex.h' file not found
#include <linux/futex.h>
^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/cxx_shared.dir/build.make:104: src/CMakeFiles/cxx_shared.dir/atomic.cpp.o] Error 1
So what
hmmmmm:
The build actually fails because of "#include <linux/futex.h>".
Musl does not have this header file and the build fails with a
missing header file error.
hmmmmm:
The build actually fails because of "#include <linux/futex.h>". Musl does not have this header file and the build fails with a missing header file error.
Its not from libc, but from linux headers that it exists. The problems is how to include those headers along with built-in libcxx's headers if I'm not wrong
on LLVM11, it went further after patching src/atomic.cpp
[ 83%] Building CXX object src/CMakeFiles/cxx_shared.dir/filesystem/operations.cpp.o
/mnt/cmlfs/sources/llvm/projects/libcxx/src/filesystem/operations.cpp:29:10: fatal error: 'linux/version.h' file not found
#include <linux/version.h>
^~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/cxx_shared.dir/build.make:531: src/CMakeFiles/cxx_shared.dir/filesystem/operations.cpp.o] Error 1
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
make[1]: *** [CMakeFiles/Makefile2:408: src/CMakeFiles/cxx_shared.dir/all] Error 2
make[1]: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
make: *** [Makefile:130: all] Error 2
make: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
I also patched src/filesystem/operations.cpp
and libcxx completes!
I will upload a patch soon
Got it
Using -isystem
instead of -I
for CXX flags and build successful
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/llvmtools \
-DLLVM_PATH="${LLVMSRC}" \
-DLIBCXX_ENABLE_SHARED=ON \
-DLIBCXX_ENABLE_STATIC=ON \
-DLIBCXX_HAS_MUSL_LIBC=ON \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/llvmtools/include" \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=/llvmtools/lib \
-DLIBCXX_INSTALL_HEADERS=ON \
-DCMAKE_CXX_FLAGS="-isystem /llvmtools/include" \
Removed line
-DCMAKE_C_FLAGS="-I/llvmtools/include"
There's no .c source code
OH! that better than patching the source. :+1:
Made the change with b88d11f
Thanks!
Building
llvmtools
with llvm-12.0.0 on a glibc host .... Build fails.