1

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?

2
  • You should pass the option to your compiler / linker when building the library. Commented Mar 22, 2015 at 22:16
  • Often, you configure with it. Something like export CFLAGS="-fPIC; ./configure or export CXXFLAGS="-fPIC; ./configure. Commented Mar 22, 2015 at 22:16

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.