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

Configure fails for emscripten/wasm build with 3.2.0-rc1 #2247

Open
oscarbenjamin opened this issue Mar 6, 2025 · 10 comments
Open

Configure fails for emscripten/wasm build with 3.2.0-rc1 #2247

oscarbenjamin opened this issue Mar 6, 2025 · 10 comments
Labels

Comments

@oscarbenjamin
Copy link
Contributor

Building FLINT for wasm fails with 3.2.0-rc1 although it previously worked for 3.1. The build fails to configure with:

checking if system can use FLINT's fft_small module... no
configure: WARNING: Currently no assembly available for 32-bit systems. Disabling assembly...
checking how to switch to text section... .text
configure: error: Cannot determine label suffix
emconfigure: error: './configure --disable-dependency-tracking --disable-shared --prefix=/home/runner/work/python-flint/python-flint/wasm-library-dir --with-gmp=/home/runner/work/python-flint/python-flint/wasm-library-dir --with-mpfr=/home/runner/work/python-flint/python-flint/wasm-library-dir' failed (returned 1)
checking for assembler label suffix... 

The configure script tries to determine the label suffix for assembly code but the assembly code cannot be used on wasm as it is only for x86_64 and arm64. I guess ideally configure would fall back on not using assembly here rather than erroring out.

To reproduce this first install emscripten (e.g.. sudo apt-get install emscripten) and then build GMP, MPFR and FLINT but using emconfigure and emmake instead of ./configure and make. I haven't actually tested these steps myself but you can see the commands in the CI job at https://github.com/flintlib/python-flint/pull/262/files.

This comes from flintlib/python-flint#262 (comment) which is trying to build python-flint with the latest version of FLINT to run in the browser.

@albinahlback
Copy link
Collaborator

This should be fixed as of #2248. Please make sure that WASM builds correctly on main, and I will cherry-pick everything in the last days into 3.2.0.

@oscarbenjamin
Copy link
Contributor Author

Thanks. We'll check this.

@agriyakhetarpal
Copy link

@albinahlback
Copy link
Collaborator

Then I don't understand it. Is it just the compiler that is incapable of using labels? Or is the host platform not really Zen 3?

@agriyakhetarpal
Copy link

🤔 Emscripten should be capable of labels. The host isn't Zen 3, though. WebAssembly is architecture-agnostic, but its runtimes differ based on browser and OS/platform combos. I could try to bisect between 3.1.3 and 3.2.0-rc1 and find where the failure started.

@albinahlback
Copy link
Collaborator

The problem isn't with FLINT. You have to specify the correct CPU. If you (indirectly) push Zen 3, it will try to spit out code for Zen 3. Perhaps host_cpu should be wasm64?

@agriyakhetarpal
Copy link

agriyakhetarpal commented Mar 7, 2025

I don't think Emscripten supports specifying CPUs, as it doesn't optimise for CPU instructions and WASM runtimes often use JIT compilation. Is there a baseline option that can be chosen, akin to -march=native? We've set the host to wasm32-unknown-emscripten in the time being. wasm64 (Memory64) isn't supported yet, as it hasn't been standardised across browsers and is available only behind the --experimental-wasm-memory64 flag. For WASM/Pyodide, we'll be needing wasm32, at least for now.

@oscarbenjamin
Copy link
Contributor Author

Looks like the error persists: https://github.com/agriyakhetarpal/python-flint/actions/runs/13710749723/job/38346563289

There was a problem with the CI config meaning that the --host argument was not being passed to ./configure:
flintlib/python-flint@70bf4b6

After fixing that the error does not persist so it looks like this is fixed.

@oscarbenjamin
Copy link
Contributor Author

This should be fixed as of #2248.

This fix was still necessary. It would be good if that can go into 3.2.0.

Thanks Albin!

@albinahlback
Copy link
Collaborator

Will keep it open until the full release.

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

No branches or pull requests

3 participants