Skip to content

compiler,rust: No native-static-libs for wasm after 1.84 #14060

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rgonzalezfluendo
Copy link
Contributor

I am working on adding support to gst-plugins-rs to gst.wasm. gst.wasm is a GStreamer port to WebAssembly where meson works correctly for all C/C++ projects. The last release of Rust, version 1.84, unblocks an issue with that language. Rust 1.84 uses the latest emsdk 3.1.68. Among many other things, it fixed an issue with Emscripten dynamic linking and libc. After that, no native-static-libs in the output if running:

rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null

Note:

[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs# rustc --version
rustc 1.83.0 (90b35a623 2024-11-26)
[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs# rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.

note: native-static-libs: -lc

[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs# rustup default beta
info: using existing install for 'beta-x86_64-unknown-linux-gnu'
info: default toolchain set to 'beta-x86_64-unknown-linux-gnu'

  beta-x86_64-unknown-linux-gnu unchanged - rustc 	1.84.0-beta.5 (0857a8e32 2024-12-27)

[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs# rustc --version
rustc 1.84.0-beta.5 (0857a8e32 2024-12-27)
[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs# rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
[cerbero-web-wasm32] root@f4b4c9e2e3b8:/gst-plugins-rs#

@bonzini bonzini added this to the 1.7 milestone Dec 31, 2024
@@ -161,6 +161,9 @@ def _native_static_libs(self, work_dir: str, source_name: str) -> None:
# no match and kernel == none (i.e. baremetal) is a valid use case.
# return and let native_static_libs list empty
return
if self.info.system == 'emscripten':
# no match and emscripten is valid after rustc 1.84
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's expected to always not match, should we skip running rustc --crate-type staticlib --print ....... entirely, and simply return early from the function depending on self.version comparison?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mimicked the baremetal flow where not early-return. I understood that running "rustc" was interesting to check it the compiler can compile staticlib.

However, the decision is yours. Please let me know your preference, and I would be happy to assist with the early return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bonzini bonzini modified the milestones: 1.7, 1.7.1 Jan 27, 2025
@eli-schwartz eli-schwartz removed this from the 1.7.1 milestone Mar 26, 2025
@eli-schwartz
Copy link
Member

This PR cannot be backported (?) to the stable release as it has not been merged to master (!!) -- unsetting from the milestone...

@bonzini bonzini added this to the 1.8 milestone Mar 27, 2025
@bonzini
Copy link
Collaborator

bonzini commented Apr 9, 2025

@rgonzalezfluendo can you rebase to fix CI?

Rust 1.84 uses the latest emsdk 3.1.68 [1], and it fixed an
issue with Emscripten dynamic linking and libc [2]. After that no
native-static-libs in the output if running:

```
rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
```

[1] rust-lang/rust#131533
[2] rust-lang/libc#4002
@bonzini
Copy link
Collaborator

bonzini commented Apr 16, 2025

It didn't fix CI but the failures are independent.

@dcbaker
Copy link
Member

dcbaker commented Apr 16, 2025

@bonzini: is this ready for merge? It's a pretty small bug fix so should be suitable for merge during the release period

@bonzini
Copy link
Collaborator

bonzini commented Apr 16, 2025

Yes, I think everything in the milestone should be suitable... Only @eli-schwartz had some cosmetic comments.

@bonzini bonzini modified the milestones: 1.8, 1.9 Apr 29, 2025
@bonzini bonzini modified the milestones: 1.9, 1.8.2 May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants