The configuration we’re mentioning is a 2-stage bootstrap: You need first to build without LTO your own clang, and then use it for the LTO build. — Mehid> On Sep 20, 2016, at 10:17 AM, Michael Kruse <llvmdev at meinersbur.de> wrote: > > I am the author of Polly's/ISL's platform tests and could reproduce > the problem on my system with this error message: > > /usr/bin/ld: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: error loading > plugin: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: cannot open shared > object file: No such file or directory > > Sure, that file doesn't exist. I'd expect Ubuntu 16.04 to have > installed it for the installed version of clang, but `apt-file seach > LLVMgold` returns: > > llvm-3.5-dev: /usr/lib/llvm-3.5/lib/LLVMgold.so > llvm-3.6-dev: /usr/lib/llvm-3.6/lib/LLVMgold.so > llvm-3.7-dev: /usr/lib/llvm-3.7/lib/LLVMgold.so > llvm-dev: /usr/lib/LLVMgold.so > > /usr/lib/LLVMgold.so is a symlink to llvm-3.8/lib/LLVMgold.so, which > doesn't exist. This looks like a mistake in the llvm-3.8-dev package. > This bug might be related: > > https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-snapshot/+bug/1254970 > > The tests use CMake's standard mechanism check_c{xx}_source_compiles() > to check whether a source file compiles and links. I assume it is just > the first project in the configure chain to make use of it. > > Michael > > > 2016-09-16 23:18 GMT+02:00 Carsten Mattner via llvm-dev > <llvm-dev at lists.llvm.org>: >> On Fri, Sep 16, 2016 at 10:54 PM, Mehdi Amini <mehdi.amini at apple.com> wrote: >> >>> Can you look for the specific errors in the CMake log and error files? >>> >>> CMake is very good at not presenting the real issue… >>> Here it is trying to build very simple programs to check features >>> availability. Like: >>> >>> #include <strings.h> >>> int main() { ffs(0); return 0; } >> >> In CMakeError.log there are errors like: >> >> CheckIncludeFile.c:1:10: fatal error: 'malloc/malloc.h' file not found >> #include <malloc/malloc.h> >> >> ... >> >> CheckIncludeFile.c:1:10: fatal error: 'ndir.h' file not found >> #include <ndir.h> >> >> ... >> >> CheckIncludeFile.c:1:10: fatal error: 'sys/ndir.h' file not found >> #include <sys/ndir.h> >> >> ... >> >> fatal error: 'intrin.h' file not found >> >> These seem like tests that are expected to fail. >> >> ... >> >> The interesting test >> >> int main() { __builtin_ffs(0); return 0; } >> >> fails like this: >> >> /usr/bin/ld[...]llvm/bin/../lib/LLVMgold.so: >> cannot open shared object file: No such file[...] >> >> I have two questions here: >> >> Is there anything I might have missed when configuring the gcc-built >> llvm install for it to be incomplete in the linker department? I mean, >> the system linker is used (not lld) and that via CC=clang is looking >> for the gold linker plugin, which seems to be missing. Probably >> something got lost in my transition from autoconf to cmake? >> >> Anything else to pass to cmake so that it, in addition to llvm-ar and >> llvm-ranlib, also used lld? Or isn't that a requirement for building >> with ThinLTO? >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
I finally got around to trying to build with LTO=Thin as discussed earlier. The results so far are negative, so I must have done something wrong. $ export CXX=clang CC=clang $ cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_BINUTILS_INCDIR=/usr/include \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLLVM_TARGETS_TO_BUILD="X86" \ -DLLVM_ENABLE_BACKTRACES=OFF \ -DLLVM_BUILD_EXAMPLES=OFF \ -DLLVM_INCLUDE_EXAMPLES=OFF \ -DLLVM_BUILD_TESTS=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_BUILD_DOCS=OFF \ -DLLVM_INCLUDE_DOCS=OFF \ -DLLVM_ENABLE_DOXYGEN=OFF \ -DLLVM_ENABLE_SPHINX=OFF \ -DLLDB_DISABLE_PYTHON=ON \ -DCLANG_PLUGIN_SUPPORT=OFF \ -DLLVM_ENABLE_LTO=Thin \ -DCMAKE_AR=$PREFIX/bin/llvm-ar \ -DCMAKE_RANLIB=$PREFIX/bin/llvm-ranlib $ ninja -j4 /usr/bin/ld: error: Could not create temporary file: Too many open files clang-3.9: error: unable to execute command: Segmentation fault (core dumped) clang-3.9: error: linker command failed due to signal (use -v to see invocation) [1289/3332] Linking CXX shared module lib/LLVMgold.so $ ninja -j2 /usr/bin/ld: error: Could not create temporary file: Too many open files clang-3.9: error: unable to execute command: Segmentation fault (core dumped) clang-3.9: error: linker command failed due to signal (use -v to see invocation) [1289/3332] Linking CXX shared module lib/LLVMgold.so $ ninja -j1 /usr/bin/ld: error: Could not create temporary file: Too many open files clang-3.9: error: unable to execute command: Segmentation fault (core dumped) clang-3.9: error: linker command failed due to signal (use -v to see invocation) ninja: build stopped: subcommand failed. Command exited with non-zero status 1 $ ls -l /tmp/lto*|wc -l 1310
On Mon, Sep 26, 2016 at 3:33 PM, Carsten Mattner <carstenmattner at gmail.com> wrote:> I finally got around to trying to build with LTO=Thin as discussed earlier. > > The results so far are negative, so I must have done something wrong. > > $ export CXX=clang CC=clangTypo: I did of course CXX=clang++.
And $ ls -l /tmp/lto*|wc -l was $ ls -1 /tmp/lto*|wc -l Not that it matters in this case.
On Mon, Sep 26, 2016 at 6:33 AM, Carsten Mattner <carstenmattner at gmail.com> wrote:> I finally got around to trying to build with LTO=Thin as discussed earlier. > > The results so far are negative, so I must have done something wrong. > > $ export CXX=clang CC=clang > > $ cmake \ > -G Ninja \ > -DCMAKE_BUILD_TYPE=Release \ > -DLLVM_BINUTILS_INCDIR=/usr/include \ > -DCMAKE_INSTALL_PREFIX=$PREFIX \ > -DLLVM_TARGETS_TO_BUILD="X86" \ > -DLLVM_ENABLE_BACKTRACES=OFF \ > -DLLVM_BUILD_EXAMPLES=OFF \ > -DLLVM_INCLUDE_EXAMPLES=OFF \ > -DLLVM_BUILD_TESTS=OFF \ > -DLLVM_INCLUDE_TESTS=OFF \ > -DLLVM_BUILD_DOCS=OFF \ > -DLLVM_INCLUDE_DOCS=OFF \ > -DLLVM_ENABLE_DOXYGEN=OFF \ > -DLLVM_ENABLE_SPHINX=OFF \ > -DLLDB_DISABLE_PYTHON=ON \ > -DCLANG_PLUGIN_SUPPORT=OFF \ > -DLLVM_ENABLE_LTO=Thin \ > -DCMAKE_AR=$PREFIX/bin/llvm-ar \ > -DCMAKE_RANLIB=$PREFIX/bin/llvm-ranlib > > $ ninja -j4 > /usr/bin/ld: error: Could not create temporary file: Too many open files >ThinLTO needs to create as many temporary files as there are input modules to the link. From your 'ls' below, it doesn't look like there is an incredibly huge amount already created, can you check your limits? What is the output of: $ ulimit -n and $ sysctl fs.file-max Teresa clang-3.9: error: unable to execute command: Segmentation fault (core> dumped) > clang-3.9: error: linker command failed due to signal (use -v to see > invocation) > [1289/3332] Linking CXX shared module lib/LLVMgold.so > > $ ninja -j2 > /usr/bin/ld: error: Could not create temporary file: Too many open files > clang-3.9: error: unable to execute command: Segmentation fault (core > dumped) > clang-3.9: error: linker command failed due to signal (use -v to see > invocation) > [1289/3332] Linking CXX shared module lib/LLVMgold.so > > $ ninja -j1 > /usr/bin/ld: error: Could not create temporary file: Too many open files > clang-3.9: error: unable to execute command: Segmentation fault (core > dumped) > clang-3.9: error: linker command failed due to signal (use -v to see > invocation) > ninja: build stopped: subcommand failed. > Command exited with non-zero status 1 > > $ ls -l /tmp/lto*|wc -l > 1310 >-- Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160926/c1b2e11e/attachment.html>