Skip to content

Boost no longer builds using toolset=emscripten as of emsdk 4.0.22 #568

@jrxpana

Description

@jrxpana

Environment and version details

  • Operating System+version: Windows 11
  • Compiler+version: emscripten
  • Shell: Windows command prompt, powershell
  • B2 Version: <= 1.90.0

Brief problem description

One of the changes in emsdk 4.0.22 was the removal of the em++ and emcc script files (with no extension) in the emsdk distributions for Windows.

Unfortunately, boost seems to use at least one of these files for detection when you use b2.exe to build with toolset=emscripten.

So starting with 4.0.22 our boost builds began to fail unless we manually created an empty emcc and em++ file in the emsdk\upstream\emscripten folder. I suspect we only needed emcc but we created them both just in case because it's really hard to tell what boost is doing when it builds.

I reported this to the emscripten folks but I'm also reporting here because I don't know who should fix this, and for visibility of the workaround (create empty emcc and em++ files).

You should also be aware that emsdk might have additional changes to the emcc files in the near future, because of things like emscripten-core/emscripten#24858

Steps to reproduce the issue

Download emsdk and set up the environment using the following commands:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
emsdk install 4.0.22
emsdk activate 4.0.22

Then build boost using b2.exe -a toolset=emscripten target-os=linux address-model=32 and your favorite b2 options.

Actual behavior summary

When the emcc and em++ files are missing, the b2 build output starts like this:

Performing configuration checks

    - default address-model    : none [1]
    - cxx11_hdr_ratio          : no [2]
    - cxx11_hdr_ratio          : no [3]
    - has std::atomic_ref      : no [2]

And various parts of the build fail with errors like:

emscripten.compile.c++ bin.v2\libs\date_time\build\emscripten-1\release\address-model-32\exception-handling-on-js\link-static\runtime-link-static\target-os-linux\threading-multi\visibility-hidden\gregorian\greg_month.o
CreateProcessA() Windows API failed: 2 - The system cannot find the file specified.

    "emcc"   -fvisibility-inlines-hidden -fexceptions -pthread -O3 -Wall -fvisibility=hidden -Wno-inline -m32 -sUSE_PTHREADS -emit-llvm -c -DBOOST_ALL_NO_LIB=1 -DBOOST_COBALT_USE_STD_PMR=1 -DDATE_TIME_INLINE -DNDEBUG   -I"."  -c -o "bin.v2\libs\date_time\build\emscripten-1\release\address-model-32\exception-handling-on-js\link-static\runtime-link-static\target-os-linux\threading-multi\visibility-hidden\gregorian\greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp"

Expected behavior summary

When successful, the b2 build output should start like this:

Performing configuration checks

    - default address-model    : 32-bit [1]
    - default architecture     : none [1]
    - cxx11_hdr_ratio          : yes [2]
    - cxx11_template_aliases   : yes [2]
    - cxx11_decltype           : yes [2]
    - cxx11_char16_t           : yes [2]
    - cxx11_char32_t           : yes [2]
    - has std::atomic_ref      : no [2]

and the build will be successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions