On Wed, 9 Mar 2016, Yang Wang wrote:
> If I re-compile the static library with "-fPIC" as suggested by the
> error message, everything works. But is it possible to fix this problem
> withOUT recompile the static library?? Because I need to wrap some other
> static C libraries that I do NOT have the source to recompile ..
"In computing, position-independent code (PIC) or position-independent
executable (PIE) is a body of machine code that, being placed somewhere in
the primary memory, executes properly regardless of its absolute address.
PIC is commonly used for shared libraries, so that the same library code
can be loaded in a location in each program address space where it will
not overlap any other uses of memory (for example, other shared
libraries)."
https://en.wikipedia.org/wiki/Position-independent_code
On some architectures like x86_64 it is *required* that shared libraries
(*.so) are PIC-enabled in order for them to work on Linux.
Since you are not just linking the objects from static library in question
into an executable, but trying to make a shared library which should be
dynamically loadable by Python out of it, you have no choice but to enable
PIC on x86_64. So, I'm sorry, but the answer is "no". If you don't have
the source for other libraries, you'll have to get the authors to
recompile them with -fPIC so that you can use them for your purposes.
--
Sincerely yours,
Yury V. Zaytsev