[llvm-bugs] [Bug 46654] New: make install fails when configured with -DCMAKE_INSTALL_RPATH

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 9 01:16:49 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46654

            Bug ID: 46654
           Summary: make install fails when configured with
                    -DCMAKE_INSTALL_RPATH
           Product: new-bugs
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bevan at bi-co.net
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200709/2456cdec/attachment-0001.html>


More information about the llvm-bugs mailing list