[cfe-dev] Relink problem building LLVM 7.0.0 rc1 with Cmake, Ninja and gcc 7.1
Fletcher, John P via cfe-dev
cfe-dev at lists.llvm.org
Thu Aug 16 08:21:42 PDT 2018
Doing some more digging, there seems to be an issue between Cmake and Ninja. The Relinking problem has surfaced in a number of different contexts over several years.
Here
https://cmake.org/Bug/view.php?id=13934
there is a long discussion which includes this:
Re 0013934:0034738: Yes. CMake by default links binaries so they can run in the build tree, so their RPATH points at build tree locations. This is not desirable for installation so CMake needs to change the RPATH to a different value (or remove it) during installation. For ELF CMake knows how to edit the binaries as they are installed. For other binary formats that support RPATH CMake needs to re-run the linker with the new RPATH options. That is done during the "preinstall" step which is a dependency of "make install" and is missing from "ninja install".
FYI, one can use CMAKE_BUILD_WITH_INSTALL_RPATH to tell CMake to put the install-tree RPATH in the build-tree binaries so that no relinking or editing is needed on installation (at the cost of not easily running in the build tree):
http://www.cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_BUILD_WITH_INSTALL_RPATH [^]
http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:BUILD_WITH_INSTALL_RPATH [^]
I don't know enough about this to comment further.
This is not the only problem I have reported. It maybe that the combination of Cmake and Ninja is just not suitable at the moment.
John
________________________________________
From: cfe-dev [cfe-dev-bounces at lists.llvm.org] on behalf of Fletcher, John P via cfe-dev [cfe-dev at lists.llvm.org]
Sent: 16 August 2018 12:48
To: Michael Kruse
Cc: clang developer list
Subject: Re: [cfe-dev] Relink problem building LLVM 7.0.0 rc1 with Cmake, Ninja and gcc 7.1
Michael
Thank you for this. I reran the task with these commands added. This time the install ran much further and failed with a similar failure for readline.so
file INSTALL cannot find
"/home/fletcher/LLVM/llvm-7.0.rc1/build/tools/lldb/scripts/Python/modules/readline/CMakeFiles/CMakeRelink.dir/readline.so".
Fortunately this is near the end of the install process and I have a working system for clang, which is what I was looking for.
I think this means that this is an issue for llvm-dev, which I am not subscribed too.
Would someone please forward this to llvm-dev.
It seems to me that there are issues from changes in configuration from 6.0.0 to 7.0.0 which are causing these problems.
Thanks
John
________________________________________
From: Michael Kruse [cfe-dev at meinersbur.de]
Sent: 15 August 2018 20:40
To: Fletcher, John P
Cc: clang developer list
Subject: Re: [cfe-dev] Relink problem building LLVM 7.0.0 rc1 with Cmake, Ninja and gcc 7.1
I have never seen a CMakeRelink.dir in my build directory. You might
try disabling Polly if it is the only cause if the error:
`-DLLVM_POLLY_BUILD=OFF -DLLVM_POLLY_LINK_INTO_TOOLS=OFF
-DLLVM_TOOL_POLLY_BUILD=OFF`
Michael
Am Mi., 15. Aug. 2018 um 10:57 Uhr schrieb Fletcher, John P via
cfe-dev <cfe-dev at lists.llvm.org>:
>
> I have previously built LLVM and Clang 6.0.0 with Cmake, Ninja and gcc 7.1
>
> I am using cmake 3.6.2 and binutils 2.22 with ninja 1.8.2 (updated from 1.7.2 for the 6.0.0 build).
>
> The underlying linux is Ubuntu 12.04, with the gcc 7.1 installed in /opt
>
> My commands for Cmake are these:
>
> /opt/cmake/bin/cmake -GNinja \
> -DCMAKE_C_COMPILER=/opt/gcc-7.1/bin/gcc \
> -DCMAKE_CXX_COMPILER=/opt/gcc-7.1/bin/g++ \
> -DGCC_INSTALL_PREFIX=/opt/gcc-7.1 \
> -DCMAKE_INSTALL_PREFIX=/home/fletcher/LLVM/llvm-7.0.rc1/local -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_PARALLEL_LINK_JOBS=1 -DCMAKE_EXE_LINKER_FLAGS="-Xlinker -R/opt/gcc-7.1/lib64 -L/opt/gcc-7.1/lib64" ../llvm
>
> I have had several problems. Some with versions of cuda I have solved for now by excluding openmp from the build.
>
> After this the build failed when linking a library as follows
>
> FAILED: lib/clang/7.0.0/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a
> --localize-hidden: not found
>
> I have traced this to the fact that the file CmakeCache.txt omits the following lines when built for 7.0.0 which are in the same file for 6.0.0 and the result is that objcopy is not found. --localize_hidden is an argument to objcopy.
>
> //Path to a program.
> CMAKE_NM:FILEPATH=/usr/bin/nm
>
> //Path to a program.
> CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
>
> //Path to a program.
> CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
>
> //Path to a program.
> CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
>
> When I restore these lines to CmakeCache.txt the build of 7.0.0 proceeds to completion.
>
> Install now fails with the following message:
>
> file INSTALL cannot find
> "/home/fletcher/LLVM/llvm-7.0.rc1/build/tools/polly/lib/CMakeFiles/CMakeRelink.dir/LLVMPolly.so".
>
> This is because the location does not exist. Again, comparing with 6.0.0, there the file to be installed was found from /home/fletcher/LLVM/llvm-6.0.distrib/build/lib/libPolly.a
>
> There is a file in the corresponding location in 7.0.0. It is not being used and instead a relinked file is looked for.
>
> It seems that the relink process has not been organised.
>
> I have not looked beyond LVMPolly as the install process will not go any further.
>
> I hope that you can identify what the problem is.
>
> Thank you
>
> John Fletcher
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-dev&data=02%7C01%7CJ.P.Fletcher%40aston.ac.uk%7C7a8d053dbd374e22476308d6036e30c0%7Ca085950c4c2544d5945ab852fa44a221%7C0%7C0%7C636700169135138940&sdata=eRfCuTg%2BueJUOnP43c2Po0%2F4mH6isnHNmYv%2BDwm8SSk%3D&reserved=0
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-dev&data=02%7C01%7CJ.P.Fletcher%40aston.ac.uk%7C7a8d053dbd374e22476308d6036e30c0%7Ca085950c4c2544d5945ab852fa44a221%7C0%7C0%7C636700169135138940&sdata=eRfCuTg%2BueJUOnP43c2Po0%2F4mH6isnHNmYv%2BDwm8SSk%3D&reserved=0
More information about the cfe-dev
mailing list