Home > other >  undefined stat symbol after compiling with -fPIC
undefined stat symbol after compiling with -fPIC

Time:12-25

I'm using an (static) external library (zmq.a) in our code, and during the compilation process of our program it says

../libzmq.a(src_libzmd when making a shared object; recompile with -fPIC

However if I compile the library itself with -fPIC, our code now compiles but I received an error on launch: "undefined symbol stat"

Edit: I use the following commands in order to generate libzmq.a (on rdht 7 x86):

autoreconf --install && mkdir build && cd build && ../configure && make CFLAGS='-fPIC' CXXFLAGS='-fPIC' && make install

CodePudding user response:

Okay, so I was able to solve it. I needed to edit the CFLAGS etc. inside the Makefile itself, instead of the way I did it.

Maybe because if I just write CFLAGS='-fPIC' CXXFLAGS='-fPIC' It overrides the other flags (as -O2 for example)?

  • Related