Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting linking musl build artifacts to Rust projects #490

Open
ntamas opened this issue Jan 10, 2025 · 1 comment
Open

Supporting linking musl build artifacts to Rust projects #490

ntamas opened this issue Jan 10, 2025 · 1 comment

Comments

@ntamas
Copy link
Contributor

ntamas commented Jan 10, 2025

I still haven't given up on reviving the PyOxidizer project and upgrading the Python distributions that it ships with to more recent versions (up to 3.13) ;-) I'm nearly done with the update in my fork, except for the musl libc build where I ran into an issue as follows.

At some point in the past, PBS decided to build musl-based Python distributions with musl 1.2.5. This version added support for the preadv2/pwritev2 syscalls, and the source code of Python actually uses these syscalls in Modules/posixmodule.c (protected by an #ifdef guard). PyOxidizer produces executables embedding a Python interpreter by wrapping it in Rust code and then using the Rust toolchain to link to the build artifacts published by the PBS project. However, Rust's x86_64-unknown-linux-musl build target ships with musl 1.2.3 for the time being, which does not have preadv2/pwritev2. Therefore, trying to compile a PyOxidizer project with a recent PBS build of Python using musl libc fails with the following linker error:

/usr/bin/ld: /tmp/pyoxidizerm7APCE/build/target/x86_64-unknown-linux-musl/debug/deps/libpyo3_ffi-ee08b5301f7179af.rlib(posixmodule.o): in function `os_preadv':
          posixmodule.c:(.text+0x8a8e): undefined reference to `preadv2'
          /usr/bin/ld: /tmp/pyoxidizerm7APCE/build/target/x86_64-unknown-linux-musl/debug/deps/libpyo3_ffi-ee08b5301f7179af.rlib(posixmodule.o): in function `os_pwritev':
          posixmodule.c:(.text+0x900e): undefined reference to `pwritev2'
          collect2: error: ld returned 1 exit status

(See the failed CI run here).

My question is: would it be possible to make the published tarballs of musl PBS builds ship libc.a from musl libc, or, alternatively, can you include the version of musl libc used for the build in PYTHON.json so PyOxidizer could download the appropriate version of a pre-compiled musl libc from another source to finish the build?

@zanieb
Copy link
Member

zanieb commented Jan 15, 2025

I think we want to ship dynamically linked musl builds instead of static builds — we haven't started on that work though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants