Skip to content

Commit

Permalink
Fix xeus cpp build (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbarton authored Dec 24, 2024
1 parent 45cd0d1 commit 91c6eda
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,15 @@ jobs:
pushd build
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
emcmake cmake \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make -j ${{ env.ncpus }} install
Expand All @@ -183,6 +185,8 @@ jobs:
micromamba activate xeus-lite-host
python -m pip install jupyterlite-xeus
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --output-dir dist
cp xcpp.data dist/extensions/@jupyterlite/xeus/static
cp $PREFIX/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,14 @@ jobs:
pushd build
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
emcmake cmake \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make -j ${{ env.ncpus }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index aa10b160ccf8..184867e2b55f 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -76,8 +76,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
- std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
- std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
+ std::string ObjectFileName = "/tmp/" + PTU.TheModule->getName().str() + ".o";
+ std::string BinaryFileName = "/tmp/" + PTU.TheModule->getName().str() + ".wasm";

std::error_code Error;
llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error);

0 comments on commit 91c6eda

Please sign in to comment.