[LLVMdev] llvm trunk build failed in cmake_install.cmake on ARM platform

Brad King brad.king at kitware.com
Wed Feb 12 08:07:51 PST 2014


On 02/12/2014 08:08 AM, Mathias Bauer wrote:
> Hi dear list,
> 
> I tried to build llvm+clang on an OpenSuse BuildServer for ARM. The 
> build was carried out with CMake 2.8.11. In the installation step I got 
> the following error:
> 
>> [26815s] -- Installing: /home/abuild/rpmbuild/BUILDROOT/llvm-3.4.99-336.1.arm/usr/lib/libLLVMSupport.so
>> [26815s] CMake Error at lib/Support/cmake_install.cmake:45 (FILE):
>> [26815s]   file RPATH_CHANGE could not write new RPATH:
>> [26815s]
>> [26815s]     $ORIGIN/../lib
>> [26815s]
>> [26815s]   to the file:
>> [26815s]
>> [26815s]     /home/abuild/rpmbuild/BUILDROOT/llvm-3.4.99-336.1.arm/usr/lib/libLLVMSupport.so
>> [26815s]
>> [26815s]   No valid ELF RPATH or RUNPATH entry exists in the file;

CMake by default links binaries in the build tree such that they can
be run immediately with no special environment by using RPATH/RUNPATH.
Then at installation time it has a builtin ELF editor that replaces
the build-tree RPATH with one for the install tree as specified by
the INSTALL_RPATH target property:

 http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:INSTALL_RPATH

When the desired install-tree RPATH is longer than the build tree
one then CMake adds bogus content to the end of the RPATH value for
the build tree to reserve space.

I'm not familiar with the tools for the platform in question, but
some linkers have a security feature that drops RPATH values that
are invalid.  This sometimes trips up CMake's attempt at reserving
space for the install-tree RPATH.  One may work around the problem
by telling CMake to build directly with the install-tree RPATH:

 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

The cost is one may not be able to run the binaries from the build
tree.  To set this for the whole build without modifying the source,
just add -DCMAKE_BUILD_WITH_INSTALL_RPATH=1 to the cmake command line
when configuring the project.

-Brad




More information about the llvm-dev mailing list