rsmmr / install-clang Goto Github PK
View Code? Open in Web Editor NEWA script to create a standalone installation of clang/LLVM/libc++. Updated for Clang/LLVM 6.0.
A script to create a standalone installation of clang/LLVM/libc++. Updated for Clang/LLVM 6.0.
I'm doing make docker-build
, and it failed at about 30%:
[ 30%] Linking CXX shared library ../../../lib/libc++.so
/usr/bin/ld: cannot find -lcxxabi_shared
collect2: error: ld returned 1 exit status
projects/libcxx/src/CMakeFiles/cxx_shared.dir/build.make:1004: recipe for target 'lib/libc++.so.1.0' failed
make[2]: *** [lib/libc++.so.1.0] Error 1
CMakeFiles/Makefile2:10069: recipe for target 'projects/libcxx/src/CMakeFiles/cxx_shared.dir/all' failed
make[1]: *** [projects/libcxx/src/CMakeFiles/cxx_shared.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
...
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
===
=== Failed building LLVM/clang at stage 0
===
The command '/bin/sh -c /opt/install-clang/install-clang -j 6 -C /opt/clang' returned a non-zero code: 1
I've just observed that the way rpath is added to the arguments passed from clang down to ld produces an error on OSX, because the entire argument gets enclosed in double quotes.
Changing:
+ CmdArgs.push_back(Args.MakeArgString("-rpath=" + D.InstalledDir + "/../lib"));
Into:
+ CmdArgs.push_back("-rpath");
+ CmdArgs.push_back(Args.MakeArgString(D.InstalledDir + "/../lib"));
In patches/tools-clang-libpath.patch resolves this error.
Dear Madam or Sir,
install-clang fails over the missing '-fsanitize=thread'.
As far as I understood, this is exprected for my platform.
I personally could live without '-fsanitize=thread', but unfortunately the build process is stopped.
Do You have a hint in which CMakefileList (or the like) I can deactivate '-fsanitize=thread'? So I could proceed even without it?
(Is 32 bit really that exotic today?)
(By the way; I started on a FAT partition, this seems to be exotic also. I continued with ext2)
See logs below
Regards
Ralf Hain
/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-stamp/libcxx_tsan-configure-err.log
[100%] Performing configure step for 'libcxx_tsan'
CMake Error at /media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-stamp/libcxx_tsan-configure.cmake:16 (message):
Command failed: 1
'/usr/bin/cmake' '-DCMAKE_C_COMPILER=/media/xubuntu/tr/llvm/src/llvm/build-stage1/./bin/clang' '-DCMAKE_CXX_COMPILER=/media/xubuntu/tr/llvm/src/llvm/build-stage1/./bin/clang' '-DCMAKE_C_FLAGS= -fsanitize=thread' '-DCMAKE_CXX_FLAGS= -fsanitize=thread' '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_INSTALL_PREFIX:PATH=/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan' '-GUnix Makefiles' '/media/xubuntu/tr/llvm/src/llvm/projects/libcxx'
See also
/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-stamp/libcxx_tsan-configure-*.log
make[2]: *** [projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-stamp/libcxx_tsan-configure] Fehler 1
make[1]: *** [projects/compiler-rt/lib/tsan/CMakeFiles/libcxx_tsan.dir/all] Fehler 2
make[1]: *** Warte auf noch nicht beendete Prozesse...
Linking CXX executable ../../bin/llvm-readobj
[100%] Built target llvm-readobj
make: *** [all] Fehler 2
===
=== Faild building LLVM/clang at stage 1
===
------------------------------
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/media/xubuntu/tr/llvm/src/llvm/build-stage1/./bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec508344078/fast"
make[3]: Betrete Verzeichnis
'/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec508344078.dir/build.make
CMakeFiles/cmTryCompileExec508344078.dir/build
make[4]: Betrete Verzeichnis
'/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp/CMakeFiles
1
Building CXX object
CMakeFiles/cmTryCompileExec508344078.dir/testCXXCompiler.cxx.o
/media/xubuntu/tr/llvm/src/llvm/build-stage1/./bin/clang -fsanitize=thread
-o CMakeFiles/cmTryCompileExec508344078.dir/testCXXCompiler.cxx.o -c
/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
clang-3.5: error: unsupported option '-fsanitize=thread' for target
'i386-pc-linux-gnu'
make[4]: Verlasse Verzeichnis
'/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp'
make[4]: ***
[CMakeFiles/cmTryCompileExec508344078.dir/testCXXCompiler.cxx.o] Fehler 1
make[3]: Verlasse Verzeichnis
'/media/xubuntu/tr/llvm/src/llvm/build-stage1/projects/compiler-rt/lib/tsan/libcxx_tsan/src/libcxx_tsan-build/CMakeFiles/CMakeTmp'
make[3]: *** [cmTryCompileExec508344078/fast] Fehler 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
I tried to build the project without cmake installed. The build failed when cmake was not found. I installed cmake and attempted rebuild with the 'update' / '-u' flag. This failed during patch application, I think because patches had already been applied to the source.
I have noticed that when running the install-clang script that when running with the default version (release_35), I am getting a broken build due to the patch https://github.com/rsmmr/install-clang/blob/master/patches/fix-external-project-order.patch. This patch does not apply cleanly to release_35 and actually causes the file to have the failed git merge remnants in it. As soon as I manually fixed it the build was able to continue. This specific patch seems to only apply to release_36. Looking at the code it seems that there isn't any code currently to handle failed patches in the install-clang script. It seems like that would fix this problem from happening again.
As a note this is happening for me on Centos 6.7.
Not sure if this belongs here. Seems to work fine until the very end where I get:
[ 74%] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/IOHandler.cpp.o
/opt/llvm/src/llvm/tools/lldb/source/Core/IOHandler.cpp:14:10: fatal error: 'panel.h' file not found
#include <panel.h>
^~~~~~~~~
1 error generated.
make[2]: *** [tools/lldb/source/Core/CMakeFiles/lldbCore.dir/build.make:447: tools/lldb/source/Core/CMakeFiles/lldbCore.dir/IOHandler.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:65074: tools/lldb/source/Core/CMakeFiles/lldbCore.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
===
=== Failed building LLVM/clang at stage 2
===
panel.h is present:
$ locate panel.h
/usr/include/ncurses/panel.h
/usr/include/ncursesw/panel.h
$ /opt/llvm/bin/clang++ --version
clang version 8.0.1 (https://github.com/llvm-mirror/clang.git 29cb26a72b28cbb5ba43e67aecb3a8cf2b01fee0) (https://github.com/llvm-mirror/llvm.git 18e41dc964f916504ec90dba523826ac74d235c4)
Target: x86_64-suse-linux
Thread model: posix
InstalledDir: /opt/llvm/bin
Thanks for this tool!
I use install-clang to build up-to-date llvm/clang toolchains from master/trunk and I recently stumbled on the same error described in this mailing-list message:
http://comments.gmane.org/gmane.comp.compilers.llvm.devel/59285
The fix proposed there resolved the issue for me and the wording "Usually, [...] fixes this kind of problem for me." indicates that this sort of problem is common, when updating the codebase.
So I propose to add "rm Makefile.llvmbuild" to install-clang.sh as a precaution when the "update" action is chosen by the user.
See #16.
I need to add the path to libc++.so.1 (/opt/clang/lib) to LD_LIBRARY_PATH to fix this runtime error.
./a.out: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
Adding that path to the ldconfig is a better solution I think, and it could be put directly in your Dockerfile. Here's what I'm doing in mine.
RUN echo "/opt/clang/lib" > /etc/ld.so.conf.d/clang.conf
RUN ldconfig
This might be a problem because one of my build script which I didn't want to change, had clang path hardcoded to /usr/bin/clang, and so I created a link there first in my docker file before compiling:
RUN ln -s /opt/clang/bin/clang++ /usr/bin/clang++
Thanks for making this btw !
Looks like there is an order-of-build files issue. After the attached change, install-clang builds correctly.
diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt
index 2f025bd..915a35c 100644
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -13,6 +13,8 @@ foreach(entry ${entries})
endif()
endforeach(entry)
+add_llvm_external_project(libcxxabi)
+
# Also add in libc++ and compiler-rt trees if present (and we have
# a sufficiently recent version of CMake where required).
if(${LLVM_BUILD_RUNTIME})
@@ -27,4 +29,3 @@ if(${LLVM_BUILD_RUNTIME})
endif()
add_llvm_external_project(dragonegg)
-add_llvm_external_project(libcxxabi)
Hi, thx for this tool!
Unfortunately I am unable to install due to a compilation error :
[ 18%] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_common_libcdep.cc.o
/home/carlos/clang/src/llvm/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/carlos/clang/src/llvm/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1437:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/carlos/clang/src/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:336:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/carlos/clang/src/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:342:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^~~~~~~~~~~~~~~
1 error generated.
Carlos
Clang has a number of extra tools that need to be built as part of the tree source. See http://clang.llvm.org/docs/ClangTools.html for more info.
I'd like to have an option to download these tools and build them as well.
Thanks,
Bob
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.