Reputation: 674
I'm trying to compile ANN. I compiled using the following command,
make linux-g ++
Later when I try to use this in another code, the code is not compiling. I'm getting the following error,
> relocation R_X86_64_PC32 against symbol `_ZSt4cerr@@GLIBCXX_3.4' can
> not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
After going through various questions , I tried adding the following line to CMAKE,
set_target_properties(${LIBRARY_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
but still, it doesn't work. how can I fix this?
Upvotes: 1
Views: 1077
Reputation: 26362
I'm not sure that this is a proper solution, but as a workaround, you can replace the line
"C++ = g++"
with
"C++ = g++ -fPIC"
in the file Make-config
and then recompile.
Upvotes: 2