[CMake] CMake -fPIC

Christopher Harvey chris at basementcode.com
Thu Nov 13 18:36:56 EST 2008


I'm not sure what exactly it wants you to recompile with the -fPIC flag,
however with cmake simply doing add_library should include the -fPIC
flag automatically. If you want to verify what flags are being used to
compile a target set CMAKE_VERBOSE_MAKEFILE to TRUE and you should see
that -fPIC is being used for libraries, even if you don't specify it.

ami guru wrote:
> Hello forum,
>
> I am sorry that i have posted a topic that has already been  several
> times but i did not find
> any solution to the one that i am experiencing now.
>
>
> I have an API compiled with CMake.
>
>
> And While linking i get  the following error:
>
>
> ***********************************
> [100%] Building CXX object
> CMakeFiles/H3DAPI.dir/home/sajjad/downloads/H3D/H3Dsvn/trunk/H3DAPI/src/LocalFog.cpp.o
> Linking CXX shared library libH3DAPI.so
> /usr/bin/ld:
> /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
> make[2]: *** [libH3DAPI.so.2.0.0] Error 1
> make[1]: *** [CMakeFiles/H3DAPI.dir/all] Error 2
> make: *** [all] Error 2
>
>
> ************************************
>
>
> Where should i include the -fPIC flag in the CMakeLists.txt
>
> the error says FTGL library is getting some bad symbols and FTGL is
> compiled with -fPIC and
> FTGL is used by H3D API that is compiled with CMake
>
> Please let me know if more  details are required
>
> Thanks
>
> Sajjad
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list