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

How to run in electron project? #24

Closed
danhnd98 opened this issue Oct 26, 2021 · 9 comments
Closed

How to run in electron project? #24

danhnd98 opened this issue Oct 26, 2021 · 9 comments

Comments

@danhnd98
Copy link

danhnd98 commented Oct 26, 2021

Error: "a dynamic link library (dll) initialization routine failed with electron" with electron project
nodeJs: v12.18.3, electron: v15.3.0

@anhhtbk
Copy link

anhhtbk commented Oct 26, 2021

I have same problem on MacOS:
Error: dlopen(node_modules/dicom-dimse-native/build/Release/dcmtk.node, 1): no suitable image found. Did find:
node_modules/dicom-dimse-native/build/Release/dcmtk.node: mach-o, but wrong architecture
node_modules/dicom-dimse-native/build/Release/dcmtk.node: mach-o, but wrong architecture

@knopkem
Copy link
Owner

knopkem commented Oct 26, 2021

@anhhtbk The reason for this error is that there are no prebuild available (because I don't own a Mac and did not publish them), so it tries to load the dll build for windows which doesn't work. For Mac you will need to install the development tools and build it yourself: "npx cmake-js compile"

@danhnd98 I suspect the issue with electron is similar, as above. Basically you are cross-compiling your app (e.g. for android) but the native dll (c++) is not cross compiled, so it cannot load it. You also need to make electron compile it (which I don't know how it's done, sorry)

@knopkem
Copy link
Owner

knopkem commented Oct 26, 2021

@anhhtbk
Copy link

anhhtbk commented Oct 26, 2021

@knopkem Thanks for your response. I did try npx cmake-js compile. But I don't know how to config cmake to build. Do you have any suggestions?

@knopkem
Copy link
Owner

knopkem commented Oct 26, 2021

You don't need to configure it, the project should be already set correctly. All you need is to have cmake installed and in PATH. Basically, cmake-js is a wrapper that needs to call it. Of course you then need to have a c++ compiler (clang on Mac ) installed for it to compile

@anhhtbk
Copy link

anhhtbk commented Oct 26, 2021

@knopkem I did some step:

  • run cmake-js rebuild -a arm64 => build success
  • copy file dcmtk.node in path dicom-dimse-native/build/Release/dcmtk.node to my node_modules in pathdicom-test/node_modules/dicom-dimse-native/build/Release/dcmtk.node
  • run nom start => error:
dlopen(node_modules/dicom-dimse-native/build/Release/dcmtk.node, 1): no suitable image found. Did find:
node_modules/dicom-dimse-native/build/Release/dcmtk.node: mach-o, but wrong architecture
node_modules/dicom-dimse-native/build/Release/dcmtk.node: mach-o, but wrong architecture

Did I wrong which step?

@knopkem
Copy link
Owner

knopkem commented Oct 26, 2021

this sounds right what you did. I would delete the build folder than rebuild than run the examples, e.g. run example:echoscu

@anhhtbk
Copy link

anhhtbk commented Oct 27, 2021

@knopkem I did it. It runs ok. But when I move it to my electron project, it has the same error above.

@knopkem
Copy link
Owner

knopkem commented Oct 28, 2021

@anhhtbk got my hands on a mac and added a prebuild. Can you try importing the module via npm in your project, it should now work out of the box. You can also try https://github.com/knopkem/dicomweb-proxy which uses it already. Let me know.

@knopkem knopkem closed this as completed Jan 10, 2022
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