Create one portable statically linked executable file using Nuitka
See original GitHub issueHi! Thank you for Nuitka!
For xxh project (console tool) I created one portable statically linked executable file using Nuitka:
As you can see I build the Python library first (libpython3.8.a
with appropriate modules) and then use it in LDFLAGS
before running Nuitka. I did this in Alpine with musl and as result I get the one portable statically linked ./xxh
binary file that could be run on many Linux distributes.
Is there a way now or future feature to do this in Nuitka by one command and by using one option i.e. --standalone-static
?
Thanks!
For community:
⬇️ Please click the 👍 reaction instead of leaving a +1
or 👍 comment
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Developers - Create one portable statically linked executable file ...
Create one portable statically linked executable file using Nuitka. ... Coming soon: A brand new website interface for an even better experience!
Read more >PyOxidizer 0.8 - Hacker News
On Linux, PyOxidizer can produce executables that are fully statically linked and don't even support dynamic loading.
Read more >Can I create single file executable with nuitka? - Stack Overflow
I tried --portable and --standalone option but they does not seem to work. And can anyone please explain me what is the --recurse-all...
Read more >Nuitka · PyPI
Nuitka translates the Python modules into a C level program that then uses libpython and static C files of its own to execute...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
--onefile
does not produce statically linked executable. When moved to another system it tries to use host’s glibc. My guess it’s AppImage?Having an option to build truly statically linked binary would be great for producing portable applications.
There is a hacky way to enable non-appimage, using
--onefile-tempdir
, which is undocumented, and enables the code used on macOS, FreeBSD, etc. and actually I didn’t consider static linking of glibc for libc for those, as they won’t have the issue.For commercial users, there is a Linux container with old glibc and new tools chain, that you build these in, and then they ought to be portable:
https://nuitka.net/pages/commercial.html
I think Nuitka creates binaries dynamically linked by default, and chances are that Python you are using does it as well. The only way to produce forward working binaries, is to do it on the oldest system you want to support. On Linux, things are not really geared well for backward porting of binaries.