Closed GoogleCodeExporter closed 9 years ago
It's on my list to do for the next major release of gmpy2. I'll update the
issue if I get it working.
Original comment by casevh
on 8 Feb 2014 at 10:38
I managed to build a statically linked version of gmpy 1.17. Here are the steps
I followed:
1) Build gmp using
./configure --prefix=/opt/static --disable-shared --with-pic
2) Edit setup.py
gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'],
include_dirs=incdirs,
library_dirs=libdirs,
extra_objects=["/opt/static/lib/libgmp.a"])
3) Build gmpy using:
py26 setup.py build_ext -I/opt/static -L/opt/static -f install
There are probably better ways to do this, but this did work for me.
Original comment by casevh
on 15 Mar 2014 at 6:11
What does --with-pic do?
Original comment by asmeurer@gmail.com
on 15 Mar 2014 at 7:38
PIC stands for Position Independent Code. Roughly speaking, shared libraries
can be loaded arbitrary locations in memory so they require code that can be
relocated at runtime. After a static executable is linked, the code always runs
at a fixed location in memory. When GMP compiles a static library, it assumes
it will be linked to create a static executable so PIC is disabled.
Since we want to create a shared library by linking static libraries together,
the static libraries must be compiled with PIC enabled.
My comments are based on GCC and Linux.
Original comment by casevh
on 16 Mar 2014 at 5:39
I'll be releasing version 2.0.4 that includes a --static option for setup.py to
simplify building a statically linked library. I'll close this ticket for now.
Original comment by casevh
on 28 May 2014 at 4:02
Original issue reported on code.google.com by
asmeurer@gmail.com
on 7 Feb 2014 at 11:11