musl Python

49 views
Skip to first unread message

JohnMudd

unread,
May 9, 2015, 11:38:10 AM5/9/15
to pyins...@googlegroups.com
I was hoping to use Pyinstaller with Python built on the musl libc library.

http://www.musl-libc.org/

I build with musl because it lets me build on a modern Linux but deploy on Linux up to ten years old and kernel 2.4.

The first problem running pyinstaller is that it can't find the Python lib. Musl requires that I specify the library directory list in a file, not LD_LIBRARY_PATH. If I set $LD_LIBRARY_PATH then I can't run my python.

This is not top priority. Just curious if there's an easy work around.

John

Hartmut Goebel

unread,
May 9, 2015, 12:10:17 PM5/9/15
to pyins...@googlegroups.com
Am 09.05.2015 um 17:38 schrieb JohnMudd:
The first problem running pyinstaller is that it can't find the Python lib. Musl requires that I specify the library directory list in a file, not LD_LIBRARY_PATH. If I set $LD_LIBRARY_PATH then I can't run my python.

This is not top priority. Just curious if there's an easy work around.

Are you talking about building the bootloader?


--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/offi-als-alternative-zum-db-navigator
Kolumne: http://www.cissp-gefluester.de/2010-07-passwoerter-lieben-lernen

JohnMudd

unread,
May 9, 2015, 12:35:32 PM5/9/15
to pyins...@googlegroups.com
Trying to compile my app.

$ pyinstaller --onefile rx_web.py
8 INFO: wrote /home/mudd/test_pyinstall/rx_web.spec
29 INFO: UPX is not available.
53 INFO: Processing hook hook-os
164 INFO: Processing hook hook-time
178 INFO: Processing hook hook-cPickle
262 INFO: Processing hook hook-_sre
393 INFO: Processing hook hook-cStringIO
506 INFO: Processing hook hook-encodings
522 INFO: Processing hook hook-codecs
923 INFO: Extending PYTHONPATH with /home/mudd/test_pyinstall
923 INFO: checking Analysis
923 INFO: building Analysis because out00-Analysis.toc non existent
923 INFO: running Analysis out00-Analysis.toc
936 INFO: Analyzing /usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/loader/_pyi_bootstrap.py
949 INFO: Processing hook hook-os
966 INFO: Processing hook hook-site
983 INFO: Processing hook hook-encodings
1090 INFO: Processing hook hook-time
1105 INFO: Processing hook hook-cPickle
1191 INFO: Processing hook hook-_sre
1329 INFO: Processing hook hook-cStringIO
1458 INFO: Processing hook hook-codecs
1918 INFO: Processing hook hook-pydoc
2075 INFO: Processing hook hook-email
2138 INFO: Processing hook hook-httplib
2178 INFO: Processing hook hook-email.message
2240 INFO: Analyzing /usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py
2294 INFO: Analyzing /usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/loader/pyi_archive.py
2345 INFO: Analyzing /usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/loader/pyi_carchive.py
2396 INFO: Analyzing /usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/loader/pyi_os_path.py
2401 INFO: Analyzing rx_web.py
2498 INFO: Processing hook hook-psycopg2
2805 INFO: Processing hook hook-xml
2834 INFO: Processing hook hook-xml.sax
2864 INFO: Processing hook hook-pyexpat
3015 INFO: Processing hook hook-distutils
3494 INFO: Hidden import 'codecs' has been found otherwise
3494 INFO: Hidden import 'encodings' has been found otherwise
3494 INFO: Looking for run-time hooks
Traceback (most recent call last):
  File "/usr/rx30/musl/Python-2.7.9.install/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/main.py", line 88, in run
    run_build(opts, spec_file, pyi_config)
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/main.py", line 46, in run_build
    PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 1924, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 1873, in build
    execfile(spec)
  File "/home/mudd/test_pyinstall/rx_web.spec", line 6, in <module>
    runtime_hooks=None)
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 446, in __init__
    self.__postinit__()
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 309, in __postinit__
    self.assemble()
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 677, in assemble
    self._check_python_library(binaries)
  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 727, in _check_python_library
    raise IOError("Python library not found!")
IOError: Python library not found!
$

Hartmut Goebel

unread,
May 9, 2015, 12:50:45 PM5/9/15
to pyins...@googlegroups.com
Am 09.05.2015 um 18:35 schrieb JohnMudd:
Trying to compile my app.
[...]

  File "/usr/rx30/musl/Python-2.7.9.install/lib/python2.7/site-packages/PyInstaller/build.py", line 727, in _check_python_library
    raise IOError("Python library not found!")

Then you should debug PyInstaller,bindepend.get_python_library_path why it does not find your python library. I'm sorry, but I'm afraid I can't help you on this any further.

John Mudd

unread,
May 9, 2015, 1:44:52 PM5/9/15
to pyins...@googlegroups.com
Thanks, that helped.

As an experiment I edited get_python_library_path() in bindepend.py to return the path to my python lib. That much worked and pyinstaller compiled my app and produced a single file executable.

The executable fails when I try to run it but that's not a big surprise. It's another conflict between musl and glib libc.

$ rx_web
Error loading Python lib '/tmp/_MEIC1Yi0D/libpython2.7.so': /usr/lib/i386-linux-gnu/libc.so: invalid ELF header
$

What's interesting is that I also tried cx_freeze as an experiment. It produces an executable and collection of libs in one directory that actually runs. I'm actually surprised that much worked. I'm looking into packing the files into a single executable now. This might be my final solution.

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/KdcH19XUlt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

Hartmut Goebel

unread,
May 12, 2015, 4:22:34 AM5/12/15
to pyins...@googlegroups.com
Am 09.05.2015 um 19:44 schrieb John Mudd:
As an experiment I edited get_python_library_path() in bindepend.py to return the path to my python lib. That much worked and pyinstaller compiled my app and produced a single file executable.

If you finished your work, we'd appreciate a pull-request :-)


--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

John Mudd

unread,
May 13, 2015, 2:39:29 PM5/13/15
to pyins...@googlegroups.com
Sorry, it was a dead end. Nothing useful came from the experiment

--
Reply all
Reply to author
Forward
0 new messages