简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM