[Wheel-builders] static linking

Robin Becker robin at reportlab.com
Mon Jul 25 10:22:48 EDT 2016


I'm trying to reduce the size of the reportlab manylinux builds. and have a 
couple of problems.

1) I don't know how to detect a manylinux platform in my setup.py. A simple 
solution is to use an evironment variable to change behaviour, but I assume 
there is to be some official os name or platform. Currently I see something like 
this

> platform=Linux-3.16.0-50-generic-x86_64-with-redhat-5.11-Final
> sys.platform=linux2
> os.name=posix



2) Even when I do change behaviour to try and get a static linkage of say 
freetype agains my code I'm getting linkage errors. Static linkage is said to be 
OK in pep 513, but I don't know how to get the multi build code to do it.

I have checked and there are .a files being produced, but it seems they have the 
wrong compile time flags my error looks like

> /opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-CentOS-linux/4.8.2/ld: /usr/local/lib/libfreetype.a(ftinit.o): relocation R_X86_64_32 against `tt_driver_class' can not be used when making a shared object; recompile with -fPIC

I suppose I need to create a library of the .o files created for the shared 
build. Then I can link against that .a rather than the non shared one.
-- 
Robin Becker


More information about the Wheel-builders mailing list