-
Notifications
You must be signed in to change notification settings - Fork 1
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
Build failures with Emscripten image > 3.1.12 (when building from source) #9
Comments
My goal was to generate the |
@Jaifroid I'm not skilled to answer this question. I can only say that this is not needed in usual bindings. For the wrapping you should mostly need (from the libzim): the wasm version of the code and the headers. @mgautierfr @mossroy to be confirmed. |
Thanks @kelson42. I think -- but hopefully others will confirm -- that becaause Emscripten builds the WASM and the Web Worker together (and ties them together with a "magic number"), if we don't include the Web Worker at build time, then all the effort to build WASM as a target will be useless for Kiwix JS, because it will be necessary for me to run the build myself in order to get the Worker and WASM pair. I hope I'm wrong, and there is a simple add-on command that will allow me to derive the Worker from the WASM without re-building from scratch... |
After switching to zlib v1.2.13 (you're right, v1.2.12 can not be downloaded any more), I managed to recompile and use this prototype. There are various ways to build and use WASM. However, it would certainly be possible to bind the libzim.a file with a different method (like https://emscripten.org/docs/api_reference/Filesystem-API.html#memfs), that would be able to run unit test on it (and could be included in the CI) with a file included in it. |
It should be possible to build this prototype using the libzim.a produced by kiwix/kiwix-build#548 , although I did not check. In the Makefile, you could remove the steps that generate libzim.a, and provide this file directly in the directory where the demo_file_api.js expects it. However, I see in kiwix/kiwix-build#548 that the emsdk version used to compile libzim.a is 3.1.24, while we currently use 3.1.12 here. I suppose it should work anyway, but if you have problems, you might upgrade emsdk here too. |
Trying to recompile the whole Makefile with emsdk 3.1.24 fails with:
|
Thank you very much @mossroy. That helps a lot, specifically hints about how to derive the wasm and worker from the libzim.a binary. I was compiling with a later version of Emscripten, and hit that error about the ambiguous operator (when I got the zlib error, I first tried upgrading Emscripten in the dockerfile). Slightly worrying that later versions of Emscripten are failing... |
I just started everything from scratch, deleting the docker image and rebuilding with the original SDK specified in this repo (and deleting the
Maybe it's not related to the Emscripten SDK version? |
I do think this "archive has no index" error is related to the emsdk version. |
I ran the
|
The I tried again from a fresh checkout (and after switching to the update-zlib-and-netbeans-conf branch I just created, to update zlib). It generated the a.out.wasm with no error (with the Docker image, based on emsdk 3.1.12, and compiling everything from scratch) About the compilation time, you can add a |
Thanks, @mossroy I'll try again now. |
I tried this procedure twice in an Ubuntu 20.04.5 LTS terminal:
Each time, after running for a fairly long time (faster than before due to the -j6) and outputting thousands of lines of text/log, I get: Is there anything else I can try to get this working and avoid the |
Puzzling... A few ideas to test:
|
@kelson42 @mgautierfr I've tried mossroy's hints above, have confirmed that the correct SDK is being used, but I'm afraid I still get the same error as shown in screenshot above towards the end of the build. I also had a look at emscripten-core/emscripten#9329 and emscripten-core/emscripten#9705, but I can't work out where to add the suggested solutions, and in any case across the two issues there appear to be three suggested solutions:
This is an area in which I'm going to need some help! For me, the ideal situation would be if nightly builds could build the actual WASM plus the JS Web Worker required to run it (which could be done, I guess, through a nightly job on this repo, which would take the |
I have succeded to build
Local compilation is needed (for now) as we need |
@mgautierfr Thank you for the instructions to compile manually. I was compiling using the docker version of Emscripten and mossroy's makefile, which ought to replicate the steps required to do it manually. Is there something obvious that is missing from the dockerfile or the makefile in that case? |
I've tested the |
One of the issues documented here ( |
It turned out there were some residual files pre-compiled in my FS. Thorough cleaning fixed this. |
I confirm that the error with use of overloaded operator is still present if attempting to compile the full toolchain (including generating |
Once #14 is merged, the remaining two build errors are:
|
Not sure anymore if this ticket is still valid, we can compile and run this repo code against https://download.openzim.org/release/libzim/ wasm release AFAIK. So #12 needs to be implemented in CI/CD ans we will be good. |
@kelson42 Last night I tested building the most recent dependencies with the latest Emscripten image, and I still got |
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
This is still an issue when building libzim from source rather than from pre-compiled binaries. We can build using Emscripten emsdk 3.1.41 (current latest) if building using a pre-compiled binary, but building from source still requires 3.1.12, due to the error:
For the relevant workflow run, see https://github.com/openzim/javascript-libzim/actions/runs/5351035516/jobs/9704382137. |
While the issue is not actually fixed, at least we can now successfully build BOTH nightly/release versions AND source versions. We are having to use a different Emscripten SDK for each scenario due to the error detailed above if we build from source using anything higher than 3.1.12. On the other hand, we can no longer build nightlies with enaything lower than 3.1.41, so this is a workaround. Expect source building to break at some future point... |
This errors are already fixed. From your workflow, it seems you are using libzim 8.1.0, you'd better use 8.2.0 |
OK, thanks for spotting that. It's actually hard-coded in the make file for building from source. I'll update and test if this "properly" solves this issue. |
Building libzim 8.2.0 with EMSDK 3.1.41 (latest) now works fine: see https://github.com/openzim/javascript-libzim/actions/runs/5355400958/jobs/9713639586. So this issue is finally solved "properly" by #54. |
@kelson42 @mossroy I've tried to reproduce a build based on the instructions in the README.
I encountered two errors. The first was easy to fix: zlib v1.2.12 no longer exists, so I had to update the reference to it in Makefile to v1.2.13.
The second is much harder (for me) to fix. I consistently get the following error(s) -- I tried three times -- when running the docker / make command, which occurs towards what I believe is the end of the build (it takes a very long time to get to that point before it bombs out):
Easier to see in screenshot:
The text was updated successfully, but these errors were encountered: