wasm-mappings fail to build with Rust 1.96+

Open Beginner friendly
#530 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust, wasm
Domain
build-system

Research direction

Start in wasm-mappings/source-map-mappings-wasm-api and inspect its Rust build configuration and extern declarations. Reproduce the failure with the two cargo commands shown, then add the explicit env link required by Rust 1.96+ and verify that both Rust 1.95.0 and nightly build for wasm32-unknown-unknown.

Written by the indexing model from the issue text.

Description

Rust 1.96+ no longer passes --allow-undefined to wasm-ld (rust-lang/rust#149868). Previously a bare extern "C" block on wasm32-unknown-unknown implicitly imported symbols from the env module.

Now, as upstream stated, we must explicitly add the link to env.

Steps to reproduce

$ cd wasm-mappings/source-map-mappings-wasm-api
$ rustup update nightly
$ cargo +1.95.0 build --target wasm32-unknown-unknown
$ cargo +nightly build --target wasm32-unknown-unknown

Expected result

The build should pass for both toolchains.

Actual result

The build passes for Rust 1.95.0, but fails on 1.96.0+:

error: linking with `rust-lld` failed: exit status: 1
  |
[...]
  = note: rust-lld: error: /home/maxgmr/sources/source-map/wasm-mappings/source-map-mappings-wasm-api/target/wasm32-unknown-unknown/debug/deps/source_map_mappings_wasm_api.8e20wo29qqjt46oljko96p7gc.02rjxce.rcgu.o: undefined symbol: mapping_callback
Dominant language
JavaScript
Stars
3.7k
Forks
370
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/source-map

All issues in mozilla/source-map

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.