Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xeus-lite kernel compilation error #377

Closed
Vipul-Cariappa opened this issue Jan 1, 2024 · 12 comments
Closed

xeus-lite kernel compilation error #377

Vipul-Cariappa opened this issue Jan 1, 2024 · 12 comments

Comments

@Vipul-Cariappa
Copy link

I am trying to create a kernel for a toy programming language I created (Language at https://github.com/Vipul-Cariappa/KariLang).
I followed the instructions from xeus's documentation "Implementing a kernel". I used the xeus-cookiecutter to initialize the boilerplate code. I have marked the with_wasm flag as yes. I looked at the GitHub actions the cookiecutter generated to figure out how to compile it for jupyter-lite (i.e. wasm).

I am running the following command:

emsdk install 3.1.3

emsdk activate 3.1.3

source "/home/vipul/bin/emsdk/emsdk_env.sh"

micromamba create -f environment-wasm-host.yml --platform=emscripten-32

micromamba activate xeus-mylang-wasm-host

export EMPACK_PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-mylang-wasm-build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-mylang-wasm-host
export CMAKE_PREFIX_PATH=$PREFIX
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX

emcmake cmake \
            -DCMAKE_BUILD_TYPE=Release                        \
            -DCMAKE_PREFIX_PATH=$PREFIX                       \
            -DCMAKE_INSTALL_PREFIX=$PREFIX                    \
            -DXEUS_MYLANG_EMSCRIPTEN_WASM_BUILD=ON               \
            -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON            \
            ..

make

All the above commands run fine except for the make. It fails with long output.

[ 25%] Building CXX object CMakeFiles/xeus-mylang-static.dir/src/xinterpreter.cpp.o
shared:INFO: (Emscripten: Running sanity checks)
/home/vipul/Workspace/JNKernels/xeus-mylang/src/xinterpreter.cpp:32:76: warning: unused parameter 'code' [-Wunused-parameter]
                                                      const  std::string & code, // Code to execute
                                                                           ^
/home/vipul/Workspace/JNKernels/xeus-mylang/src/xinterpreter.cpp:74:71: warning: unused parameter 'code' [-Wunused-parameter]
    nl::json interpreter::is_complete_request_impl(const std::string& code)
                                                                      ^
2 warnings generated.
[ 50%] Linking CXX static library libxeus-mylang.a
[ 50%] Built target xeus-mylang-static
Consolidate compiler generated dependencies of target xmylang
[ 75%] Building CXX object CMakeFiles/xmylang.dir/src/main_emscripten_kernel.cpp.o
[100%] Linking CXX executable xmylang.js
wasm-ld: warning: function signature mismatch: _ZNSt3__26chrono12system_clock9to_time_tERKNS0_10time_pointIS1_NS0_8durationIxNS_5ratioILx1ELx1000000EEEEEEE
>>> defined as (i32) -> i64 in /home/vipul/micromamba/envs/xeus-mylang-wasm-host/lib/libxeus.a(xmessage.cpp.o)
>>> defined as (i32) -> i32 in /home/vipul/bin/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-except.a(chrono.o)
error: undefined symbol: _ZN4xeus12xinterpreter21internal_request_implERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEbxydSA_NS2_14adl_serializerENS6_IhNSA_IhEEEEEE (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: __ZN4xeus12xinterpreter21internal_request_implERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEbxydSA_NS2_14adl_serializerENS6_IhNSA_IhEEEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus12xinterpreter24publish_execution_resultEiN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEbxydSA_NS2_14adl_serializerENS6_IhNSA_IhEEEEEESG_ (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus12xinterpreter24publish_execution_resultEiN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEbxydSA_NS2_14adl_serializerENS6_IhNSA_IhEEEEEESG_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus17create_info_replyERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_S8_S8_S8_S8_bRKN8nlohmann16json_abi_v3_11_210basic_jsonINS0_3mapENS0_6vectorES6_bxydS4_NSA_14adl_serializerENSD_IhNS4_IhEEEEEE (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus17create_info_replyERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_S8_S8_S8_S8_bRKN8nlohmann16json_abi_v3_11_210basic_jsonINS0_3mapENS0_6vectorES6_bxydS4_NSA_14adl_serializerENSD_IhNS4_IhEEEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus18make_null_debuggerERNS_8xcontextERKNS_14xconfigurationERKNSt3__212basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESD_RKN8nlohmann16json_abi_v3_11_210basic_jsonINS5_3mapENS5_6vectorESB_bxydS9_NSF_14adl_serializerENSI_IhNS9_IhEEEEEE (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus18make_null_debuggerERNS_8xcontextERKNS_14xconfigurationERKNSt3__212basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESD_RKN8nlohmann16json_abi_v3_11_210basic_jsonINS5_3mapENS5_6vectorESB_bxydS9_NSF_14adl_serializerENSI_IhNS9_IhEEEEEE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus20create_inspect_replyEbRKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEESH_ (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus20create_inspect_replyEbRKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEESH_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus21create_complete_replyERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEERKiSJ_SH_ (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus21create_complete_replyERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEERKiSJ_SH_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus23create_successful_replyERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEESH_ (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus23create_successful_replyERKN8nlohmann16json_abi_v3_11_210basic_jsonINSt3__23mapENS3_6vectorENS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbxydS9_NS1_14adl_serializerENS5_IhNS9_IhEEEEEESH_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus23make_xserver_emscriptenERNS_8xcontextERKNS_14xconfigurationEN8nlohmann16json_abi_v3_11_26detail15error_handler_tE (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus23make_xserver_emscriptenERNS_8xcontextERKNS_14xconfigurationEN8nlohmann16json_abi_v3_11_26detail15error_handler_tE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _ZN4xeus7xkernelC1ERKNS_14xconfigurationERKNSt3__212basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_10unique_ptrINS_8xcontextENS4_14default_deleteISE_EEEENSD_INS_12xinterpreterENSF_ISI_EEEEPFNSD_INS_7xserverENSF_ISL_EEEERSE_S3_N8nlohmann16json_abi_v3_11_26detail15error_handler_tEENSD_INS_16xhistory_managerENSF_ISV_EEEENSD_INS_7xloggerENSF_ISY_EEEEPFNSD_INS_9xdebuggerENSF_IS11_EEEESO_S3_SC_SC_RKNSQ_10basic_jsonINS4_3mapENS4_6vectorESA_bxydS8_NSQ_14adl_serializerENS16_IhNS8_IhEEEEEEES1A_SS_ (referenced by top-level compiled C/C++ code)
warning: __ZN4xeus7xkernelC1ERKNS_14xconfigurationERKNSt3__212basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_10unique_ptrINS_8xcontextENS4_14default_deleteISE_EEEENSD_INS_12xinterpreterENSF_ISI_EEEEPFNSD_INS_7xserverENSF_ISL_EEEERSE_S3_N8nlohmann16json_abi_v3_11_26detail15error_handler_tEENSD_INS_16xhistory_managerENSF_ISV_EEEENSD_INS_7xloggerENSF_ISY_EEEEPFNSD_INS_9xdebuggerENSF_IS11_EEEESO_S3_SC_SC_RKNSQ_10basic_jsonINS4_3mapENS4_6vectorESA_bxydS8_NSQ_14adl_serializerENS16_IhNS8_IhEEEEEEES1A_SS_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/home/vipul/bin/emsdk/node/16.20.0_64bit/bin/node /home/vipul/bin/emsdk/upstream/emscripten/src/compiler.js /tmp/tmpfv7xfztt.json' failed (returned 1)
make[2]: *** [CMakeFiles/xmylang.dir/build.make:104: xmylang.js] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/xmylang.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I am able to compile the kernel and run it with xeus-zmp (dedicated processes), but compiling it with xeus-lite (run in the browser) fails. You can look at my complete implementation of the kernel at https://github.com/Vipul-Cariappa/KariLang-Kernel. And the log of the GitHub action which builds the xeus-lite version of the kernel.

I am assuming I am doing something wrong, or there is a bug on xeus's side. Any information/suggestions would be helpful.

Happy New Year to you all.

@Vipul-Cariappa
Copy link
Author

Did some investigation.

The above errors mentioned are for undefined symbols. If you look at the symbols they all contain nlohmann. I know that nlohmann_json is one of the dependencies of xeus. So, I thought linking to nlohmann_json was not taking place. But it looks like nlohmann_json is a header-only library, implying linking is not necessary.

There are also two other warnings: "function_name" may need to be added to EXPORTED_FUNCTIONS if it arrives from a system libraryandwarning: function signature mismatch`. I guess I need not worry about them because they are warnings, not errors.

@JohanMabille
Copy link
Member

JohanMabille commented Jan 2, 2024

Happy New Year !

The error is due to an ABI mismatch in nlohmann json, meaning you're linking with dependencies that link with different versions of nlohmann_json. @DerThorsten I think we had a similar issue that you fixed recently, right?

@DerThorsten
Copy link
Member

Happy New Year !

The error is due to an ABI mismatch in nlohmann json, meaning you're linking with dependencies that link with different versions of nlohmann_json. @DerThorsten I think we had a similar issue that you fixed recently, right?

Yes, exactly the same issue. Fixed by (re)-building everything with the same version of nlohmann_json

@Vipul-Cariappa
Copy link
Author

Fixed by (re)-building everything with the same version of nlohmann_json

Thanks for the advice. I got it working. But there was one other issue I faced while building.

Could not find a package configuration file provided by "doctest" 

Look at https://github.com/Vipul-Cariappa/KariLang-Kernel/actions/runs/7396742302/job/20122493278
Which I fixed by compiling the doctest using the following

mkdir -p /opt/doctest/build
git clone https://github.com/doctest/doctest.git /opt/doctest/src
cd /opt/doctest/src
git checkout v2.4.11
cd /opt/doctest/build
emcmake cmake ../src/ -DCMAKE_INSTALL_PREFIX=/custom_sysroot
emmake make -j2 install

Then add the following command line argument for the cmake build of xeus and xeus-lite

-Ddoctest_DIR=/custom_sysroot/lib/cmake/doctest

I would like to know if it is possible to compile without doctest, by using some flag like -D NO_DOCTEST=1? Because doctest is used for testing, and that can be skipped here ...?


Should I open a PR at xeus-cookiecutter repository, with the above updates for the GitHub emscripten_wasm_docker workflow? I believe emscripten_wasm workflow should also be changed to look exactly like the emscripten_wasm_docker one. Because it requires that all the libraries be compiled with the correct versions. Do we plan to keep both emscripten_wasm_docker and emscripten_wasm which are identical, or remove one of them?

@Vipul-Cariappa
Copy link
Author

Question unrelated to this issue: How do I test the wasm build?

When I make install and open jupyter notebook, while selecting the kernel it given the following error

[Errno 2] No such file or directory: '/home/vipul/micromamba/envs/karilang-wasm-jupyter-test/bin/xkarilang'

If I change the kernel.json file to point to the wasm file, then I get

[Errno 13] Permission denied: '/home/vipul/micromamba/envs/karilang-wasm-jupyter-test/bin/xkarilang.wasm'

I also installed jupyterlite-core and ran jupyter lite init and jupyter lite build --output-dir dist and tested it used python's HTTP server. It does not include the wasm kernel.

@DerThorsten
Copy link
Member

Hi,

I would suggest that you just use the xeus from emscripten-forge. On emscripten forge we have the whole xeus-stack compiled to wasm already.

To run a jupyterlite kernel from a local build of a xeus kernel you can follow these instructions here.
https://github.com/jupyterlite/xeus?tab=readme-ov-file#from-local-environment--prefix

The repo https://github.com/jupyterlite/xeus is a relatively new repo which should simplify the deployment / usage of xeus wasm kernels.

@Vipul-Cariappa
Copy link
Author

To run a jupyterlite kernel from a local build of a xeus kernel you can follow these instructions here.
https://github.com/jupyterlite/xeus?tab=readme-ov-file#from-local-environment--prefix

I tried following those instructions; cmake errors

Could not find a package configuration file provided by "xeus-lite"

So I run

micromamba create -n xeus-python-dev \
    --platform=emscripten-wasm32 \
    -c https://repo.mamba.pm/emscripten-forge \
    -c https://repo.mamba.pm/conda-forge \
    --yes \
    "python>=3.11" pybind11 nlohmann_json pybind11_json numpy pytest \
    bzip2 sqlite zlib libffi xtl pyjs \
    xeus xeus-sqlite xeus-lite

i.e. included xeus-lite in the installation.

But building jupyterlite files with

jupyter lite build  --XeusAddon.prefix=$WASM_ENV_PREFIX

Does not add my kernel to the final build. I am still not able to access my kernel from the browser.

@DerThorsten
Copy link
Member

To run a jupyterlite kernel from a local build of a xeus kernel you can follow these instructions here.
https://github.com/jupyterlite/xeus?tab=readme-ov-file#from-local-environment--prefix

I tried following those instructions; cmake errors

Could not find a package configuration file provided by "xeus-lite"

So this happens when you try to build your own kernel?
Do you have xeus-lite installed?

So I run

micromamba create -n xeus-python-dev \
    --platform=emscripten-wasm32 \
    -c https://repo.mamba.pm/emscripten-forge \
    -c https://repo.mamba.pm/conda-forge \
    --yes \
    "python>=3.11" pybind11 nlohmann_json pybind11_json numpy pytest \
    bzip2 sqlite zlib libffi xtl pyjs \
    xeus xeus-sqlite xeus-lite

i.e. included xeus-lite in the installation.

So once you have installed xeus-lite (and the other dependencies) you
can compiled your kernel with cmake.

But building jupyterlite files with

jupyter lite build  --XeusAddon.prefix=$WASM_ENV_PREFIX

Does not add my kernel to the final build. I am still not able to access my kernel from the browser.

Do you install the kernelspec like we do for all our other kernels? https://github.com/jupyter-xeus/xeus-sqlite/blob/main/CMakeLists.txt#L331

And is the name of kernel target the same name as mentioned in the kernelspec?
https://github.com/jupyter-xeus/xeus-sqlite/blob/4a5f6ae12525f770a2c6cddb2edf1c8cf5415945/CMakeLists.txt#L288
https://github.com/jupyter-xeus/xeus-sqlite/blob/main/share/jupyter/kernels/xsqlite/kernel.json.in#L4

Also, if you want to take any dependency from emscripten forge you need to take emscripten 3.1.45

We changed a few things in the cookie-cutter recently, so maybe just try with running the cookie-cutter again https://github.com/jupyter-xeus/xeus-cookiecutter

@Vipul-Cariappa
Copy link
Author

So this happens when you try to build your own kernel?
Do you have xeus-lite installed?

Yes. The error is generated when I try to compile/build.
No, xeus-lite is not installed at this point in time. Look at the diff of jupyterlite/xeus#22. The instructions does not include xeus-lite in its dependencies.


So once you have installed xeus-lite (and the other dependencies) you
can compiled your kernel with cmake.

Yes. I am able to compile and .wasm and .js files are also generated.


Do you install the kernelspec like we do for all our other kernels? https://github.com/jupyter-xeus/xeus-sqlite/blob/main/CMakeLists.txt#L331

Yes. That portion of the CMakeLists.txt file look similar. I am pasting the relevant portion of it below.

if (KARILANG_BUILD_EXECUTABLE OR EMSCRIPTEN)
    # Configuration and data directories for jupyter and xeus-karilang
    set(XJUPYTER_DATA_DIR "share/jupyter"    CACHE STRING "Jupyter data directory")

    # Install xkarilang Jupyter kernelspec
    set(KERNELSPEC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels)
    install(DIRECTORY ${KERNELSPEC_DIR}
            DESTINATION ${XJUPYTER_DATA_DIR}
            PATTERN "*.in" EXCLUDE)


    # Extra path for installing Jupyter kernelspec
    if (XEXTRA_JUPYTER_DATA_DIR)
        install(DIRECTORY ${KERNELSPEC_DIR}
                DESTINATION ${XEXTRA_JUPYTER_DATA_DIR}
                PATTERN "*.in" EXCLUDE)
    endif ()
endif ()

You can have a look at the complete CMakeLists.txt here.


And is the name of kernel target the same name as mentioned in the kernelspec?
https://github.com/jupyter-xeus/xeus-sqlite/blob/4a5f6ae12525f770a2c6cddb2edf1c8cf5415945/CMakeLists.txt#L288
https://github.com/jupyter-xeus/xeus-sqlite/blob/main/share/jupyter/kernels/xsqlite/kernel.json.in#L4

Yes. I am pasting the relevant portion of the files below

if(EMSCRIPTEN)
    include(WasmBuildOptions)
    find_package(xeus-lite REQUIRED)
    add_executable(xkarilang src/main_emscripten_kernel.cpp )
    target_link_libraries(xkarilang PRIVATE xeus-lite KariLang_language)
    KARILANG_set_kernel_options(xkarilang)
    xeus_wasm_compile_options(xkarilang)
    xeus_wasm_link_options(xkarilang "web,worker")
endif()
{
  "display_name": "KariLang 0.0.1 (xkarilang)",
  "argv": [
      "@KARILANG_KERNELSPEC_PATH@xkarilang",
      "-f",
      "{connection_file}"
  ],
  "language": "KariLang",
  "metadata": {"debugger": false
  
  }
}

I am going to paste some additional information below, if it helps in any means.

Output of make install

❯ emmake make install
make: make install
[ 61%] Built target KariLang_language
[ 84%] Built target xeus-karilang-static
[100%] Built target xkarilang
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang/logo-32x32.png
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang/kernel.json
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang/logo-64x64.png
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang/logo-svg.svg
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/lib/cmake/xeus-karilang/xeus-karilangConfig.cmake
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/lib/cmake/xeus-karilang/xeus-karilangConfigVersion.cmake
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/bin/xkarilang.js
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/bin/xkarilang.js
-- Up-to-date: /home/vipul/micromamba/envs/xeus-python-dev/bin/xkarilang.wasm

kernel.json contents

❯ ccat /home/vipul/micromamba/envs/xeus-python-dev/share/jupyter/kernels/xkarilang/kernel.json
{
  "display_name": "KariLang 0.0.1 (xkarilang)",
  "argv": [
      "/home/vipul/micromamba/envs/xeus-python-dev/bin/xkarilang",
      "-f",
      "{connection_file}"
  ],
  "language": "KariLang",
  "metadata": {"debugger": false
  
  }
}

Contents of the xeus-python-dev/bin folder

❯ ls /home/vipul/micromamba/envs/xeus-python-dev/bin
bzip2.js         bzip2recover.wasm  pip   py.test  python   python3.11  sqlite3  xkarilang.js    xmylang.js    xsqlite.js
bzip2recover.js  bzip2.wasm         pip3  pytest   python3  python.bak  wheel    xkarilang.wasm  xmylang.wasm  xsqlite.wasm

We changed a few things in the cookie-cutter recently, so maybe just try with running the cookie-cutter again https://github.com/jupyter-xeus/xeus-cookiecutter

I tried the latest version. The compilation and generation of the .wasm and .js files take place, but I am not able to use it from the browser. That is, I am not able to select the kernel from the browser.

From my general understanding of stuff; I believe I should copy the .wasm, .js and kernel.json files to a specific location, and add some entry in someother file to register them as a kernel. When I run jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX, this is supposed to happen automatically. But it is not happening in my case. Can I do it manually. If it is as simple as I described?

Note: Does it make sense to move the above few conversations to a new issue. This issue is concerned with compilation errors. But the last few conversation is about running the compiled output from jupyterlite. Its a suggestion.

@DerThorsten
Copy link
Member

jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX

@Vipul-Cariappa
Copy link
Author

I managed to get it working.

I created a new mamba environment and installed jupyterlite_xeus, using python -m pip install jupyterlite_xeus. Then I ran jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX.

Previously I had installed jupyterlite_xeus and jupyterlite-core in the system's python's default scope. My guess is that jupyterlite_xeus is not happy with the system's version of python and requires mamba's version of python and the environment.

Including these details, relating to the virtual environments in the documentation (README.md) would be helpful. I can create a new PR in a few minutes for it and you can have a look at it.

image
image

karilang is my kernel.

I'm so sorry, for taking your time. And thanks for all the help.


The next step would be to publish the "lite" (wasm) version of the kernel. Where would I publish it, to conda forge? or to emscripten forge? Does conda forge support wasm builds?

@DerThorsten
Copy link
Member

I managed to get it working.

nice

I created a new mamba environment and installed jupyterlite_xeus, using python -m pip install jupyterlite_xeus. Then I ran jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX.

Previously I had installed jupyterlite_xeus and jupyterlite-core in the system's python's default scope. My guess is that jupyterlite_xeus is not happy with the system's version of python and requires mamba's version of python and the environment.

Including these details, relating to the virtual environments in the documentation (README.md) would be helpful. I can create a new PR in a few minutes for it and you can have a look at it.

image image

karilang is my kernel.

I'm so sorry, for taking your time. And thanks for all the help.

No worries, this is a very complicated and not very well documented stack

The next step would be to publish the "lite" (wasm) version of the kernel. Where would I publish it, to conda forge? or to emscripten forge? Does conda forge support wasm builds?

there is "emscripten-forge" which is a self-made conda-forge-like thing but for emscripten-wasm builds.
https://github.com/emscripten-forge/recipes/pulls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants