wasi lifecycle fix

This commit is contained in:
Jorijn van der Graaf 2025-11-14 18:40:43 +01:00
commit ef0d25cf4a
5 changed files with 6 additions and 44 deletions

View file

@ -107,7 +107,7 @@ namespace Crafter {
if(!config.target.empty()) {
command += std::format(" --target={}", config.target);
if(config.target == "wasm32-wasi") {
command += std::format(" --sysroot={}/wasi-sysroot-28.0 -fno-exceptions", exeDir);
command += std::format(" --sysroot={}/wasi-sysroot-28.0 -fno-exceptions -fno-c++-static-destructors", exeDir);
}
}
if(!config.march.empty()) {
@ -158,7 +158,7 @@ namespace Crafter {
const std::string stdPcm = std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.pcm", exeDir);
fs::path stdCc = fs::path(std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.cppm", exeDir));
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) {
std::string result = RunCommand(std::format("clang++ -fno-exceptions --target=wasm32-wasi -nodefaultlibs --sysroot={}/wasi-sysroot-28.0 -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {} -o {}", exeDir, stdCc.string(), stdPcm));
std::string result = RunCommand(std::format("clang++ -fno-exceptions --target=wasm32-wasi -nodefaultlibs --sysroot={}/wasi-sysroot-28.0 -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier -fno-c++-static-destructors --precompile {} -o {}", exeDir, stdCc.string(), stdPcm));
if(result != "") {
throw std::runtime_error(result);
}