Skip to content

shared libproj; tests and rebuild for pyproj - #6239

Merged
IsabelParedes merged 3 commits into
emscripten-forge:mainfrom
MMesch:shared-libproj
Aug 24, 2026
Merged

shared libproj; tests and rebuild for pyproj#6239
IsabelParedes merged 3 commits into
emscripten-forge:mainfrom
MMesch:shared-libproj

Conversation

@MMesch

@MMesch MMesch commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Template B: Checklist for updating a package

  • ⚠️ Bump build number if the version remains unchanged
  • [] Or reset build number to 0 if updating the package to a newer version

PR Formatting

  • PR title follows format: Add [package-name] or Update [package-name] to [version] (unsure since this isn't a package update)
  • PR description includes:
    • Version being added/updated
    • Any special build considerations or patches applied

Package Details

  • Package Name: libproj, pyproj
  • Version: unchanged versions

Build Notes

  • I build proj as shared library in this PR. This seems to reduce size from 118Mb (pyproj) to 1.8MB (pyproj) + 4.6MB (libproj) since pyproj otherwise embeds and duplicates much of proj's functionality across it's ~10 .so files. A shared build therefore seems to be the right call here.
  • I deactivated the SONAME in the build as we did in PR #6001, for the same reason that the wasm linker identifies libraries by full name without understanding of semantic version or deduplication of symlinks. This means that two libraries loading the same proj in two different ways, end up with two instances of it which is usually unintended and throws exceptions if each instance handles its own state.
  • I added a set of additional tests to this.
  • I also remove pip from the host build dependencies since it seems it is already provided by cross_python. The additional pip threw a build error (locally on my machine), likely because of duplication. Removing it seems to work fine.

@MMesch
MMesch force-pushed the shared-libproj branch 3 times, most recently from 9bf2b77 to 6d1c52a Compare August 11, 2026 16:43
MMesch added 3 commits August 24, 2026 08:06
Switch BUILD_SHARED_LIBS to ON and drop VERSION/SOVERSION on emscripten so
libproj.so is unversioned. wasm-ld seems to link by raw filename without
understanding of semantic versions or symlink deduplication. This can lead
to loading the same library several times, possibly leading to strange
errors if each instance deals with different state. Same pattern as in
HDF5 (emscripten-forge#6007).
Bump the proj host pin from 9.7.1 to 9.8.1 and PROJ_VERSION to match.
Drop the explicit pip host requirement: cross-python seems to provide
its own pip in the build-time venv, and adding a second pip from
conda-forge lets the two installs collide (mismatched _internal
submodules cause ImportError at pip startup).

With proj shared, each pyproj cython .so shrinks from ~11.7 MB to
under 400 KB. Total package: 118 MB -> 1.5 MB uncompressed, 22 MB ->
269 KB compressed.
The previous test only imported Proj and transform, which passes even
if most of pyproj's compiled modules are broken. Add tests that hit
each cython .so with a numerical check: CRS lookup, WKT roundtrip,
WGS84 to Web Mercator transformer, roundtrip precision, geodesic
distance, and a proj.db database query.

@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.

Thank you!

@IsabelParedes
IsabelParedes merged commit df97789 into emscripten-forge:main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants