Compiling with -fPIC but GCC complains about relocation
I am building Lua bindings for a C library.
In the linker step of my makefile I see this:
gcc -shared -fPIC ext/volksdata/build/libvolksdata.a build/lua_graph.o \
build/lua_namespace.o build/lua_store.o build/lua_term.o \
build/lua_triple.o build/lua_volksdata.o -L/usr/local/lib \
-Lext/volksdata/build -llua -llmdb -lxxhash -luuid -o lib/volksdata.so
/usr/bin/ld: /usr/local/lib/liblua.a(lauxlib.o): warning: relocation against `stdin@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: /usr/local/lib/liblua.a(lstate.o): relocation R_X86_64_PC32 against symbol `lua_newstate' can not be used when making a shared object; recompile with -fPIC
(line breaks in command line added for readability)
This problem has shown up after not touching the Makefile or updating the Lua libraries for months, so I am wondering where the root cause may be. How come all of a sudden I am being asked to recompile Lua with -fPIC?
Thanks for any help.