<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I ran in to this exact problem (cmake trying to modify rpath of a linker script) too.<div class="">The workaround I employed was setting “LIBCXX_ENABLE_STATIC_ABI_LIBRARY” to ON.</div><div class="">Works on 13.0.0 and ToT. </div><div class="">Hope this helps.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 3, 2021, at 6:28 PM, Roland Schatz via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
  
  <div class=""><p class="">Hi,<br class="">
      <br class="">
      I'm currently debugging a problem in our Github Actions build.
      We're doing a custom build of libc++ and libc++abi, and this is
      failing since the cmake version in the base image was updated to
      version 3.22.<br class="">
      <br class="">
      The issue can be reproduced by following the instructions at
      <a class="moz-txt-link-freetext" href="https://libcxx.llvm.org/BuildingLibcxx.html">https://libcxx.llvm.org/BuildingLibcxx.html</a>.<br class="">
      <br class="">
      The setup I'm using is this:<br class="">
      * Linux<br class="">
      * cmake version 3.22<br class="">
      * I've tried llvm-project sources 12.0.0, 13.0.0 and the tip of
      main<br class="">
      * system compiler is clang 12.0.1 (but I don't think that matters
      here)<br class="">
      <br class="">
      The exact commands I'm running are (the last one is failing [1]):<br class="">
      <span style="font-family:monospace" class=""><span style="background-color: rgb(255, 255, 255);" class="">cd
          llvm-project<br class="">
          mkdir build<br class="">
          cmake -G Ninja -S runtimes -B build
          "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi"
          -DCMAKE_INSTALL_PREFIX=install<br class="">
        </span></span><span style="font-family:monospace" class=""><span style="font-family:monospace" class=""><span style="background-color: rgb(255, 255, 255);" class="">ninja -C
            build cxx cxxabi</span><br class="">
        </span></span><span style="font-family:monospace" class=""><span style="font-family:monospace" class=""><span style="font-family:monospace" class=""><span style="background-color: rgb(255, 255, 255);" class="">ninja -C
              build install-cxxabi</span><span style="font-family:monospace" class=""><span style="background-color: rgb(255, 255, 255);" class=""><br class="">
                ninja -C build install-cxx</span><br class="">
            </span></span></span></span></p><p class=""><br class="">
      What seems to be happening is that cmake tries to patch the RPATH
      of libc++.so. But libc++.so is not a symlink to a shared object,
      it's a linker script.<br class="">
      I have bisected that to a particular cmake change [2].<br class="">
      <br class="">
      <br class="">
      One thing I noticed is that the build works just fine when I'm
      doing the build of libc++ and libc++abi separately:<br class="">
    </p>
    <pre class="">cmake -S libcxxabi ...
// build, install, ...
cmake -S libcxx -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_LIBRARY_PATH=path/to/install/from/prev/step ...
</pre><p class=""><br class="">
      That works on Linux, but breaks the build on Darwin, it seems to
      be missing the re-exports of libc++abi symbols in libc++ then.<br class="">
      Also that's the "deprecated" way of doing things, so not sure if
      it's good to pursue that path.<br class="">
      <br class="">
      <br class="">
      To be honest, I'm not sure I fully understand the problem, or how
      these different ways of building even make a difference.<br class="">
      <br class="">
      Am I doing something wrong? Is this a bug in LLVM's cmake scripts?
      Or a bug in cmake?<br class="">
      Any hints what I can try to fix this?<br class="">
      <br class="">
      <br class="">
      Thanks!<br class="">
      Roland<br class="">
    </p><p class=""><br class="">
      [1] failing build output:<br class="">
    </p>
    <pre class="">...
-- Installing: /home/roland/test/cmake/llvm-project/install/include/c++/v1/wctype.h
-- Installing: /home/roland/test/cmake/llvm-project/install/include/c++/v1/__config_site
[4/4] cd /home/roland/test/cmake/llvm-project/build/libcxx/src && /nix/store/n7j...ENT=cxx -P /home/roland/test/cmake/llvm-project/build/libcxx/cmake_install.cmake
FAILED: libcxx/src/CMakeFiles/install-cxx /home/roland/test/cmake/llvm-project/build/libcxx/src/CMakeFiles/install-cxx
cd /home/roland/test/cmake/llvm-project/build/libcxx/src && /nix/store/n7jz18i0cspdkfd1y0w1mg5rqvs15kdr-cmake-3.22.0/bin/cmake -DCMAKE_INSTALL_COMPONENT=cxx -P /home/roland/test/cmake/llvm-project/build/libcxx/cmake_install.cmake
-- Install configuration: ""
-- Installing: /home/roland/test/cmake/llvm-project/install/lib/libc++.so.1.0
-- Installing: /home/roland/test/cmake/llvm-project/install/lib/libc++.so.1
-- Set runtime path of "/home/roland/test/cmake/llvm-project/install/lib/libc++.so.1.0" to ""
-- Installing: /home/roland/test/cmake/llvm-project/install/lib/libc++.so
CMake Error at cmake_install.cmake:88 (file):
  file RPATH_CHANGE could not write new RPATH:



  to the file:

    /home/roland/test/cmake/llvm-project/install/lib/libc++.so

Call Stack (most recent call first):
  /home/roland/test/cmake/llvm-project/build/libcxx/cmake_install.cmake:56 (include)


ninja: build stopped: subcommand failed.

</pre><p class="">[2]
<a class="moz-txt-link-freetext" href="https://github.com/Kitware/CMake/commit/2e1149874d34b63cc16c7330ce1ef5ef779e5140">https://github.com/Kitware/CMake/commit/2e1149874d34b63cc16c7330ce1ef5ef779e5140</a><br class="">
    </p>
    <span class=" d-inline-block flex-auto CheckStep-line-content ml-3
 js-check-line-content"><span class="" style=""></span></span>
  </div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>