Closed dslm4515 closed 3 years ago
hmmmmmm http://llvmweekly.org/issue/336
Re-built llvmtools
and made sure libcxx
did not require libatomic.
now llvm/clang for llvmtools
fails to build:
FAILED: include/llvm/IR/Attributes.inc
cd /mnt/cmlfs/sources/llvm/build && /mnt/cmlfs/sources/llvm/build/bin/llvm-tblgen -gen-attrs -I /mnt/cmlfs/sources/llvm/include/llvm/IR -I /mnt/cmlfs/sources/llvm/build/include -I /mnt/cmlfs/sources/llvm/include /mnt/cmlfs/sources/llvm/include/llvm/IR/Attributes.td --write-if-changed -o include/llvm/IR/Attributes.inc -d include/llvm/IR/Attributes.inc.d
/bin/sh: /mnt/cmlfs/sources/llvm/build/bin/llvm-tblgen: No such file or directory
[220/3316] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackDocument.cpp.o
ninja: build stopped: subcommand failed.
hmmmmmm http://llvmweekly.org/issue/336
Looks like for libcxx, I’ll have to set a flag to disable libatomic
hmmmmmm http://llvmweekly.org/issue/336
Looks like for libcxx, I’ll have to set a flag to disable libatomic
How?
Looks like I’ll have to patch libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
Although it’s strange that after rebuilding llvmtools
... llvmtools’ Libc++.so.1 no longer requires libatomic.
not sure if it matters that PATH=/cgnutools/bin:/llvmtools/bin:/bin:/usr/bin
Commenting this will disable libatomic detection for Linux when configure libcxx (cmake).
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
projects/libcxx/cmake/config-ix.cmake
102 else()
103 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
104 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
105 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
106 set(LIBCXX_HAS_SYSTEM_LIB NO)
107 # check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
108 endif()
I wonder how atomic detected when building libcxx
I probably will include a check for libunwind, libcxx, and libcxxabi to make sure there are no GCC dependencies. It’s annoying to finally build LLVM for llvmtools only to realize llvmtools has GCC dependencies.
Successful by using above trick! While building libcxx in llvmtools (deletes matched PATTERN):
sed -i '/check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)/d' \
${LLVMSRC}/projects/libcxx/cmake/config-ix.cmake
Progress of building Clang/LLVM in llvmtools (I'm prefer GNU's Make btw):
[ 99%] Built target clangStaticAnalyzerFrontend
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
[ 99%] Building C object tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o
[ 99%] Building CXX object tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/core_main.cpp.o
[100%] Linking CXX executable ../../../../bin/c-arcmt-test
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[100%] Built target c-arcmt-test
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
[100%] Linking CXX static library ../../../../lib/libclangFrontendTool.a
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[100%] Built target clangFrontendTool
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make[2]: Entering directory '/mnt/cmlfs/sources/llvm/build'
[100%] Linking CXX static library ../../../../../lib/libclangDependencyScanning.a
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[100%] Built target clangDependencyScanning
[100%] Linking CXX executable ../../../../bin/c-index-test
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[100%] Built target c-index-test
make[1]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make: Leaving directory '/mnt/cmlfs/sources/llvm/build
@dslm4515
Commenting this will disable libatomic detection for Linux when configure libcxx (cmake).
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
projects/libcxx/cmake/config-ix.cmake
102 else() 103 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) 104 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB) 105 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB) 106 set(LIBCXX_HAS_SYSTEM_LIB NO) 107 # check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB) 108 endif()
Closing issue as @owl4ce fixed issue
llvmtools'
libc++.so.1
from libcxx should NOT rely onlibatomic.so.1
, which is provided by GCC.This will require to build LLVM for llvmtools with a
LD_LIBARARY_PATH
hack