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

N-API callback exception when running above Rosetta #93

Open
RichardFoss opened this issue May 26, 2024 · 12 comments
Open

N-API callback exception when running above Rosetta #93

RichardFoss opened this issue May 26, 2024 · 12 comments

Comments

@RichardFoss
Copy link

Thanks for your great package!
I am trying to create an app deliverable for an Apple x64 architecture when running on an Apple arm64 architecture. I am using JZZ to send transport command to a DAW, and also to receive MTC messages from the DAW.
I am developing in VSCode, and have ensured that VSCode, its terminal, and node.js are running above the simulated x64 (Rosetta) architecture using arch and node -p "process.arch" commands. I am using JZZ commands to open input and output ports, to send messages, and I have used .connect to ensure the handling of MTC messages.
My app runs, and transport commands I send are successfully received by the DAW. However, the receipt of MTC messages results in a succession of the following message:
(node:41451) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly.
Any idea of how to prevent this callback exception and to pick up the MTC messages?

@jazz-soft
Copy link
Owner

Hi! Thanks for asking!
Are you writing a VScode extension? In this case, you can try https://github.com/jazz-soft/jazz-midi-vscode
Sorry, I'm not familiar with Rosetta...

@RichardFoss
Copy link
Author

Hi, thanks for your response! No, I'm not writing a VSCode extension. I have created an immersive sound client/server program in javascript ( www.immersivedsp.com ). I was hoping to create the Intel Mac updates on my Mac silicon machine, rather than going to a separate Intel Mac. I have got closer to achieving this with JZZ than with other MIDI npm packages, but am just battling with the handling of incoming MTC messages.

@jazz-soft
Copy link
Owner

I wonder if it helps if you rebuild https://github.com/jazz-soft/jazz-midi (see the node-gyp section) on your system...
I believe the problem must be in that module.

@RichardFoss
Copy link
Author

Thanks for following up with further help!

I cloned the jazz-midi folder into a folder in my project, changed to that folder, did an "npm install", and then a "node-gyp rebuild". I got an error indicating no binding file. I saw that there was a binding file in the node-gyp sub-folder, so changed to that and did an "npm install". I got the following error message:

"gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/jazz/jazz-midi.o
../jazz-midi.cpp:515:9: error: no matching function for call to 'napi_wrap'
XX (napi_wrap(env, self, Plg, destroy, 0, 0));"

I also tried to do a "node-gyp rebuild" here, but again got a similar error message:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/jazz/jazz-midi.o
../jazz-midi.cpp:515:9: error: no matching function for call to 'napi_wrap'
XX (napi_wrap(env, self, Plg, destroy, 0, 0));

There does seem to be a problem with the 'napi_wrap' function? Any ideas about the way forward would be much appreciated!

@jazz-soft
Copy link
Owner

Ok, this is something... I'll try to track it from there...

@RichardFoss
Copy link
Author

Thanks!

@jazz-soft
Copy link
Owner

Please check out the latest version and see if it compiles...

@RichardFoss
Copy link
Author

Thank you very much, it compiles!:

"2 warnings generated.
SOLINK_MODULE(target) Release/jazz.node
gyp info ok "

I tried copying Release/jazz.node into node_modules/jazz-midi/bin/macos64

As before, I could send MIDI transport commands to a DAW, but the returning MTC caused the same error - "-force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly.
(node:80262) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly."

Is there possibly something else I should be doing with the release build?

@jazz-soft
Copy link
Owner

should it be called from bin/macos64 or bin/macosa64 ?

@RichardFoss
Copy link
Author

Ah, I assumed that it would be bin/macos64. I thought that the 'a' referred to 'arm'. When I place Release/jazz.node into node_modules/jazz-midi/bin/macosa64, the enumeration of MIDI ports doesn't happen, for example this command "midiOutPorts = JZZ().info().outputs;" returns an empty array. So it looks as if jazz.node is indeed called via bin/macosa64, but that my release build doesn't work. It's a bit late where I am now. I will have a further look at this tomorrow. Thanks again for your help.

@jazz-soft
Copy link
Owner

Could you please give more details about the versions of your OS, node and npm?

@RichardFoss
Copy link
Author

macOS is 12.6.3, node is 18.20.3, npm is 10.7.0. I will be updating these all this week, and will have another try. Thanks for your continued support!

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

2 participants