Compile errors originating from libKF5XsltKde.a

Kevin Funk kfunk at kde.org
Thu Feb 27 15:02:27 UTC 2014


Am Donnerstag, 27. Februar 2014, 15:24:30 schrieb Kevin Funk:
> Am Donnerstag, 27. Februar 2014, 13:06:38 schrieb Kevin Funk:
> > Hey,
> > 
> > I get the following compile errors when compiling anything that depends on
> > libKF5XsltKde.a from kdoctools:
> > 
> > When compiling kio:
> > 
> > [ 53%] Built target kio_file
> > /home/krf/bin/ld: error: /home/krf/devel/install/kf5/lib/x86_64-linux-
> > gnu/libKF5XsltKde.a(xslt.cpp.o): requires dynamic R_X86_64_PC32 reloc
> > against '_ZN7QStringpLE5QChar' which may overflow at runtime; recompile
> > with -fPIC /home/krf/bin/ld: error:
> > /home/krf/devel/install/kf5/lib/x86_64-linux-
> > gnu/libKF5XsltKde.a(xslt.cpp.o): requires dynamic R_X86_64_32 reloc which
> > may overflow at runtime; recompile with -fPIC
> > /home/krf/bin/ld: error: /home/krf/devel/install/kf5/lib/x86_64-linux-
> > gnu/libKF5XsltKde.a(xslt.cpp.o): requires dynamic R_X86_64_PC32 reloc
> > against '_ZN5QChar7unicodeEv' which may overflow at runtime; recompile
> > with
> > -fPIC
> > 
> > Obviously, the reason is that -fPIC is missing for the static library
> > target libKF5XsltKde.a.
> > 
> > I thought that's added implicitly when doing
> > target_link_libraries(KF5XsltKde Qt5::Core KF5::Archive)?
> > That pulls in the link flags from Qt5Core, no?
> > 
> > Ideas?
> > 
> > Important note: My Qt5 here is configured with -no-reduce-relocations
> > (that
> > might be the issue?), adding -fPIC fixes the build for me.
> > 
> > Greets
> 
> Note: That happens with any static library it seems -- just got the same for
> libkatefiletree.a.
> 
> So, any ideas how to solve this in a generic way?
> 
> Cheers

Just discussed this a bit with Stephen on IRC:

We need to set the compile flags manually on each static library used in a 
shared library -- there's no way for CMake to figure out if a static library 
will be added to a shared one.

So, we have to specify
set_target_properties(MyStaticLib PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
manually for each of them

Also see:
http://cmake.3232098.n2.nabble.com/SHARED-library-containing-OBJECT-library-Missing-fPIC-tp7580514p7580571.html

I'll file some patches

Greets

-- 
Kevin Funk


More information about the Kde-frameworks-devel mailing list