diff --git a/share/jupyter/kernels/xc11/wasm_kernel.json.in b/share/jupyter/kernels/xc11/wasm_kernel.json.in index 554591a4..009f8a98 100644 --- a/share/jupyter/kernels/xc11/wasm_kernel.json.in +++ b/share/jupyter/kernels/xc11/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-xc", "-std=c11", "-mllvm", "-enable-emscripten-sjlj", diff --git a/share/jupyter/kernels/xc17/wasm_kernel.json.in b/share/jupyter/kernels/xc17/wasm_kernel.json.in index 2af2c3f6..4d6e92a4 100644 --- a/share/jupyter/kernels/xc17/wasm_kernel.json.in +++ b/share/jupyter/kernels/xc17/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-xc", "-std=c17", "-mllvm", "-enable-emscripten-sjlj", diff --git a/share/jupyter/kernels/xc23/wasm_kernel.json.in b/share/jupyter/kernels/xc23/wasm_kernel.json.in index c20a2388..9913d6ea 100644 --- a/share/jupyter/kernels/xc23/wasm_kernel.json.in +++ b/share/jupyter/kernels/xc23/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-xc", "-std=c23", "-mllvm", "-enable-emscripten-sjlj", diff --git a/share/jupyter/kernels/xcpp17/wasm_kernel.json.in b/share/jupyter/kernels/xcpp17/wasm_kernel.json.in index fc2a3d61..a8de4ed0 100644 --- a/share/jupyter/kernels/xcpp17/wasm_kernel.json.in +++ b/share/jupyter/kernels/xcpp17/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-std=c++17", "-mllvm", "-enable-emscripten-cxx-exceptions", "-mllvm", "-enable-emscripten-sjlj", "-msimd128" ], diff --git a/share/jupyter/kernels/xcpp20/wasm_kernel.json.in b/share/jupyter/kernels/xcpp20/wasm_kernel.json.in index f84b07d3..a36fa59b 100644 --- a/share/jupyter/kernels/xcpp20/wasm_kernel.json.in +++ b/share/jupyter/kernels/xcpp20/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-std=c++20", "-mllvm", "-enable-emscripten-cxx-exceptions", "-mllvm", "-enable-emscripten-sjlj", "-msimd128" ], diff --git a/share/jupyter/kernels/xcpp23/wasm_kernel.json.in b/share/jupyter/kernels/xcpp23/wasm_kernel.json.in index 097fd552..3fdd0422 100644 --- a/share/jupyter/kernels/xcpp23/wasm_kernel.json.in +++ b/share/jupyter/kernels/xcpp23/wasm_kernel.json.in @@ -3,6 +3,7 @@ "argv": [ "@XEUS_CPP_KERNELSPEC_PATH@xcpp", "-resource-dir", "/lib/clang/@CPPINTEROP_LLVM_VERSION_MAJOR@", + "-Xclang", "-iwithsysroot/include/compat", "-std=c++23", "-mllvm", "-enable-emscripten-cxx-exceptions", "-mllvm", "-enable-emscripten-sjlj", "-msimd128" ], diff --git a/test/test_interpreter.cpp b/test/test_interpreter.cpp index 5ce9d540..ed510f4e 100644 --- a/test/test_interpreter.cpp +++ b/test/test_interpreter.cpp @@ -99,6 +99,43 @@ TEST_SUITE("execute_request") REQUIRE(result["status"] == "ok"); } +#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD) + TEST_CASE("headers found in sysroot/include/compat") + { + std::vector Args = { + "-v", + "-Xclang", "-iwithsysroot/include/compat" + }; + + xcpp::interpreter interpreter((int)Args.size(), Args.data()); + std::string code = "#include "; + nl::json user_expressions = nl::json::object(); + xeus::execute_request_config config; + config.silent = false; + config.store_history = false; + config.allow_stdin = false; + nl::json header = nl::json::object(); + xeus::xrequest_context::guid_list id = {}; + xeus::xrequest_context context(header, id); + + std::promise promise; + std::future future = promise.get_future(); + auto callback = [&promise](nl::json result) { + promise.set_value(result); + }; + + interpreter.execute_request( + std::move(context), + std::move(callback), + code, + std::move(config), + user_expressions + ); + nl::json result = future.get(); + REQUIRE(result["status"] == "ok"); + } +#endif + TEST_CASE("fetch_documentation") { std::vector Args = {/*"-v", "resource-dir", "....."*/}; @@ -1135,4 +1172,4 @@ TEST_CASE("C and C++ stdout/stderr capture") REQUIRE(captured_out.find("C++ stdout") != std::string::npos); REQUIRE(captured_err.find("C stderr") != std::string::npos); REQUIRE(captured_err.find("C++ stderr") != std::string::npos); -} +} \ No newline at end of file