Description
Now that Conan supports wasm64 (conan-io/conan#17693 / conan-io/conan#18432), support in the Boost recipe may be added as well.
I already described this in conan-io/conan#17693, but I'll copy & update all relevant info below:
When linking against Boost built with the wasm64 architecture, it errors like so:
/home/swdv/emsdk/upstream/emscripten/em++ [...] /home/swdv/.conan2/p/b/boosta13dc00a72eaf/p/lib/libboost_iostreams.a [...] :
wasm-ld: error: /home/swdv/.conan2/p/b/boosta13dc00a72eaf/p/lib/libboost_iostreams.a(file_descriptor.o):
wasm32 object file can't be linked in wasm64 mode
This seems to be caused by the boost recipe passing the wrong address-model to b2, apparently causing modules to still be compiled as 32-bit:
Boost conan build output
$ conan install --build=missing --profile=wasm64 --requires=boost/1.88.0 --update=boost -o'boost/*:without_stacktrace=True' -o'boost/*:without_process=True'
Requirements
boost/1.88.0#7bc0bdd001de6abe470e5e41d3c44686:7dafdc010f4fb6cf170e239077aa1f1f608652af
[...]
boost/1.88.0: WARN: Patching user-config.jam
boost/1.88.0: WARN:
using zlib : 1.3.1 : <include>"/home/swdv/.conan2/p/b/zlib7e2ffcdfd779d/p/include" <search>"/home/swdv/.conan2/p/b/zlib7e2ffcdfd779d/p/lib" <name>z ;
using bzip2 : 1.0.8 : <include>"/home/swdv/.conan2/p/b/bzip2f0a4614959949/p/include" <search>"/home/swdv/.conan2/p/b/bzip2f0a4614959949/p/lib" <name>bz2 ;
using "emscripten" : : "em++" :
<cxxflags>"-sMEMORY64 -matomics -mbulk-memory -fwasm-exceptions" <cflags>"-sMEMORY64 -matomics -mbulk-memory -fwasm-exceptions" ;
boost/1.88.0: Cross building, detecting compiler...
boost/1.88.0: Cross building flags: []
boost/1.88.0: WARN: b2 -q numa=on address-model=32 --layout=system --user-config=/home/swdv/.conan2/p/boost83b280b72608f/s/src/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=emscripten cxxstd=2a pch=on linkflags="" cxxflags="-fPIC" install --prefix=/home/swdv/.conan2/p/b/boost7a4eb059c2974/p -j100 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/swdv/.conan2/p/b/boost7a4eb059c2974/b/build-release"
boost/1.88.0: RUN: b2 -q numa=on address-model=32 --layout=system --user-config=/home/swdv/.conan2/p/boost83b280b72608f/s/src/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=emscripten cxxstd=2a pch=on linkflags="" cxxflags="-fPIC" install --prefix=/home/swdv/.conan2/p/b/boost7a4eb059c2974/p -j100 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/swdv/.conan2/p/b/boost7a4eb059c2974/b/build-release"
notice: found boost-build.jam at /home/swdv/.conan2/p/boost83b280b72608f/s/src/boost-build.jam
notice: loading B2 from /home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/build-system.jam
notice: Searching '/etc' '/home/swdv' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/util' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/tools' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/options' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/contrib' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/build' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in '/etc' '/home/swdv' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/util' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/tools' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/options' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/contrib' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2/build' '/home/swdv/.conan2/p/b20717b8c0763fa/p/bin/.b2'.
notice: Loading explicitly specified user configuration file:
/home/swdv/.conan2/p/boost83b280b72608f/s/src/tools/build/user-config.jam
notice: Searching '/home/swdv/.conan2/p/boost83b280b72608f/s/src/tools/build' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/swdv/.conan2/p/boost83b280b72608f/s/src/tools/build'.
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [bzip2] Using pre-installed library
notice: [bzip2] Condition
notice: will use 'em++' for emscripten, condition <toolset>emscripten-4.0.11
notice: [emscripten-cfg] <toolset>emscripten-4.0.11 :: emcc :: em++
notice: [emscripten-cfg] <toolset>emscripten-4.0.11 :: archiver :: emar
notice: [emscripten-cfg] <toolset>emscripten-4.0.11 :: nodejs version is 22
node: bad option: --experimental-wasm-threads
notice: [emscripten-cfg] <toolset>emscripten-4.0.11 :: nodejs :: node
Performing configuration checks
- default address-model : 64-bit [1]
- default architecture : none [1]
- default address-model : 64-bit [2]
- default architecture : none [2]
- x86 : no [3]
- arm : no [3]
- mips1 : no [3]
- power : no [3]
- sparc : no [3]
- cxx11_static_assert : yes [3]
- cxx11_variadic_templates : yes [3]
- cxx11_decltype : yes [3]
- GCC libquadmath and __float128 support : no [3]
- cxx11_hdr_ratio : yes [3]
- cxx11_template_aliases : yes [3]
- cxx11_char16_t : yes [3]
- cxx11_char32_t : yes [3]
- cxx20_hdr_concepts : yes [3]
- cpp_lib_memory_resource : yes [3]
- BOOST_ARCH_WORD_BITS == 0.0.16 : no [3]
- BOOST_ARCH_WORD_BITS == 0.0.32 : yes [3]
- BOOST_ARCH_WORD_BITS == 0.0.64 : no [3]
- BOOST_ARCH_X86 : no [3]
- BOOST_ARCH_IA64 : no [3]
- BOOST_ARCH_SPARC : no [3]
- BOOST_ARCH_LOONGARCH : no [3]
- BOOST_ARCH_MIPS : no [3]
- BOOST_ARCH_PARISC : no [3]
- BOOST_ARCH_ARM : no [3]
- BOOST_ARCH_RISCV : no [3]
- BOOST_ARCH_PPC : no [3]
- BOOST_ARCH_SYS390 : no [3]
error: No best alternative for /home/swdv/.conan2/p/boost83b280b72608f/s/src/libs/context/build/asm_sources with <abi>sysv <address-model>32 <asynch-exceptions>off <binary-format>elf <boost.beast.allow-deprecated>on <boost.beast.separate-compilation>on <boost.cobalt.executor>any_io_executor <boost.cobalt.pmr>std <boost.locale.iconv.lib>libc <boost.locale.iconv>on <boost.locale.icu>off <closure>off <context-impl>fcontext <coverage>off <cxxstd-dialect>iso <cxxstd>2a <debug-symbols>off <embind>off <exception-handling>on <extern-c-nothrow>off <inlining>full <known-warnings>hide <link-optimization>off <link>static <numa>on <optimization>speed <os>LINUX <pch>on <preserve-test-targets>on <profiling>off <python-debugging>off <relevant>abi <relevant>address-model <relevant>architecture <relevant>binary-format <relevant>toolset <rtti>on <runtime-debugging>off <runtime-link>shared <stdlib>native <strip>off <target-os>none <testing.execute>on <threadapi>pthread <threading>multi <toolset-emscripten:version>4.0.11 <toolset>emscripten <variant>release <vectorize>off <visibility>hidden <warnings-as-errors>off <warnings>on
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>elf <threading>multi <toolset>clang
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>elf <threading>multi <toolset>qcc
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>aapcs <address-model>32 <architecture>arm <binary-format>pe <threading>multi <toolset>msvc
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>elf <threading>multi <toolset>clang
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>mach-o <threading>multi <toolset>gcc
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>pe <threading>multi <toolset>msvc
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>pe <threading>multi <toolset>clang
no match: <abi>aapcs <address-model>64 <architecture>arm <binary-format>pe <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>loongarch <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>o32 <address-model>32 <architecture>mips <binary-format>elf <threading>multi <toolset>clang
no match: <abi>o32 <address-model>32 <architecture>mips <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>n64 <address-model>64 <architecture>mips <binary-format>elf <threading>multi <toolset>clang
no match: <abi>n64 <address-model>64 <architecture>mips <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>mach-o <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>xcoff <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>power <binary-format>xcoff <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>mach-o <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>xcoff <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>xcoff <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>xcoff <threading>multi <toolset>xlclang
no match: <abi>sysv <address-model>64 <architecture>power <binary-format>xcoff <threading>multi <toolset>openxl
no match: <abi>sysv <address-model>32_64 <architecture>power <binary-format>mach-o <threading>multi
no match: <abi>sysv <address-model>64 <architecture>riscv <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>riscv <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>sparc <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>sparc <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>s390x <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>s390x <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>intel
no match: <abi>sysv <address-model>32 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>sysv <address-model>32 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>clang
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>clang-win
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>gcc
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>intel
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>msvc
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>embarcadero
no match: <abi>ms <address-model>32 <architecture>x86 <binary-format>pe <threading>multi <toolset>borland
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>elf <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>elf <threading>multi <toolset>intel
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>clang
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>gcc
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>darwin
no match: <abi>sysv <address-model>64 <architecture>x86 <binary-format>mach-o <threading>multi <toolset>intel
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>clang
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>clang-win
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>gcc
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>intel
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>msvc
no match: <abi>ms <address-model>64 <architecture>x86 <binary-format>pe <threading>multi <toolset>embarcadero
no match: <abi>x32 <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>clang
no match: <abi>x32 <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>gcc
no match: <abi>x32 <address-model>32 <architecture>x86 <binary-format>elf <threading>multi <toolset>intel
no match: <abi>sysv <address-model>32_64 <architecture>x86 <binary-format>mach-o <threading>multi
no match: <abi>sysv <architecture>arm+x86 <binary-format>mach-o <threading>multi
[...]
It seems to build fine, but as can be seen in the b2 command, address-model=32 is passed.
This is caused by _b2_address_model returning 32 in the boost recipe:
|
def _b2_address_model(self): |
|
if self.settings.arch in ("x86_64", "ppc64", "ppc64le", "mips64", "armv8", "armv8.3", "sparcv9", "s390x", "riscv64"): |
|
return "64" |
|
|
|
return "32" |
(I tried adding boost/*:extra_b2_flags='address-model=64' but it doesn't seem to properly override address-model=32.)
Updating the boost recipe with a case for wasm64 in _b2_address_model would probably solve this. Although, if I can make a suggestion, I also think there should be a centralized function returning the address model, to avoid having to update similar logic in multiple recipes.
Another option might be to look into building Boost with CMake instead of Boost.Build (b2), as vcpkg now does (microsoft/vcpkg#32309).
Package and Environment Details
$ conan version
version: 2.18.1
conan_path: /usr/local/bin/conan
python
version: 3.12.3
sys_version: 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0]
sys_executable: /etc/pipx/venvs/conan/bin/python
is_frozen: False
architecture: x86_64
system
version: #63-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 19:04:15 UTC 2025
platform: Linux-6.8.0-60-generic-x86_64-with-glibc2.39
system: Linux
release: 6.8.0-60-generic
cpu: x86_64
$ em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.11 (d3432e7a2a6585331c94b041973fb16c9f332ce4)
Copyright (C) 2025 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
clang version 21.0.0git (https:/github.com/llvm/llvm-project 0f0079c29da4b4d5bbd43dced1db9ad6c6d11008)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/swdv/emsdk/upstream/bin
Conan profile
[settings]
arch=wasm64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.version=20
os=Emscripten
[conf]
tools.build:compiler_executables={'c':'emcc', 'cpp':'em++'}
tools.cmake.cmaketoolchain:user_toolchain=[ '{{ os.getenv('EMSDK') + '/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake' }}' ]
tools.build:cflags=['-sMEMORY64', '-matomics', '-mbulk-memory', '-fwasm-exceptions']
tools.build:cxxflags=['-sMEMORY64', '-matomics', '-mbulk-memory', '-fwasm-exceptions']
Steps to reproduce
- Install Boost via Conan with the wasm64 profile. You may need to disable some components, see the commandline at the top of the logs above
- Try to link against it in a wasm64 application
Description
Now that Conan supports wasm64 (conan-io/conan#17693 / conan-io/conan#18432), support in the Boost recipe may be added as well.
I already described this in conan-io/conan#17693, but I'll copy & update all relevant info below:
When linking against Boost built with the wasm64 architecture, it errors like so:
This seems to be caused by the boost recipe passing the wrong address-model to
b2, apparently causing modules to still be compiled as 32-bit:Boost conan build output
It seems to build fine, but as can be seen in the
b2command, address-model=32 is passed.This is caused by
_b2_address_modelreturning32in the boost recipe:conan-center-index/recipes/boost/all/conanfile.py
Lines 1185 to 1189 in 687cd4e
(I tried adding
boost/*:extra_b2_flags='address-model=64'but it doesn't seem to properly overrideaddress-model=32.)Updating the boost recipe with a case for
wasm64in_b2_address_modelwould probably solve this. Although, if I can make a suggestion, I also think there should be a centralized function returning the address model, to avoid having to update similar logic in multiple recipes.Another option might be to look into building Boost with CMake instead of Boost.Build (
b2), as vcpkg now does (microsoft/vcpkg#32309).Package and Environment Details
Conan profile
Steps to reproduce