Skip to content

1.7.0 compilation seemingly broken #517

Closed

Description

My native addons CIs started failing after the 1.7.0 release. It looks like even the hello world project is broken with 1.7.0.

I get errors like:

> node-gyp rebuild

make: Entering directory '/home/tsviatko/work/node-addon-examples/1_hello_world/node-addon-api/build'
  CXX(target) Release/obj.target/hello/hello.o
In file included from ../hello.cc:1:0:
/home/tsviatko/work/node-addon-examples/1_hello_world/node-addon-api/node_modules/node-addon-api/napi.h:1960:49: error: expected ‘)’ before ‘tsFunctionValue’
     ThreadSafeFunction(napi_threadsafe_function tsFunctionValue);
                                                 ^~~~~~~~~~~~~~~
/home/tsviatko/work/node-addon-examples/1_hello_world/node-addon-api/node_modules/node-addon-api/napi.h:2023:25: error: ‘napi_threadsafe_function_call_mode’ has not been declared
                         napi_threadsafe_function_call_mode mode) const;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tsviatko/work/node-addon-examples/1_hello_world/node-addon-api/node_modules/node-addon-api/napi.h:2030:21: error: ‘napi_threadsafe_function’ was not declared in this scope
     std::unique_ptr<napi_threadsafe_function> _tsfn;
                     ^~~~~~~~~~~~~~~~~~~~~~~~```
when building it.

Activity

  1. NickNaso commented on Jul 23, 2019

    @NickNaso
    Member

    Hi @codemerx,
    which is the Node.js version that give you the problem?

  2. iamstolis commented on Jul 23, 2019

    @iamstolis

    I have the same issue with Node.js version 10.5.2 when I run npm install --build-from-source microtime. It used to work before release 1.7.0 of node-addon-api.

  3. tirumala-01 commented on Jul 23, 2019

    @tirumala-01

    I see the same issue with node version 8.10.0 as well.

  4. drunewin commented on Jul 23, 2019

    @drunewin

    1.7.0 seems like it may include breaking changes?

    It breaks the build for this dependent module: ranisalt/node-argon2#192

  5. drunewin commented on Jul 23, 2019

    @drunewin

    Anyone have a workaround? This a dependency of a dependency for my project and it is blocking some build pipelines.

  6. NickNaso commented on Jul 23, 2019

    @NickNaso
    Member

    Hi everyone,
    I think that I've found the problem. The thread_safe_function is considered stable starting from N-API version 4 and in all the LTS 12.6.0 , 10.16.0 and 8.16.0 it compile well. So what we need is to add a control on the version of N-API if the version is greater than 3 we can enable the Napi::ThreadSafeFunction .
    @mhdawson @gabrielschulhof @nodejs/n-api Could someone confirm this and take a look at this PR #518 ?

  7. NickNaso commented on Jul 23, 2019

    @NickNaso
    Member

    @codemerx Thanks for your feedback.

  8. NickNaso commented on Jul 23, 2019

    @NickNaso
    Member

    Hi everyone,
    we prepared a patch. Now we are testing on CI and then we will make a new release. Sorry for the inconvenience and thank you for your quickly feedback.

  9. NickNaso commented on Jul 23, 2019

    @NickNaso
    Member

    Hi everyone we just published the version 1.7.1 that should solve the problem. I'm closing the issue feel free to reopen in case you will experiment the same problem.

  10. pome90 commented on Aug 5, 2019

    @pome90

    hi everyone,
    I'm not able to use Napi::ThreadSafeFunction.
    I'm using cmake-js and the compilation gives me this output: no type named 'ThreadSafeFunction' in namespace 'Napi'

    This is my environment configuration:

    • Nodejs: 12.6.0
    • N-API: 4
    • node-addon-api: 1.7.1
  11. mhdawson commented on Aug 14, 2019

    @mhdawson
    Member

    @pome90 if this is still an issue please open a new issue as this one is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions