Skip to content

LLVM does not take the dynamic linker from --sysroot if specified #3740

@Crivella

Description

@Crivella

Building LLVM (eg from EC#22924) with --sysroot eg in the case of EESSI + EESSI-extend will result in an error during the configuration of the stage 2

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find Z3: Found unsuitable version "/tmp/crivella/easybuild/build/LLVM/20.1.5/GCCcore-13.2.0/llvm.obj.2/CMakeFiles/CMakeTmp/cmTC_9e271: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/intel/haswell/software/GCCcore/13.2.0/lib64/libstdc++.so.6)
", but required is at least "4.8.9" (found /home/crivella/eessi/versions/2023.06/software/linux/x86_64/intel/haswell/software/Z3/4.13.0-GCCcore-13.2.0/lib/libz3.so)
CMake Error at CMakeLists.txt:594 (message):
  Z3 >= 4.8.9 has not been found in LLVM_Z3_INSTALL_DIR:
  /home/crivella/eessi/versions/2023.06/software/linux/x86_64/intel/haswell/software/Z3/4.13.0-GCCcore-13.2.0.

which is actually due to to the test executable built by cmake failing as lld is still setting the system dynamic-linker instead of the sysroot one which ends up picking the system libc instead of the sysroot/compatibility-layer one.

The way this is being handled for GCC is to set the default dynamic linker to be picked up from the sysroot path if available, but LLD does not offer such an option.

Possible solutions/Ideas

  • For building we can add a -Wl,-dynamic-linker=... flag when sysroot is present to force the proper dynamic-linker to be used during compilation
  • For runtime/using the compiler we could add the flag to the .cfg file that is already produced in order to set --gcc-prefix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions