Open ulope opened 5 years ago
The first solution should be easy to do. I can't imagine that staticx will get rid of the glibc dependency.
There's also https://github.com/indygreg/PyOxidizer (which would give you the perfect result if you can get it to work).
I can't imagine that staticx will get rid of the glibc dependency.
It actually does, but it seems not able to automatically pick up all required libraries and some manual futzing around seems to be necessary to get the result to run on ancient distros.
Over the weekend I used it to make a static raiden build from a bundle built in the python:3.7
docker image (which is debian buster, glibc 2.28-10) that was able to run (although with some, apparently non-fatal, 'symbol not found' uglyness in the pyinstaller bootloader) on centos 6 (which has glibc 2.17).
staticx creates a statically linked executable, which unpacks a directory in /tmp. This directory contains a copy of glibc. Back when I made bbfreeze, this was a no-go.You should not ship glibc as it might break in different ways.
anyway, good luck!
You should not ship glibc as it might break in different ways
Thanks for pointing that out. Sent me on an interesting read through various articles and SO answers.
Apparently with patchelf
now being a thing those problems should be solvable.
But there's just too much 'should', 'probably' and magic in that whole process.
So just building on an old enough system is the much simpler and less likely to break option.
Problem Definition
The single file binary bundles we generate with PyInstaller for Linux are dynamically linked to whatever versions of the system libraries (glibc etc.) are available on the system the bundle is built on.
This leads to those bundles not being usable on older distributions (e.g. centos 6 and the like).
This isn't as much of a problem on macOS since there we already build the images on macOS 10.13 (which is 1 major version behind the most recent release).
Possible solutions
Selected solution
After the discussion below, option 1. looks to be the least likely to introduce annoying hard to debug problems and is also pretty simple to implement.