Skip to content
New issue

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

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

Already on GitHub? # to your account

Build the extension #6

Merged
merged 7 commits into from
Oct 6, 2021
Merged

Build the extension #6

merged 7 commits into from
Oct 6, 2021

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Oct 6, 2021

Continuation of #3

@jtpio jtpio mentioned this pull request Oct 6, 2021
@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

OK so it now builds on CI and loads as a federated extension:

image

Need to check how we can properly bundle the emscripten generated files now.

@DerThorsten
Copy link
Collaborator

awesome!
maybe we can use the Modules locateFile https://emscripten.org/docs/api_reference/module.html#Module.locateFile
With that one can overwrite the xeus_lua.wasm path.

@DerThorsten
Copy link
Collaborator

DerThorsten commented Oct 6, 2021

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Nice. Sounds like we should be able to use it indeed.

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Getting the following when starting the kernel:

image

@DerThorsten
Copy link
Collaborator

DerThorsten commented Oct 6, 2021

@jtpio which browser are you using? I give it a try in a few minutes.
For firefox I would not be surprised

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Looks like it's for both Firefox 94.0b2 (developer edition) and Chromium 94.

@DerThorsten do you still have the link to the previous demo (the JupyterLite fork)? To see if we hit the same code path as here:

image

@DerThorsten
Copy link
Collaborator

No the page was removed when I transferd the repo from my accound to jupyter-xeus I think.
But I have one locally
lab.zip

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

OK I was wondering whether the emscripten compile flags had changed in between

@DerThorsten
Copy link
Collaborator

DerThorsten commented Oct 6, 2021

@jtpio I just tried to build your changes on my machine but I am facing this:

(jupyterlite-xeus-lua) ➜  jupyterlite_xeus_lua git:(518fbfc) jlpm run build
yarn run v1.21.1
$ jlpm run build:lib && jlpm run copy-files && jlpm run build:labextension:dev
$ tsc
src/xeus_server_kernel.ts:23:66 - error TS2339: Property 'url' does not exist on type 'ImportMeta'.

23     this._worker = new Worker(new URL('./worker.js', import.meta.url));
                                                                    ~~~


Found 1 error.

EDIT: lets me try the steps as they are in the CI workflow..sry for potential spam =)
EDIT: Ok works...forget the "jlpm" command

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Also you might want to clean some stuff up locally with:

rm -rf node_modules
jlpm
jlpm clean:all
jlpm run build

@DerThorsten
Copy link
Collaborator

@jtpio fyi, when I start the kernel I am getting this error on chrome:

Uncaught (in promise) TypeError: Cannot read property 'startsWith' of undefined
    at isDataURI (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:1065)
    at instantiateAsync (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:1149)
    at createWasm (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:1174)
    at extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:7550
    at loadCppModule (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:56)
    at Object../lib/worker.js (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:84)
    at __webpack_require__ (extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:8608)
    at extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:8710
    at extensions/jupyterlite-xeus-lua/static/lib_worker_js.6e9b528aeb6504d42281.js:8712

@DerThorsten
Copy link
Collaborator

@jtpio fyi with firefox I also see the "SharedArrayBuffer" thing

@DerThorsten
Copy link
Collaborator

ok, the reason for the error above is that the locateFile function does not return anything =)

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

when I start the kernel I am getting this error on chrome:

Which version is it? Wondering whether this might be related to recent updates: https://developer.chrome.com/blog/enabling-shared-array-buffer/

@DerThorsten
Copy link
Collaborator

Version 91.0.4472.114 (Official Build) (64-bit)

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Ah that could explain why if these SharedArrayBuffer changes went into 92...

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Maybe there is an emscripten flag what would help avoid generating code using it? Or is it required to be able to compile xeus?

@DerThorsten
Copy link
Collaborator

DerThorsten commented Oct 6, 2021

@jtpio I think this is required if we compile xeus with threads and for the widgets I think we need that.

btw when I copy the wasm file to _ouput/ /lab/extensions/jupyterlite-xeus-lua/static/xeus_lua.wasm everything works.
If I do not copy the file I get bizzare error messages!
(after removing the empty locateFile).

So maybe we should just use the CopyPlugin trick

@DerThorsten
Copy link
Collaborator

hello_again
when I copy the wasm file by hand

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

btw when I copy the wasm file to _ouput/ /lab/extensions/jupyterlite-xeus-lua/static/xeus_lua.wasm everything works.

Ah nice so the wasm file is loaded correctly even without the custom locateFile?

@jtpio jtpio marked this pull request as ready for review October 6, 2021 14:12
@DerThorsten
Copy link
Collaborator

@jtpio yes! (but again, after coping by hand :) )

@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

Marked as ready if you would like to get that in already, and then we continue in another PR (with the file copy trick)

@DerThorsten DerThorsten merged commit 3599568 into jupyterlite:main Oct 6, 2021
@jtpio jtpio deleted the build branch October 6, 2021 14:13
@jtpio
Copy link
Member Author

jtpio commented Oct 6, 2021

It would be fine to do the copy for now if that's the only way.

Maybe we could then try to get webpack to do it automatically using the asset modules and constructing a new URL pointing the .wasm file.

Still, we need to check how to handle this SharedArrayBuffer issue.

@DerThorsten
Copy link
Collaborator

DerThorsten commented Oct 6, 2021

@jtpio once we have a running setup I can experiment around how to get ride of this / how to handle this

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants