Kostya Tresko
Kostya Tresko

Reputation: 854

recompile with -fPIC flag

I have a project (not mine) which I want to build. It has c++ and Python modules, which has to bind. When I launch cmake, I get this error:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libantlr.a(BitSet.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libantlr.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [python/CModule.so] Error 1
make[1]: *** [pyBinding/CMakeFiles/CMODULE.dir/all] Error 2
make: *** [all] Error 2

I install antlr library with apt-get, and as I understand, I should recompile this library, but I have no idea in which part of source code of antlr library I should put -fPIC, or is there another way?

Upvotes: 1

Views: 1510

Answers (1)

Severin Pappadeux
Severin Pappadeux

Reputation: 20120

In Ubuntu 14.10 I have package libantlr-dev, which contains libantlr.a as well as libantlr-pic.a. I believe you have to use latter one, it is compiled with PIC

Upvotes: 2

Related Questions