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

Build failure with Node v6.12.1 on CentOS 7 #206

Closed
michaelfig opened this issue Dec 28, 2017 · 7 comments
Closed

Build failure with Node v6.12.1 on CentOS 7 #206

michaelfig opened this issue Dec 28, 2017 · 7 comments

Comments

@michaelfig
Copy link

First, thanks for node-addon-api: it allowed me to port old code to v8.9.1.

I'm trying to backport my module to v6.12.1, and I'm getting compile errors after following the steps in the Setup guide (and having it work perfectly under Node v8.9.1).

They all seem related to async_context not existing in v6.

Your help is appreciated,
Michael.
compile-errors.txt

@michaelfig
Copy link
Author

BTW, I used [email protected] for both compiles.

@NickNaso
Copy link
Member

NickNaso commented Jan 3, 2018

Hi @michaelfig,
If I understood you had problem with version 1.1.0 of node-addon-api while with 1.0.0 all worked well for you.
About that I'm curios so if your addon is a public addon please post the link at your code. I want try to take a look.
Nick

@mhdawson
Copy link
Member

mhdawson commented Jan 3, 2018

I can see that we define some of the functions reported as missing in https://github.com/nodejs/node-addon-api/blob/master/src/node_internals.h.

For example:

#if NODE_MAJOR_VERSION < 8 || NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION < 6
typedef int async_id;

typedef struct async_context {
  node::async_id async_id;
  node::async_id trigger_async_id;
} async_context;

NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate,
                                        v8::Local<v8::Object> resource,
                                        v8::Local<v8::String> name,
                                        async_id trigger_async_id = -1);

NODE_EXTERN void EmitAsyncDestroy(v8::Isolate* isolate,
                                  async_context asyncContext);

v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
                                       v8::Local<v8::Object> recv,
                                       v8::Local<v8::Function> callback,
                                       int argc,
                                       v8::Local<v8::Value>* argv,
                                       async_context asyncContext);

#if NODE_MAJOR_VERSION < 8
class AsyncResource {
  public:
    AsyncResource(v8::Isolate* isolate,
                  v8::Local<v8::Object> object,
                  const char *name);
};
#endif // node version below 8

#endif // node version below 8.6

My guess is that possibly the issue is related to paths, with somehow the files from the node runtime being used instead of those provided as part of node-addon-api.

Can you provide some more info on anything special about your build setup ?

@gabrielschulhof adding you as an FYI as you did much of the work to support the older release and I wonder if you have run into some combination in the past that shows these symptoms.

@michaelfig
Copy link
Author

Ah, thanks!

The installation and usage guide says to reference "1.0.0" in the package.json, but when I changed it to "^1.0.0" and npm update node-addon-api, I got 1.1.0 which adds the necessary support to v6.

Node-gyp has problems with v0.10 due to c++ flags, but at least 6.x works!

@NickNaso
Copy link
Member

NickNaso commented Jan 4, 2018

@mhdawson We need to change the reference in the installation and usage documentation.
@michaelfig Maybe I'm not really sure but I could works even if with Node.js 4.x

@michaelfig
Copy link
Author

I've tested it successfully for node v4.8.7 as well.

Thanks.

mhdawson pushed a commit that referenced this issue Jan 5, 2018
Changed version of node-addon-api on the package.json example see:
[issue 206](#206 (comment))

PR-URL: #208
Reviewed-By: Michael Dawson <[email protected]>
@mhdawson
Copy link
Member

mhdawson commented Jan 5, 2018

Sounds like we can close this. If not please let me know and I'll re-open.

@mhdawson mhdawson closed this as completed Jan 5, 2018
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this issue Aug 24, 2022
Changed version of node-addon-api on the package.json example see:
[issue 206](nodejs/node-addon-api#206 (comment))

PR-URL: nodejs/node-addon-api#208
Reviewed-By: Michael Dawson <[email protected]>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this issue Aug 26, 2022
Changed version of node-addon-api on the package.json example see:
[issue 206](nodejs/node-addon-api#206 (comment))

PR-URL: nodejs/node-addon-api#208
Reviewed-By: Michael Dawson <[email protected]>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this issue Sep 19, 2022
Changed version of node-addon-api on the package.json example see:
[issue 206](nodejs/node-addon-api#206 (comment))

PR-URL: nodejs/node-addon-api#208
Reviewed-By: Michael Dawson <[email protected]>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this issue Aug 11, 2023
Changed version of node-addon-api on the package.json example see:
[issue 206](nodejs/node-addon-api#206 (comment))

PR-URL: nodejs/node-addon-api#208
Reviewed-By: Michael Dawson <[email protected]>
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