Skip to content

Add petsc - #8736

Open
Alex-PLACET wants to merge 10 commits into
emscripten-forge:emscripten-6xfrom
Alex-PLACET:add_petsc
Open

Alex-PLACET wants to merge 10 commits into
emscripten-forge:emscripten-6xfrom
Alex-PLACET:add_petsc

Conversation

@Alex-PLACET

@Alex-PLACET Alex-PLACET commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Add petsc C++ and Python packages

- PETSc 3.26.1 for emscripten-wasm32/wasm64, serial static build
- Bundles PETSc's C f2cblaslapack (no Fortran, no flang runtime)
- Drops PETSC_HAVE_SYS_PROCFS_H (batch-mode false positive)
- Defines PETSC_DIR in .pc files for strict pkg-config 0.29.2
- Second output builds petsc4py from the tree in the PETSc sdist
- Patch skips rpath flags: wasm-ld rejects --enable-new-dtags, and
  sys.platform is 'unknown' under cross-python so upstream's guard misses
- prefix_detection.ignore: conda's ELF-style binary prefix rewrite corrupts
  wasm side modules (build.dynamic_linking is ignored by rattler-build)
- Verified: wasm32 + wasm64, dense LU residual 0, petsc4py solve on all
  three pytester backends
prefix_detection.ignore skipped text relocation too, leaving the build
dir in petsc4py/lib/petsc.cfg. ignore_binary_files leaves the wasm side
module untouched and still rewrites the .cfg at install.
- test asserts PETSC_DIR is not a build path (caught at $PREFIX)
emci auto-updates the version, so pinning it in a test breaks on every bump.
- recipe-maintainers: Alex-PLACET
@Alex-PLACET
Alex-PLACET marked this pull request as ready for review November 30, 2026 13:43
@Alex-PLACET Alex-PLACET added the 6x Emscripten v6.x label Nov 30, 2026
Comment thread recipes/recipes_wasm/petsc/recipe.yaml Resolved
PETSc's C translation of BLAS/LAPACK as a standalone static package.

- Plain C ABI: no hidden Fortran CHARACTER lengths, no Fortran runtime
- Ships libf2cblas.a + libf2clapack.a and f2cblas/f2clapack .pc files
- Verified wasm32 + wasm64: dgemm, dnrm2, dgetrf/dgetrs from C
Drop the in-recipe f2cblaslapack source and build; take the archives
from the f2cblaslapack-static package instead.
- petsc: 10.7 -> 8.66 MiB, ships libpetsc.a only
- Verified wasm32 + wasm64: petsc and petsc4py tests pass
The version was a literal in build.sh. rattler-build exports PKG_VERSION, so
read it there and keep the version in recipe.yaml only.

- Verified wasm32 + wasm64: pkg-config --modversion 3.8.0.q2, tests pass

@IsabelParedes IsabelParedes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor change. Could you please add entries for f2cblaslapack-static and petsc-static to the variant file?

Thanks!

Comment thread recipes/recipes_wasm/petsc/recipe.yaml Resolved
The output was renamed to petsc-static but its pin_subpackage references still
said 'petsc', so rattler-build aborted with "missing output: petsc". Restore the
build script for that output too; PETSc needs configure/make/install-lib.

- Verified wasm32 + wasm64: petsc-static and petsc4py tests pass
@IsabelParedes

Copy link
Copy Markdown
Member

Only missing this

Minor change. Could you please add entries for f2cblaslapack-static and petsc-static to the variant file?

Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6x Emscripten v6.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants