When building with C++ 23 standard modules, the '-fbuiltin-module-map' clang argument seems not to work properly.
Any help to resolve this issue would be greatly appreciated, thank you !
C++ Code
// Main.cxx
import std;
int main(void)
{
std::cout << "Hello world" << std::endl;
return 0;
}
Version of emscripten/emsdk:
$ em++ -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.50 (047b82506d6b471873300a5e4d1e690420b582d0)
clang version 18.0.0 (https://github.com/llvm/llvm-project 14028ec0a62210d68a4dd7a046ac79c8c3b7727e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/ptah/Tools/emsdk/upstream/bin
Failing command line in full:
$ em++ -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx
Main.cxx:1:9: fatal error: module 'std' not found
1 | import std; //everything in std namespace is in here
| ~~~~~~~~^~~
1 error generated.
em++: error: '/home/ptah/Tools/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx -c -o /tmp/emscripten_temp__bnx4x9u/Main_0.o' failed (returned 1)
** Working command line in full using clang:**
$ clang++ -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx
Full link command and output with -v appended:
$ em++ -v -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx
"/home/ptah/Tools/emsdk/upstream/bin/clang++" -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -v -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx -c -o /tmp/emscripten_temp_5ll0y5z5/Main_0.o
clang version 18.0.0 (https://github.com/llvm/llvm-project 14028ec0a62210d68a4dd7a046ac79c8c3b7727e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/ptah/Tools/emsdk/upstream/bin
(in-process)
"/home/ptah/Tools/emsdk/upstream/bin/clang-18" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Main.cxx -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/ptah/Projects/LexoMusic/Native/Test -v -fcoverage-compilation-dir=/home/ptah/Projects/LexoMusic/Native/Test -resource-dir /home/ptah/Tools/emsdk/upstream/lib/clang/18 -D EMSCRIPTEN -isysroot /home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot -internal-isystem /home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1 -internal-isystem /home/ptah/Tools/emsdk/upstream/lib/clang/18/include -internal-isystem /home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten -internal-isystem /home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include -std=c++23 -fdeprecated-macro -ferror-limit 19 -fvisibility=default -fgnuc-version=4.2.1 -fmodules -fimplicit-module-maps -fmodules-cache-path=/home/ptah/.cache/clang/ModuleCache -fmodule-map-file=/home/ptah/Tools/emsdk/upstream/lib/clang/18/include/module.modulemap -fmodules-validate-system-headers -fcxx-exceptions -fignore-exceptions -fexceptions -fcolor-diagnostics -iwithsysroot/include/fakesdl -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o /tmp/emscripten_temp_5ll0y5z5/Main_0.o -x c++ Main.cxx
clang -cc1 version 18.0.0 based upon LLVM 18.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/fakesdl
/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/compat
/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1
/home/ptah/Tools/emsdk/upstream/lib/clang/18/include
/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot/include
End of search list.
Main.cxx:1:9: fatal error: module 'std' not found
1 | import std; //everything in std namespace is in here
| ~~~~~~~~^~~
1 error generated.
em++: error: '/home/ptah/Tools/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/home/ptah/Tools/emsdk/upstream/emscripten/cache/sysroot -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -v -std=c++23 -stdlib=libc++ -fmodules -fbuiltin-module-map Main.cxx -c -o /tmp/emscripten_temp_5ll0y5z5/Main_0.o' failed (returned 1)
When building with C++ 23 standard modules, the '-fbuiltin-module-map' clang argument seems not to work properly.
Any help to resolve this issue would be greatly appreciated, thank you !
C++ Code
Version of emscripten/emsdk:
Failing command line in full:
** Working command line in full using clang:**
Full link command and output with
-vappended: