Bug 1211943 - libclang.so incomplete
Summary: libclang.so incomplete
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: llvm
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Adam Jackson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1210948
TreeView+ depends on / blocked
 
Reported: 2015-04-15 09:05 UTC by Mattias Ellert
Modified: 2016-06-05 12:11 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-05 12:11:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mattias Ellert 2015-04-15 09:05:03 UTC
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.

Comment 1 Jan Kurik 2015-07-15 14:16:25 UTC
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

Comment 2 Jan Včelák 2016-06-05 12:11:38 UTC
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


Note You need to log in before you can comment on or make changes to this bug.