[llvm-dev] Specifying custom search path for system libraries when building LLVM 9

Albert Chin via llvm-dev llvm-dev at lists.llvm.org
Sun Feb 9 15:42:45 PST 2020


I am building LLVM 9.0.1 on RHEL7 and would like to use a custom path
for some libraries (`xml2', `z', etc.). How do I do this? When I build
with cmake, I specify the new search/runtime path in
CMAKE_LIBRARY_PATH/CMAKE_INSTALL_RPATH respectively but correct -L
path's aren't included.

For example, when llvm-tblgen is built, the command-line is:
  /usr/local/gcc8/bin/g++ -fPIC -fvisibility-inlines-hidden \
  -Werror=date-time -std=c++1y -Wall -Wextra \
  -Wno-unused-parameter -Wwrite-strings -Wcast-qual \
  -Wno-missing-field-initializers -pedantic -Wno-long-long \
  -Wimplicit-fallthrough -Wno-maybe-uninitialized \
  -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor \
  -Wno-comment -ffunction-sections -fdata-sections -O3 \
  -Wl,-allow-shlib-undefined  -Wl,-O3 -Wl,--gc-sections \
  CMakeFiles/obj.llvm-tblgen.dir/AsmMatcherEmit \
  ...
  -o ../../bin/llvm-tblgen ../../lib/libLLVMSupport.a \
  ../../lib/libLLVMTableGen.a -lpthread ../../lib/libLLVMSupport.a \
  -lz -lrt -ldl -ltinfo -lpthread -lm ../../lib/libLLVMDemangle.a \
  -Wl,-rpath,::::::::::...

How do I add -L/usr/local/libz12/lib to the above? I encounter the
same problem with `FileCheck', `not', `yaml-bench', and
`libLLVM-9.so'.

I looked at https://llvm.org/docs/LLVMBuild.html but didn't see
anything.

-- 
albert chin (china at thewrittenword.com)


More information about the llvm-dev mailing list