Description of problem: I am trying to package a project for Fedora that uses the llvm and clang libraries. The build instructions for the project uses the static llvm and clang libraries, and compiling using these instructions work. When I try to replace the static library linking with shared library linking, this works fine for the llvm libraries. If I replace the long list of static llvm libraries with the single libLLVM shared library in the build instructions this works. However, if I then try the next step and try to replace the list of static clang libraries with the libclang.so shared library the linking fails with a lot of missing symbols. It looks like the libclang.so is incomplete and doesn't contain everthing that the static libraries contain. Version-Release number of selected component (if applicable): llvm-3.6.0-1.fc23.x86_64 llvm-devel-3.6.0-1.fc23.x86_64 llvm-static-3.6.0-1.fc23.x86_64 clang-3.6.0-1.fc23.x86_64 clang-devel-3.6.0-1.fc23.x86_64 How reproducible: Always Steps to Reproduce: See my attempt to use the libclang.so shared library in this SRPM: http://www.ellert.se/castxml-0.1-0.1.20150414git43fa139.fc23.src.rpm Actual results: Failed linking when using shared libraries Expected results: Successful linking when using shared libraries Additional info: Why does clang-devel depend on clang? The package I am trying to build links to the clang library and needs the clang headers in clang-devel at runtime but it deas not need the clang and llvm binaries and everything that gets dragged in by installing them. The dependency on clang in clang-devel causes a dependency bloat.
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle. Changing version to '23'. (As we did not run this process for some time, it could affect also pre-Fedora 23 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
I think this problem is caused by the default linker behavior on Fedora. https://fedoraproject.org/wiki/UnderstandingDSOLinkChange The code you want to link is present in some libclang*.so library insted of libclang.so. libclang.so links to the "side" libraries but these dependencies are not added to your program. % cat main.cc #include <clang/Format/Format.h> int main(int argc, char *argv[]) { clang::format::getLLVMStyle(); return 0; } % g++ -lclang ./main.cc /usr/bin/ld: /tmp/fcelda/cc6A7cYr.o: undefined reference to symbol '_ZN5clang6format12getLLVMStyleEv' /usr/lib64/libclangFormat.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status You need to link explicitly: % g++ -lclangFormat ./main.cc % echo $? 0 Or copy the indirect dependencies when linking (but be careful with that): % g++ ./main.cc -Wl,--copy-dt-needed-entries -lclang % echo $? 0