Skip to content

Conversation

@hoodmane
Copy link
Contributor

@hoodmanehoodmane commented Jul 22, 2025

@hoodmane
Copy link
ContributorAuthor

We'll have to merge python/buildmaster-config#615 before the buildbot will actually use this.

Copy link
Contributor

@freakboy3742freakboy3742 left a comment

Choose a reason for hiding this comment

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

+1 to the general approach (although see my comments on the buildmaster-config PR for a possible direction for minimising the need for re-builds).

However, testing this manually yielded an compilation error on the mpdec build:

wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_setminalloc.minalloc_is_set`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.1`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `stderr`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.2`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_setminalloc.minalloc_is_set`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `MPD_MINALLOC`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.1`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `stderr`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.3`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(context.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.4`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.1`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `stderr`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `.L.str.2`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_free`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_free`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_pow10`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(basearith.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol `mpd_pow10`; recompile with -fPIC wasm-ld: error: /Users/rkm/projects/python/cpython/cross-build/wasm32-emscripten/prefix/lib/libmpdec.a(convolute.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol `mpd_moduli`; recompile with -fPIC wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) 

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@hoodmane
Copy link
ContributorAuthor

Huh I wonder why I didn't get the fPIC problems.

@hoodmane
Copy link
ContributorAuthor

I added CFLAGS=-fPIC, can you try it again?

@freakboy3742freakboy3742 added the needs backport to 3.14 bugs and security fixes label Jul 24, 2025
Copy link
Contributor

@freakboy3742freakboy3742 left a comment

Choose a reason for hiding this comment

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

One minor typo, but otherwise the fPIC fix has done the job.

@freakboy3742freakboy3742 enabled auto-merge (squash) July 24, 2025 06:10
@freakboy3742freakboy3742 merged commit ecb3f23 into python:mainJul 24, 2025
40 checks passed
@miss-islington-app
Copy link

Thanks @hoodmane for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 24, 2025
Adds tooling to build mpdec (and thus _decimal) as part of an Emscripten build. (cherry picked from commit ecb3f23) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
@bedevere-app
Copy link

GH-137066 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14 bugs and security fixes label Jul 24, 2025
hugovk pushed a commit that referenced this pull request Jul 29, 2025
…137066) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Zachary Ware <zach@python.org>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Adds tooling to build mpdec (and thus _decimal) as part of an Emscripten build.
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Adds tooling to build mpdec (and thus _decimal) as part of an Emscripten build.
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…GH-136997) (python#137066) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Zachary Ware <zach@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension-modulesC modules in the Modules dirOS-emscriptenskip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@hoodmane@freakboy3742