h5wasm
h5wasm copied to clipboard
This package does not run on Windows
Hello,
I am trying to use this package in my application but it does not work in windows computers. After sime research I believe that in file src/hdf5_util.cc
every .c_str()
must be replaced for .data()
.
Could you try that for me?
I created this fork (https://github.com/masasso/h5wasm) to solve the problem but as I dont know much about web assembly I am not able to compile the project.
Thanks in advance.
I'm afraid I haven't set it up to be built on Windows. The Makefile is not compatible with Windows, and there may be other issues such as the one you found. If you would like to submit a pull request with a working build setup for Windows, I'd be happy to add it to the package.
It can certainly be built in a linux container within WSL running on Windows, if you are unable to get a MacOS or linux machine on which to build, and once it is built, it of course runs in the browser on any platform.
Sorry I can't be more help right now.
How actually you test your updates?
I am trying to install the package I created with npm install https://github.com/masasso/h5wasm
but node does not recognize it.
If you can give me some instructions on how to add more updates and check it is working I would be more than happy to help.
The problem is that I am building a vscode extension that must work for any user in the main operation systems (Windows, Linux and Mac)
You don't need to build h5wasm on every operating system - I build it using linux or MacOS then package the wasm build into an npm package and publish it, then users of any operating system can install with npm and they will get the binary wasm code that will run on their system.
What I did in my https://github.com/masasso/h5wasm
was.
- Replaced every
.c_str()
for.data()
inh5wasm/src/hdf5_util.cc
- Installed Emscripten and followed all the instructions
- Called
make
- Called
npm run build
- Commited with the new
./src/hdf5_hl.d.ts
file created.
What I did in my personal package that is using it:
-
npm instal https://github.com/masasso/h5wasm
- Next I imported it in my project
import h5wasm from "h5wasm";
- But I get an error:
Activating extension failed: Cannot find module 'h5wasm'.
I am doing everything on Linux first to check if it works, but now even in Linux it does not work. Am I missing something?
you haven't committed your 'dist' folder to your github repo. If you want to install directly from github the compiled files have to be there in the repo. I am using the npmjs repo to host the compiled files because it is awkward to commit large compiled files to github, but for your testing it should be fine.
Have you already faced this problem. I never touched this part of the code in file node_esm_shim.js
Activating extension i' failed: Module parse failed: Identifier 'createRequire' has already been declared (6:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| globalThis.require = createRequire(import.meta.url);
|
import { createRequire } from 'module'; | const require = createRequire(import.meta.url); | .
Can you tell me which version of emscripten you are using?
The latest version at https://github.com/emscripten-core/emsdk
So it should be 3.1.38 Toggle commit message
You can remove the line
--extern-pre-js ${CMAKE_CURRENT_SOURCE_DIR}/src/node_esm_shim.js \
from CMakeLists.txt if you are using a very recent emscripten like you are.
Also it looks like the more recent versions of emscripten are stripping the _malloc and _free functions with -O3, so I added them to the explicit export list (pull the most recent version of h5wasm).
I was able to run the test with npm test
after building with your version of emscripten (with the change to CMakeLists.txt described above, that is not in the current h5wasm repo so you'll have to make it yourself)