I'm trying to package a CLI app as a Linux standalone executable using PyInstaller. I don't have a Linux OS so I used Vagrant to package it; used the CentOS 7 box since the server where the executable will run is also CentOS 7.
I was able to create a standalone executable and it ran successfully with a fresh CentOS 7 Vagrant machine (no provisioning scripts / no python3 and its dependencies installed).
But when I run the executable in the server, it gives me this error:
[user@server ~]$ emails_automation/emails --help
[22874] Error -3 from inflate: unknown compression method
fwrite: Bad address
Some Observations
✅ Both VM and the actual server has the same glibc version:
VM:
[root@localhost emails]# ldd --version
ldd (GNU libc) 2.17
Server:
[user@server ~]$ ldd --version
ldd (GNU libc) 2.17
🤔 Searching for "inflate: unknown compression method" in the pyinstaller repo and returned files related to `zlib`. So I checked whether zlib is installed in the server, and the fresh CentOS 7 VM (the one without any provisioning scripts) by running the python REPL and both doesn't give import errors which tells me zlib is installed.
VM:
[vagrant@localhost ~]$ python
Python 2.7.5 (default, Apr 2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib
>>> zlib.crc32
<built-in function crc32>
Server:
[user@server ~]$ python
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib
>>> zlib.crc32
<built-in function crc32>
Any pointers for me?