Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could NOT find LLD (missing: LLD_LIBRARIES) #419

Closed
igalic opened this issue Aug 17, 2017 · 10 comments
Closed

Could NOT find LLD (missing: LLD_LIBRARIES) #419

igalic opened this issue Aug 17, 2017 · 10 comments

Comments

@igalic
Copy link

igalic commented Aug 17, 2017

I'm trying to build zig on Ubuntu 17.04 (zesty). I have llvm and clang installed from apt.llvm.org:

ii  clang-4.0                   1:4.0~svn305264-1~exp1 amd64        C, C++ and Objective-C compiler (LLVM based)
ii  clang-4.0-doc               1:4.0~svn305264-1~exp1 all          C, C++ and Objective-C compiler (LLVM based) - Documentation
ii  clang-format-4.0            1:4.0~svn305264-1~exp1 amd64        Tool to format C/C++/Obj-C code
ii  libclang-4.0-dev            1:4.0~svn305264-1~exp1 amd64        clang library - Development package
ii  libclang-common-4.0-dev     1:4.0~svn305264-1~exp1 amd64        clang library - Common development package
ii  libclang1-4.0:amd64         1:4.0~svn305264-1~exp1 amd64        C interface to the clang library
ii  libclang1-4.0-dbg:amd64     1:4.0~svn305264-1~exp1 amd64        clang library
ii  liblld-4.0-dev              1:4.0~svn305264-1~exp1 amd64        LLVM-based linker, header files
ii  liblldb-4.0                 1:4.0~svn305264-1~exp1 amd64        Next generation, high-performance debugger, library
ii  liblldb-4.0-dev             1:4.0~svn305264-1~exp1 amd64        Next generation, high-performance debugger, header files
ii  libllvm-4.0-ocaml-dev       1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies, OCaml bindings
ii  libllvm3.8:amd64            1:3.8.1-18ubuntu1      amd64        Modular compiler and toolchain technologies, runtime library
ii  libllvm4.0:amd64            1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies, runtime library
ii  libllvm4.0:i386             1:4.0~svn305264-1~exp1 i386         Modular compiler and toolchain technologies, runtime library
ii  libllvm4.0-dbg:amd64        1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies, debugging libraries
ii  lld-4.0                     1:4.0~svn305264-1~exp1 amd64        LLVM-based linker
ii  lldb-4.0                    1:4.0~svn305264-1~exp1 amd64        Next generation, high-performance debugger
ii  llvm-4.0                    1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies
ii  llvm-4.0-dev                1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies, libraries and headers
ii  llvm-4.0-doc                1:4.0~svn305264-1~exp1 all          Modular compiler and toolchain technologies, documentation
ii  llvm-4.0-examples           1:4.0~svn305264-1~exp1 all          Modular compiler and toolchain technologies, examples
ii  llvm-4.0-runtime            1:4.0~svn305264-1~exp1 amd64        Modular compiler and toolchain technologies, IR interpreter
ii  python-clang-4.0            1:4.0~svn305264-1~exp1 amd64        Clang Python Bindings
ii  python-lldb-4.0             1:4.0~svn305264-1~exp1 amd64        Next generation, high-performance debugger, python lib

however, when trying to build zig, it's not being picked up:

 ~/s/p/zig    build  cmake ..  -DCMAKE_INSTALL_PREFIX=(pwd) -DZIG_LIBC_LIB_DIR=(dirname (cc -print-file-name=crt1.o)) -DZIG_LIBC_INCLUDE_DIR=(echo -n | cc -E -x c - -v 2>&1 | grep -B1 "End of search list." | head -n1 | cut -c 2- | sed "s/ .*//") -DZIG_LIBC_STATIC_LIB_DIR=(dirname (cc -print-file-name=crtbegin.o))
Configuring zig version 0.0.0
-- Could NOT find LLD (missing:  LLD_LIBRARIES) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/igalic/src/plt/zig/build
 ~/s/p/zig    build  

here's a --trace of that same cmake run, extracting only the things between find_package(lld ) and the error message:

/home/igalic/src/plt/zig/CMakeLists.txt(34):  find_package(lld )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(9):  find_path(LLD_INCLUDE_DIRS NAMES lld/Driver/Driver.h PATHS /usr/lib/llvm-4.0/include /mingw64/include )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(14):  find_library(LLD_LIBRARY NAMES lld-4.0 lld PATHS /usr/lib/llvm-4.0/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(15):  if(EXISTS ${LLD_LIBRARY} )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(17):  else()
/home/igalic/src/plt/zig/cmake/Findlld.cmake(18):  macro(FIND_AND_ADD_LLD_LIB _libname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(31):  FIND_AND_ADD_LLD_LIB(lldDriver )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldDriver _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldDriver PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(32):  FIND_AND_ADD_LLD_LIB(lldELF )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldELF _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldELF PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(33):  FIND_AND_ADD_LLD_LIB(lldCOFF )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldCOFF _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldCOFF PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(34):  FIND_AND_ADD_LLD_LIB(lldMachO )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldMachO _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldMachO PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(35):  FIND_AND_ADD_LLD_LIB(lldReaderWriter )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldReaderWriter _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldReaderWriter PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(36):  FIND_AND_ADD_LLD_LIB(lldCore )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldCore _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldCore PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(37):  FIND_AND_ADD_LLD_LIB(lldYAML )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldYAML _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldYAML PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(38):  FIND_AND_ADD_LLD_LIB(lldConfig )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(19):  string(TOUPPER lldConfig _prettylibname_ )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(20):  find_library(LLD_${_prettylibname_}_LIB NAMES lldConfig PATHS /usr/lib/llvm-4.0/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(26):  if(LLD_${_prettylibname_}_LIB )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(41):  include(FindPackageHandleStandardArgs )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(132):  include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake )
/usr/share/cmake-3.7/Modules/FindPackageMessage.cmake(32):  function(FIND_PACKAGE_MESSAGE pkg msg details )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(133):  include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(136):  macro(_FPHSA_FAILURE_MESSAGE _msg )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(148):  macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(177):  function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG )
/home/igalic/src/plt/zig/cmake/Findlld.cmake(42):  find_package_handle_standard_args(LLD DEFAULT_MSG LLD_LIBRARIES LLD_INCLUDE_DIRS )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(181):  set(options CONFIG_MODE HANDLE_COMPONENTS )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(182):  set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(183):  set(multiValueArgs REQUIRED_VARS )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(184):  set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(185):  list(FIND _KEYWORDS_FOR_EXTENDED_MODE ${_FIRST_ARG} INDEX )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(187):  if(${INDEX} EQUAL -1 )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(188):  set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(189):  set(FPHSA_REQUIRED_VARS ${ARGN} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(190):  set(FPHSA_VERSION_VAR )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(206):  if(x${FPHSA_FAIL_MESSAGE} STREQUAL xDEFAULT_MSG )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(207):  set(FPHSA_FAIL_MESSAGE Could NOT find ${_NAME} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(212):  if(FPHSA_CONFIG_MODE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(218):  if(NOT FPHSA_REQUIRED_VARS )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(222):  list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(224):  string(TOUPPER ${_NAME} _NAME_UPPER )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(225):  string(TOLOWER ${_NAME} _NAME_LOWER )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(227):  if(FPHSA_FOUND_VAR )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(233):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(234):  set(_FOUND_VAR ${_NAME_UPPER}_FOUND )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(239):  set(MISSING_VARS  )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(240):  set(DETAILS  )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(242):  set(FPHSA_FOUND_${_NAME} TRUE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(243):  foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(244):  if(NOT ${_CURRENT_VAR} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(245):  set(FPHSA_FOUND_${_NAME} FALSE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(246):  string(APPEND MISSING_VARS  ${_CURRENT_VAR} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(244):  if(NOT ${_CURRENT_VAR} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(247):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(248):  string(APPEND DETAILS [${${_CURRENT_VAR}}] )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(251):  if(FPHSA_FOUND_${_NAME} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(254):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(255):  set(${_NAME}_FOUND FALSE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(256):  set(${_NAME_UPPER}_FOUND FALSE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(260):  unset(FOUND_COMPONENTS_MSG )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(261):  unset(MISSING_COMPONENTS_MSG )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(263):  if(FPHSA_HANDLE_COMPONENTS )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(291):  set(VERSION_MSG  )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(292):  set(VERSION_OK TRUE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(293):  set(VERSION ${${FPHSA_VERSION_VAR}} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(296):  if(DEFINED ${_NAME}_FIND_VERSION )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(354):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(355):  if(VERSION )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(360):  if(VERSION_OK )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(361):  string(APPEND DETAILS [v${VERSION}(${${_NAME}_FIND_VERSION})] )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(368):  if(${_NAME}_FOUND )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(370):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(372):  if(FPHSA_CONFIG_MODE )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(374):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(375):  if(NOT VERSION_OK )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(377):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(378):  _FPHSA_FAILURE_MESSAGE(${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG} )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(137):  if(${_NAME}_FIND_REQUIRED )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(139):  else()
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(140):  if(NOT ${_NAME}_FIND_QUIETLY )
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake(141):  message(STATUS Could NOT find LLD (missing:  LLD_LIBRARIES)  )
-- Could NOT find LLD (missing:  LLD_LIBRARIES) 
@andrewrk
Copy link
Member

You also need LLD from apt.llvm.org. I forget what the package name is but it's similarly named to the clang and llvm packages.

@andrewrk
Copy link
Member

You might need additionally the non-dev package for LLD.

@andrewrk
Copy link
Member

andrewrk commented Aug 17, 2017

Apologies, I see that you have all of these things apparently installed. Here is the list of packages I install on the travis CI build which is an ubuntu that uses apt.llvm.org:

sudo apt-get install -y clang-4.0 libclang-4.0 libclang-4.0-dev llvm-4.0 llvm-4.0-dev liblld-4.0 liblld-4.0-dev cmake

Looks like you may be missing liblld-4.0. This is not your fault, I think it's packaging bug on apt.llvm.org's part because the -dev package should depend on this one.

Hope that helps.

@andrewrk
Copy link
Member

<meena> aaand, built! thanks!

@wesleyParriott
Copy link

wesleyParriott commented Aug 4, 2022

for w/e reason on Pop_Os the lld libraries were versions were referenced slightly differentl (this is from jammy)
So, what worked for me was running this

sudo apt install liblld-14 && sudo apt install liblld-14-dev

@dheater
Copy link

dheater commented Sep 21, 2023

Pop_OS! 22.04 w/ zig 0.11.x branch using apt.llvm.org:
sudo apt-get install -y clang-16 libclang-16-dev llvm-16 llvm-16-dev liblld-16 liblld-16-dev

@c-shinkle
Copy link

Linux Mint 21.2 (Ubuntu 22.04) requires the following packages to build zig 0.13.x:
sudo apt install -y build-essential cmake clang-18 libclang-18-dev libclang-cpp18-dev llvm-18 llvm-18-dev lld-18 liblld-18-dev libpolly-18-dev libllvm18

Be warned: this issue is caused by Ubuntu and how it handles the config for LLVM. In order to avoid this problem more thoroughly, you should build LLVM from source. More commentary can be found from @andrewrk on this post.

@tyuvraj
Copy link

tyuvraj commented Jun 13, 2024

Same issue on Ubuntu (Solved)

  • I was facing the same issue. As of writing this comment I need to install llvm 18 to build zig.
  • I removed my current clang and llvm installations and installed them using the installation script from https://apt.llvm.org/,
  • When I ran cmake I kept getting the errors -- Could NOT find lld (missing: LLD_LIBRARIES LLD_INCLUDE_DIRS) (Required is at least version "18")
  • When I separately installed sudo apt-get install -y liblld-18 liblld-18-dev inspired from here
    The issue got solved.

Seeing that this happens often there should be update to the install documentation to either point to this issue page or ask them to manually install liblld-<llvm-version>-dev if they go the install script route.

@andrewrk
Copy link
Member

Seeing that this happens often there should be update to the install documentation to either point to this issue page or ask them to manually install liblld-<llvm-version>-dev if they go the install script route.

Not really, this is more of an Ubuntu-specific problem. If you use Ubuntu to provide LLD rather than building from source then you're responsible for understanding how they have chosen to divide up their packages.

The error message is crystal clear. There is nothing more to do or document from Zig's side of things.

Also this problem will no longer exist after #16270.

@tyuvraj
Copy link

tyuvraj commented Jun 13, 2024

Seeing that this happens often there should be update to the install documentation to either point to this issue page or ask them to manually install liblld-<llvm-version>-dev if they go the install script route.

Not really, this is more of an Ubuntu-specific problem. If you use Ubuntu to provide LLD rather than building from source then you're responsible for understanding how they have chosen to divide up their packages.

The error message is crystal clear. There is nothing more to do or document from Zig's side of things.

Also this problem will no longer exist after #16270.

Understandable. I should have build the dragon haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants