[CMake] CMake -fPIC

Andreas Pokorny andreas.pokorny at gmail.com
Fri Nov 14 05:41:51 EST 2008


Hello,

2008/11/14 ami guru <dosto.walla at gmail.com>:
> [...]
> /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libftgl.a(FTFont.o):
> relocation R_X86_64_32S against `vtable for FTFont' can not be used when
> making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libftgl.a: could not
> read symbols: Bad value
> collect2: ld returned 1 exit status

You try to link a static library to a shared library. Shared library
code must be
position independent. Therefore every object file has to be built with
-fPIC. This
also includes the object files inside your static library.

You have two options
 * build libftgl.a yourself with -fPIC.
 * link libftgl.so to your library - then you have FTGL as a runtime dependency



kind regards
Andreas


More information about the CMake mailing list