<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - make install fails when configured with -DCMAKE_INSTALL_RPATH"
href="https://bugs.llvm.org/show_bug.cgi?id=46654">46654</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>make install fails when configured with -DCMAKE_INSTALL_RPATH
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bevan@bi-co.net
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I build LLVM and libc++ with the following CMake flags to set a custom rpath on
binaries and libraries:
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=$target
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=On
-DCMAKE_INSTALL_RPATH="$rpath"
On `make install` this leads to the following error:
--- snip (actual paths replaced by $rpath and $target) ---
CMake Error at projects/libcxx/src/cmake_install.cmake:83 (file):
file RPATH_CHANGE could not write new RPATH:
$rpath
to the file:
$target/lib/libc++.so
No valid ELF RPATH or RUNPATH entry exists in the file; File does not have
a valid ELF identification.
Call Stack (most recent call first):
projects/libcxx/cmake_install.cmake:51 (include)
projects/cmake_install.cmake:43 (include)
cmake_install.cmake:67 (include)
--- /snip ---
The reason is that $target/lib/libc++.so is a simple text file and not a valid
elf file.
A workaround is to build with
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=0
and manually replace $target/lib/libc++.so with a linker script after `make
install`.
I am not very familiar with CMake. I guess that we would need to tell CMake in
libcxx/cmake/Modules/DefineLinkerScript.cmake to skip ${symlink} in the rpath
modification step. However, ${target}, i.e., the actual shared object, still
needs to be processed.
I encountered this issue with CMake 3.15.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>