pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rust-1.81.0 & LLVM, LLD and cmake



FWIW I have rust 1.81 built without a problem under -current amd64
using llvm-18.1.8, no options enabled in mk.conf. For me, lldb
consistently fails under aarch64 though, not that it has anything to
do with the original question...


On Sat, 5 Oct 2024 at 12:54, Havard Eidnes <he%netbsd.org@localhost> wrote:
>
> Hi,
>
> I am finding that rust 1.81.0 does not appear to want to build
> with an external LLVM (and libunwind), at least not if either of
> those are not >= 18.0.0.
>
> However, installing LLVM 18.x and libunwind 18.x still does not
> make rust-1.81.0 build with this external LLVM, and this leads me
> to a battle with my favourite hate object: cmake, which spreads
> its different fragments and functions over a myriad of
> non-transparent places, and if I need to do some surgery to the
> cmake setup, it's basically impossible to figure out where to do
> that.  Case in point, the rust-1.81.0 build now fails with
>
> -- Installing: /usr/pkgsrc/wip/rust181/work/rustc-1.81.0-src/build/x86_64-unknown-netbsd/lld/bin/lld
> CMake Error at tools/lld/cmake_install.cmake:50 (file):
>   file RPATH_CHANGE could not write new RPATH:
>
>     $ORIGIN/../lib
>
>   to the file:
>
>     /usr/pkgsrc/wip/rust181/work/rustc-1.81.0-src/build/x86_64-unknown-netbsd/lld/bin/lld
>
>   The current RPATH is:
>
>     /usr/pkg/lib
>
>   which does not contain:
>
>     $ORIGIN/../lib:/usr/pkg/lib:
>
>   as was expected.
> Call Stack (most recent call first):
>   cmake_install.cmake:51 (include)
>
>
> gmake: *** [Makefile:100: install] Error 1
>
> Now, I know that we have scaffolding in pkgsrc which prevents the
> use of $ORIGIN in RPATHs, and I hope that the static RPATH
> pointing to ${PREFIX}/lib (here /usr/pkg/lib) will be sufficient.
>
> Looking at
>
> work/rustc-1.81.0-src/build/x86_64-unknown-netbsd/lld/build/tools/lld/cmake_install.cmake
>
> says at the top
>
> # Install script for directory: /usr/pkgsrc/wip/rust181/work/rustc-1.81.0-src/src/llvm-project/lld/tools/lld
>
> But ... this is a build directory, so patching that will not
> succeed -- it looks like this cmake_install.cmake is generated.
> But from what?!?  There's no trace.  This file contains
>
> if(CMAKE_INSTALL_COMPONENT STREQUAL "lld" OR NOT CMAKE_INSTALL_COMPONENT)
>   if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld" AND
>      NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld")
>     file(RPATH_CHECK
>          FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld"
>          RPATH "\$ORIGIN/../lib")
>   endif()
>   file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE MESSAGE_LAZY FILES "/usr/pkgsrc/wip/rust181/work/rustc-1.81.0-src/build/x86_64-unknown-netbsd/lld/build/bin/lld")
>   if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld" AND
>      NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld")
>     file(RPATH_CHANGE
>          FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld"
>          OLD_RPATH "\$ORIGIN/../lib:/usr/pkg/lib:"
>          NEW_RPATH "\$ORIGIN/../lib")
>     if(CMAKE_INSTALL_DO_STRIP)
>       execute_process(COMMAND "/usr/pkgsrc/wip/rust181/work/.tools/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lld")
>     endif()
>   endif()
> endif()
>
> and obviously this attempt at $ORIGIN tweaking needs to go for
> pkgsrc (yes?)
>
> But ... where does this cmake section come from?
>
> I've rummaged a bit around in work/rustc-1.81.0-src/llvm-project
> without much success, at which point I throw up my hands in
> frustration.
>
> Forcing rust to always build with the embedded LLVM (which
> succeeds) seems a bit heavy-handed, and will not exactly do
> wonders for the rust build time (as if that wasn't terrible
> already).
>
> Searching with
>
> find work/rustc-1.81.0-src/src/llvm-project/ -type f -print0 | \
>   xargs -0 egrep -l CMAKE_INSTALL_COMPONENT | xargs egrep -l ORIGIN
>
> only turns up
>
> work/rustc-1.81.0-src/src/llvm-project/llvm/cmake/modules/AddLLVM.cmake
>
> and that's not it.
>
> How do folks debug this stuff?!?  Is there some tool I should
> use which I don't know about?
>
> "Help!"
>
> Regards,
>
> - Håvard



-- 
----


Home | Main Index | Thread Index | Old Index