Neon: error: Neon only builds with --release. For tests, try `cargo test --release`.

Created on 15 Sep 2018  路  9Comments  路  Source: neon-bindings/neon

environment

  • windows 10 pro 1083 OS build 17134.191
  • system type 64-bit OS, x64-based processor
  • rustc 1.29.0 (aa3ca1994 2018-09-11)
  • cargo 1.29.0 (524a578d7 2018-08-05)
  • node v8.11.3
  • npm 6.4.1
  • yarn v1.9.4
  • msvs_version 2015
  • python 2.7.14
  • neon 0.2.0

step

  • npm install --global --production windows-build-tools
  • npm install --global neon-cli
  • neon new threading-hint
  • cd threading-hint
  • yarn

error message

yarn install v1.9.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
$ neon build
[##############################################################------------------------------------------------] 96/171neon info forcing rebuild for new build settings
neon info running cargo
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling version_check v0.1.4
   Compiling libc v0.2.43
   Compiling regex v0.2.11
   Compiling ucd-util v0.1.1
   Compiling utf8-ranges v1.0.1
   Compiling gcc v0.3.54
   Compiling neon-build v0.2.0
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling memchr v2.0.2
   Compiling regex-syntax v0.5.6
   Compiling lazy_static v1.1.0
   Compiling neon v0.2.0
   Compiling threading-hint v0.1.0 (file:///E:/proj/threading-hint/native)
   Compiling aho-corasick v0.6.8
   Compiling semver v0.9.0
   Compiling thread_local v0.3.6
   Compiling neon-runtime v0.2.0
error: Neon only builds with --release. For tests, try `cargo test --release`.
   --> C:\Users\USER\.cargo\registry\src\github.com-1ecc6299db9ec823\neon-0.2.0\src\lib.rs:288:1
    |
288 | compile_error!("Neon only builds with --release. For tests, try `cargo test --release`.");
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `neon`.

To learn more, run the command again with --verbose.
neon ERR! cargo build failed

Error: cargo build failed
    at Target.<anonymous> (E:\proj\threading-hint\node_modules\neon-cli\lib\target.js:121:35)
    at step (E:\proj\threading-hint\node_modules\neon-cli\lib\target.js:32:23)
    at Object.next (E:\proj\threading-hint\node_modules\neon-cli\lib\target.js:13:53)
    at fulfilled (E:\proj\threading-hint\node_modules\neon-cli\lib\target.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

additional step

  • cd native
  • cargo test --release

result ok

   Compiling version_check v0.1.4
   Compiling libc v0.2.43
   Compiling ucd-util v0.1.1
   Compiling regex v0.2.11
   Compiling utf8-ranges v1.0.1
   Compiling gcc v0.3.54
   Compiling neon-build v0.2.0
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling memchr v2.0.2
   Compiling regex-syntax v0.5.6
   Compiling lazy_static v1.1.0
   Compiling neon v0.2.0
   Compiling threading-hint v0.1.0 (file:///E:/proj/threading-hint/native)
   Compiling aho-corasick v0.6.8
   Compiling semver v0.9.0
   Compiling thread_local v0.3.6
   Compiling neon-runtime v0.2.0
    Finished release [optimized] target(s) in 1m 04s
     Running target\release\deps\threading_hint-b2f5de0c8ba20141.exe

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Do i missed some step or configuration?

Most helpful comment

@jhg Good news! The fix for this was just merged and will be in the next release.

https://github.com/neon-bindings/neon/pull/506

All 9 comments

Same here, just run it with the release flag, no ? like neon build --release

Similar, but little different here.

My Environments

% neon version
0.2.0
% node -v
v11.2.0
% npm -v
6.4.1
% rustup show
Default host: x86_64-apple-darwin

stable-x86_64-apple-darwin (default)
rustc 1.30.1 (1433507eb 2018-11-07)

Build and run itself is ok.

% neon new my-project
...
% cd my-project
% neon build
neon info forcing rebuild for new build settings
neon info running cargo
    Updating crates.io index
   Compiling version_check v0.1.5
   Compiling cfg-if v0.1.6
   Compiling libc v0.2.43
   Compiling ucd-util v0.1.3
   Compiling regex v0.2.11
   Compiling lazy_static v1.2.0
   Compiling utf8-ranges v1.0.2
   Compiling gcc v0.3.55
   Compiling neon-build v0.2.0
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling regex-syntax v0.5.6
   Compiling memchr v2.1.1
   Compiling thread_local v0.3.6
   Compiling neon v0.2.0
   Compiling my-project v0.1.0 (/Users/dialogbox/works/rust/my-project/native)
   Compiling semver v0.9.0
   Compiling aho-corasick v0.6.9
   Compiling neon-runtime v0.2.0
    Finished dev [unoptimized + debuginfo] target(s) in 16.84s
neon info generating native/index.node
% node -e 'require("./")'
hello node

But, cargo test fails.

% cd native
% cargo test
   Compiling my-project v0.1.0 (/Users/dialogbox/works/rust/my-project/native)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.14epkf1b9s0eu4lx.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.14mgytbfuj2h4z0v.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.1gxpkm8fdjdavua5.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.1wor61c1ey36etk8.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.23e8pyazmgu3e389.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.2b4x87fd6kqn94bu.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.2eyi022e5k1uw0gc.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.2m2teyp6596owcoh.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.2o29w6mw6r2zavyp.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.2qgcxusy3crbrtot.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.3015gbbydlzlhstk.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.3mxkp2jzsftrlj3n.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.3qtj9hj1ouu2pga3.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.3ucmrxxiet7mg5nj.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.466d9pval0vf9hvs.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4arr4zizqwsnr22p.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4cw8aeyq1ax1acuc.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4dxv5hg4hxe9arxs.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4oe4w2qhku5wzzny.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4ot4ygm7vwx4i2ry.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4q5kyru7gzu0bdp6.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.4qaviprejw6vfdt6.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.553dzu3pgi8bk4vh.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.556uoze9yki50qvz.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.7gems98o2bpvo0a.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.f6v5kbadjn7e56z.rcgu.o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.seaa2imba682v2m.rcgu.o" "-o" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/my_project-07ec78272dd7cf7e.1ml3bdzfsnw6ouub.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps" "-L" "/Users/dialogbox/works/rust/my-project/native/target/debug/build/neon-runtime-8bc2027f8ac5020b/out" "-L" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-c2b92ef38bc65339.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libterm-6349508393622615.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-f1e85f00c34fa59c.rlib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/libneon-a8c3ebd2089333f8.rlib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/libsemver-c9201ffb83659839.rlib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/libsemver_parser-a914c88bd9416303.rlib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/libcslice-07c1a1164871e0f1.rlib" "/Users/dialogbox/works/rust/my-project/native/target/debug/deps/libneon_runtime-6f2797e2fc93d4a1.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-a5984f6fc2a4870f.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-7c9487d161f01b59.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-e146b9b98ab73364.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-acb39784a181deae.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-89f97a4bae8c89d2.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-cd336d4bb1fade3c.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-d6545438808205eb.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-8aa8397108285683.rlib" "/Users/dialogbox/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-83c21e81fef8188c.rlib" "-lSystem" "-lresolv" "-lpthread" "-lc" "-lm"
  = note: Undefined symbols for architecture x86_64:
            "v8::V8::ToLocalEmpty()", referenced from:
                v8::MaybeLocal<v8::String>::ToLocalChecked() in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Isolate::ThrowException(v8::Local<v8::Value>)", referenced from:
                Nan::ThrowError(v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::ThrowError(char const*) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::HandleScope::~HandleScope()", referenced from:
                Nan::Set(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_Scope_Exit in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::HandleScope::~HandleScope() in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::External::Value() const", referenced from:
                _Neon_Fun_GetDynamicCallback in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Function::New(v8::Local<v8::Context>, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, int, v8::ConstructorBehavior, v8::SideEffectType)", referenced from:
                _Neon_Fun_New in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Isolate::GetCurrentContext()", referenced from:
                Nan::Set(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_Fun_New in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Exception::Error(v8::Local<v8::String>)", referenced from:
                _Neon_Error_ThrowErrorFromUtf8 in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::ThrowError(char const*) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)", referenced from:
                Nan::Set(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::Isolate::GetCurrent()", referenced from:
                _Neon_Call_CurrentIsolate in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Neon_ASCII_Key(v8::Local<v8::String>*, unsigned char const*, int) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::Set(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::ThrowError(v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_Error_ThrowErrorFromUtf8 in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::ThrowError(char const*) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::HandleScope::HandleScope() in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                ...
            "v8::External::New(v8::Isolate*, void*)", referenced from:
                _Neon_Fun_New in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::HandleScope::HandleScope(v8::Isolate*)", referenced from:
                Nan::Set(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_Scope_Enter in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::HandleScope::HandleScope() in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)", referenced from:
                Neon_ASCII_Key(v8::Local<v8::String>*, unsigned char const*, int) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_String_New in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                _Neon_Error_ThrowErrorFromUtf8 in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
                Nan::imp::Factory<v8::String>::New(char const*, int) in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "v8::V8::FromJustIsNothing()", referenced from:
                v8::Maybe<bool>::FromJust() const in libneon_runtime-6f2797e2fc93d4a1.rlib(neon.o)
            "_node_module_register", referenced from:
                my_project::__LOAD_NEON_MODULE::__load_neon_module::h21032fe34cbef846 in my_project-07ec78272dd7cf7e.f6v5kbadjn7e56z.rcgu.o
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

error: Could not compile `my-project`.

To learn more, run the command again with --verbose.

cargo test --release works.

% cargo test --release
   Compiling version_check v0.1.5
   Compiling cfg-if v0.1.6
   Compiling libc v0.2.43
   Compiling lazy_static v1.2.0
   Compiling ucd-util v0.1.3
   Compiling regex v0.2.11
   Compiling utf8-ranges v1.0.2
   Compiling gcc v0.3.55
   Compiling neon-build v0.2.0
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling thread_local v0.3.6
   Compiling regex-syntax v0.5.6
   Compiling memchr v2.1.1
   Compiling neon v0.2.0
   Compiling my-project v0.1.0 (/Users/dialogbox/works/rust/my-project/native)
   Compiling semver v0.9.0
   Compiling aho-corasick v0.6.9
   Compiling neon-runtime v0.2.0
    Finished release [optimized] target(s) in 21.26s
     Running target/release/deps/my_project-cd47d2683dbb12d3

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Having same issue, only on Windows.
Repro: https://github.com/qm3ster/rust-prebuild-test
On Ubuntu 18.20, pnpm i compiles correctly.
On Windows 10, in both git-bash and Powershell pnpm i fails with this error, requiring pnpm run install -- --release.

I believe that this was fixed by https://github.com/neon-bindings/neon/pull/392. Please re-open if you continue to experience this issue.

Hi,
I found same bug also in Windows with latest version (0.3.3):

$ neon build
neon info forcing rebuild for new build settings
neon info running cargo
   Compiling cfg-if v0.1.10
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling neon-sys v0.3.3
   Compiling neon v0.3.3
   Compiling norustde v0.1.0 (C:\Users\jesus\Documents\Repos\example-nodejs-addon-rust-auto-version\native)
   Compiling semver v0.9.0
   Compiling neon-runtime v0.3.3
error: Neon only builds with --release. For tests, try `cargo test --release`.
   --> ...\neon-0.3.3\src\lib.rs:342:1
    |
342 | compile_error!("Neon only builds with --release. For tests, try `cargo test --release`.");
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `neon`.

It's possible to do same change as https://github.com/neon-bindings/neon/pull/400/commits/641cc653122874d85149f4f0213becbcb29c3293#diff-b4aea3e418ccdb71239b96952d9cddb6L291 but in neon-0.3.3/src/lib.rs:342 and then it works but I'm not sure if it needs additional changes like in https://github.com/neon-bindings/neon/pull/400/commits/641cc653122874d85149f4f0213becbcb29c3293#diff-9251e31e005db722ff0eb972d2fc596dR122 because I don't use to develop neon itself. It was added in commit https://github.com/neon-bindings/neon/commit/2b28a282bece25b2b6db21f18ead60a310179ff2 and I don't know if it require fix something before to remove that compile error, I tried to remove it locally and it works for me.

@kjvalencik I'm not sure about re-open this or create new issue.

@jhg Only building in release mode for Windows is intentional. Unfortunately, I'm not a Windows developer and not exactly sure why. Any insight would be appreciated!

I see. Thanks to explain @kjvalencik. Even I'm not developing only for Windows, in the end developers in the team are free to use it if the want and projects where I'm adding Neon will be tested also in Windows, for QA.

If it's for not to worry about support other than release mode in Windows, maybe could show a warning but not avoid to run. Then, one run tests under own risk that could not be as well supported as Linux/BSD/Mac and knowing release mode is well supported.

@jhg Good news! The fix for this was just merged and will be in the next release.

https://github.com/neon-bindings/neon/pull/506

Hi, I am having this problem on apline linux. Running cargo test fails with linking errors (see attachement) while running cargo test --release works as expected.

Versions:

  • alpine: 3.11.6
  • rust: 1.48.0
  • neon: 0.6.0
  • node: 12.20.0
  • npm: 6.14.8

linking-issue-neon0.6.0-cargo-test.txt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manuel2258 picture manuel2258  路  5Comments

ghost picture ghost  路  4Comments

cookiengineer picture cookiengineer  路  3Comments

crazyfrozenpenguin picture crazyfrozenpenguin  路  3Comments

chpio picture chpio  路  6Comments