[cfe-dev] Statically link libclang

Jacob Carlborg via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 26 12:51:15 PDT 2017


I'm trying to statically link libclang in one of my tools [1]. The 
problem I have is to get the correct order of the LLVM and libclang 
libraries when linking. On macOS it seems I can pass the libraries to 
the linker in any order but that doesn't work on Linux.

I've looked at llvm-config, but that doesn't contain any information 
about libclang, only LLVM. I've tried specifying the order of the 
libraries exactly as specified in 
"tools/clang/tools/libclang/CMakeFiles/libclang.dir/link.txt" after 
invoking cmake and that works.

Is there a way to get/extract the correct order of the libraries 
programmatically without having to hard code the order? Ideally 
something that works across different versions of libclang.

[1] https://github.com/jacob-carlborg/dstep

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list