-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add support to node 12.x and Gazebo 11 #205
Conversation
thanks for the pull request! This works for me when building with node v12 + gazebo9. My only question is if we could |
Hi @iche033! I have done some research in order to find the best way to achieve multi-version support (I am not an expert on writing node C++ addons 😝 ) and the cleanest way to do that seems to use the native abstractions for nodejs. From the project's README
A small refactor across the file will be necessary, but the code will be easier to maintain along node updates. What do you think @iche033 ? If you send a thumbs up, I may update the PR with these refactor, otherwise I may add |
Thanks very much to both. d58203c however, building v12.20.0 against Gazebo11/Foxy/Focal does not work. Any clues? `
internal/modules/cjs/loader.js:818 Error: Cannot find module './build/Debug/gzbridge'
npm ERR! A complete log of this run can be found in: |
@newcanopies, it seems that the error is happening when you build the project, may you you post the output of I would be happy to help, but I would ask you to post this within an issue (like #204), as troubleshooting is not the main purpose of a pull request |
This is a pure cosmetical change. From the docs, "Handle is an alias for Local for historical reasons" https://v8docs.nodesource.com/node-10.15/d4/da0/v8_8h_source.html#l00428
Several API calls from V8 were deprecated in version 7.0 (that ships w/ node 12), this commit replaces then Refs: nodejs/node#23122 nodejs/node#23159 bcoin-org/bcrypto#7
Sdf format version 9.0 requires c++17 to be compiled gazebosim/sdformat#251
e907a39
to
9b8de9b
Compare
fa8dd3c
to
4d1d63e
Compare
thanks for looking into this. This also led me down to some light reading on the different abstractions for nodejs. So there is I'm fine with either of these options. I'm not sure how much effort it'll take but if you're up for the task, I'm happy to review the changes and get it into gzweb! |
The NAN_METHOD macro defines the argument as "info" instead of "args" https://github.com/nodejs/nan/blob/v2.14.2/nan.h#L1567-L1568
Since both options solve our problem, compatibility with older versions of node is a desirable feature and the work needed to migrate to As stated in this StackOverflow answer
This article from MongoDB developers illustrates the work needed to migrate from That said, the code structure remains the same, but several method calls were replaced by its I was able to run with node v8.17.0, v10.23.2, v12.20.1 and v14.15.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Let's go with nan
I tested with node v8, 10, and 12 with gazebo9 on Bionic and they all work fine!
Awesome. I was struggling to have a custom gzweb compiled for Gazebo 11 until I found this PR. |
Hello everyone,
From v8 version 6.0 (shipped w/ node 10) to v8 7.0 (shipped w/ node 12), there was a major change in API methods that prevented the project to run with node 12. Unfortunately, these changes break compatibility with node 8.x and 10.x as well, maybe it is interesting to release a major version of gzweb.
This PR addresses this problem and changes the calls to v8 API following the new syntax. No logic or functional changes were made.
Another change is the update to Gazebo version 11. It was necessary to pass the flag
-std=c++17
in order tho compile the dependency sdf format version 9.0Thank you everyone! =)
Useful references:
v8/node deprecated APIs and how to handle them bcoin-org/bcrypto#7
APIs removed in V8 7.0 and native addons nodejs/node#23122
[v10.x] deps: increase V8 deprecation levels nodejs/node#23159
Properly handle the requirement of C++17 at the CMake exported target level gazebosim/sdformat#251
Closes #204
Closes #203
Closes #174