Skip to content

Commit 91c6eda

Browse files
authored
Fix xeus cpp build (#409)
1 parent 45cd0d1 commit 91c6eda

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ jobs:
165165
pushd build
166166
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
167167
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
168+
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
168169
emcmake cmake \
169170
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
170171
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
171172
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
172173
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
173174
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
174175
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
176+
-DSYSROOT_PATH=$SYSROOT_PATH \
175177
..
176178
emmake make -j ${{ env.ncpus }} install
177179
@@ -183,6 +185,8 @@ jobs:
183185
micromamba activate xeus-lite-host
184186
python -m pip install jupyterlite-xeus
185187
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --output-dir dist
188+
cp xcpp.data dist/extensions/@jupyterlite/xeus/static
189+
cp $PREFIX/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
186190
187191
- name: Upload artifact
188192
uses: actions/upload-pages-artifact@v3

.github/workflows/emscripten.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,14 @@ jobs:
605605
pushd build
606606
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
607607
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
608+
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
608609
emcmake cmake \
609610
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
610611
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
611612
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
612613
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
613614
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
614615
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
616+
-DSYSROOT_PATH=$SYSROOT_PATH \
615617
..
616618
emmake make -j ${{ env.ncpus }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
2+
index aa10b160ccf8..184867e2b55f 100644
3+
--- a/clang/lib/Interpreter/Wasm.cpp
4+
+++ b/clang/lib/Interpreter/Wasm.cpp
5+
@@ -76,8 +76,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
6+
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
7+
PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
8+
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
9+
- std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
10+
- std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
11+
+ std::string ObjectFileName = "/tmp/" + PTU.TheModule->getName().str() + ".o";
12+
+ std::string BinaryFileName = "/tmp/" + PTU.TheModule->getName().str() + ".wasm";
13+
14+
std::error_code Error;
15+
llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error);

0 commit comments

Comments
 (0)