Migrating from 4x to 6x#
This guide is for maintainers migrating existing emscripten-forge recipes from the 4x channel to 6x (Emscripten 6.0, with emscripten-wasm32 and emscripten-wasm64).
Packages are published to emscripten-forge/6x. Background on the 6x release and wasm64 is in the blog post.
Checklist#
When migrating a recipe:
Move it into the correct directory (
recipes_wasmorrecipes_native).Align package names with conda-forge.
Split static and shared libraries into separate outputs/packages.
Add
generic-testing.For shared libraries: add
run_exports.For
*-staticconsumers: usepin_compatibleand ensurevariant.yamlpins exist.Drop obsolete
SIDE_MODULE/WASM_BIGINTworkarounds for normal shared libraries.Remove any
overwriteProp.cmakefrom the recipe directory and use${CMAKE_ARGS}for CMake builds.Update Fortran deps from
libflangtolibflang-rt-staticwhere needed.For
noarch: python, adopt thepython_minbuild/host/run pattern.
Directory structure#
Recipes must be moved (not copied) out of the legacy directories:
Legacy (4x) |
Canonical (6x) |
|---|---|
|
|
|
|
recipes_wasm is the primary location for wasm packages. recipes_emscripten may still contain packages awaiting migration; do not add new recipes there.
All packages#
Generic testing#
All packages should include generic-testing in addition to any package-specific tests:
tests:
- script: generic-testing
requirements:
build:
- generic-testing
For noarch: python packages, set the target platform explicitly:
tests:
- script: target_platform=${{ host_platform }} generic-testing
requirements:
build:
- generic-testing
Some packages may need generic-testing --allow-pthread when ABI stubs trip the checker even though there is no real pthread activity (see lxml).
Naming and library layout#
Package names should match conda-forge when both ecosystems ship the same project (for example
libpcre2/libpcre2-static/pcre2/pcre2-static).Packages must not contain both static and shared libraries in the same output. Split them into separate packages or recipe outputs (for example
geosandgeos-static). Shared-only or static-only packages are fine when only one flavour is needed.
Static libraries#
Static library packages should end with
*-static(for examplelibfoo-static).Run dependencies on
*-staticpackages must usepin_compatible.Default pinning is
major.minor, but always checkvariant.yamlfor the pin in use.
run:
- ${{ pin_compatible("libfoo-static", lower_bound='x.x', upper_bound='x.x') }}
Concrete example from lxml:
host:
- libiconv-static
- libxml2-static
- libxslt-static
- zlib-static
run:
- ${{ pin_compatible("libiconv-static", lower_bound='x.x', upper_bound='x.x') }}
- ${{ pin_compatible("libxml2-static", lower_bound='x.x', upper_bound='x.x') }}
- ${{ pin_compatible("libxslt-static", lower_bound='x.x', upper_bound='x.x') }}
- ${{ pin_compatible("zlib-static", lower_bound='x.x', upper_bound='x.x') }}
variant.yaml#
All
*-staticpackages that need a global pin must have an entry invariant.yaml.The pin for a
*-staticpackage should match the pin for the non-static package when both exist.Default pin granularity is
major.minorunless a different convention is already established for that package.
zlib:
- 1.3
zlib-static:
- 1.3
libzlib:
- 1.3
libzlib-static:
- 1.3
Wasm64#
Both emscripten-wasm32 and emscripten-wasm64 are enabled by default in CI. You do not need to opt in per recipe.
Override extra.ci.platforms only when a package cannot (or should not) build for one of the platforms:
extra:
ci:
platforms:
emscripten-wasm32: true
emscripten-wasm64: false
Fortran#
Packages that previously depended on libflang should depend on libflang-rt-static (and pin it with pin_compatible when it is a run dependency):
host:
- libflang-rt-static
run:
- ${{ pin_compatible('libflang-rt-static', lower_bound='x.x', upper_bound='x.x') }}
Related packages may also ship as libflang-rt / libflang-rt-headers; prefer the static runtime for Fortran link deps unless a recipe specifically needs another output.
Python#
noarch: python#
Noarch Python packages relax the Python constraint per CFEP-25. Use:
requirements:
build:
- python =${{ python_min }}
host:
- python =${{ python_min }}
run:
- python >=${{ python_min }}
Build against python =${{ python_min }} so files land in the matching lib/pythonX.Y/site-packages. Do not depend on an exact version + build string of other packages from noarch recipes.
CMake#
Delete overwriteProp.cmake / overwriteProps.cmake from the recipe directory, and remove any -DCMAKE_PROJECT_INCLUDE=... that pointed at it. Pass ${CMAKE_ARGS} instead; the compiler activation already sets the necessary cross-compilation bits:
emcmake cmake ${CMAKE_ARGS} -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON
Known issue: libtool and wasm64#
Autotools / libtool sometimes injects -sSIDE_MODULE=2. On wasm64 that can produce empty or incorrect shared libraries (effectively wasm32 stubs).
Fix: strip -sSIDE_MODULE=2 from the libtool sources both before and after configure. See the pcre2 build script:
# Remove this from the copied file and use -shared only
sed -i 's/-sSIDE_MODULE=2 //g' m4/libtool.m4
emconfigure ./configure \
--prefix=$PREFIX \
--host="$HOST" \
--enable-shared \
...
# Needs to be removed again from the generated file
sed -i 's/-sSIDE_MODULE=2 //g' libtool
Reference recipes#
Topic |
Example under |
|---|---|
Split shared / static outputs |
|
Shared |
|
|
|
|
|
Fortran + |
|
|
|
Disable wasm64 |
|
libtool |
|