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

Error building new project (neon-build) #186

Closed
squiidz opened this issue Feb 14, 2017 · 26 comments
Closed

Error building new project (neon-build) #186

squiidz opened this issue Feb 14, 2017 · 26 comments

Comments

@squiidz
Copy link

squiidz commented Feb 14, 2017

Hi, i just created a new neon project, but it doesn't seems to build ... Here's the log.

Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling nod v0.1.0 (file:///Users/jchaput/dev/rust/nod/native)
Compiling cslice v0.1.1
Compiling gcc v0.3.43
error[E0463]: can't find crate for `neon_build`
 --> build.rs:1:1
  |
1 | extern crate neon_build;
  | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

error: Could not compile `nod`.
Build failed, waiting for other jobs to finish...
error: build failed
neon ERR! cargo build failed
error Command failed with exit code 1.

thanks

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

I've just published a new version of neon that fixed a lot of build issues, although I'm still working out the kinks. Would you mind trying updating to neon-cli 0.1.12 and recreating the project and try again?

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

I just tried the new version with a new project and got this error:

error: failed to run custom build command for 'neon-runtime v0.1.12'
process didn't exit successfully: 
/Users/jchaput/dev/rust/nod/native/target/release/build/neon-runtime-ca6fef9d30530229/build-script-build (exit code: 101)
--- stdout
Skipping node-gyp installation as part of npm install.
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
running: "ar" "crs" "/Users/jchaput/dev/rust/nod/native/target/release/build/neon-runtime-46530539b89c1ebd/out/libneon.a" "build/Release/obj.target/neon/src/neon.o"
cargo:warning=ar: build/Release/obj.target/neon/src/neon.o: No such file or directory
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

Argh! OK I'm getting familiar with that error (but oh my heavens do I need to improve the errors). This seems to happen when the neon-runtime build script incorrectly finds the node-gyp script.

Can you show me the output of which node and ls $(which node) on your system?

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

which node: /usr/local/bin/node
ls: /usr/local/bin/node

thanks for the quick response btw

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

Does /usr/local/lib/node_modules/npm/node_modules/node-gyp exist on your system?

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

yep

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

OK, so I'm gonna need some more info than the error is giving you -- would you be willing to let me dictate some local hacks to get the build scripts to spew more info?

(Thank you so much for this help, btw -- you're helping me make this software actually, like, work. :P)

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

yeah no problem !

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

OK awesome! So first, clone this repo (neon, not neon-cli) somewhere on your system, and then hack neon/crates/neon-runtime/build.rs -- inside the build_object_file function, right after where it says let output = node_gyp().args(&configure_args).output().expect(...); add another few statements:

    println!("==================");
    println!("CONFIGURE:");
    println!("{}", String::from_utf8_lossy(&output.stderr));
    println!("==================");

Then inside neon/crates/neon-runtime, run cargo build and share the output here -- we'll see if that gives us some more insight.

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

error: failed to run custom build command for `neon-runtime v0.1.12 (file:///Users/jchaput/dev/rust/neon/crates/neon-runtime)`
process didn't exit successfully: `/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-bf06a6f3713ebbc7/build-script-build` (exit code: 101)
--- stdout
Skipping node-gyp installation as part of npm install.
/Users/jchaput/dev/rust/neon/crates/neon-runtime
├── [email protected]
└── [email protected]

==================
CONFIGURE:

==================
==================
CONFIGURE:

==================
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
running: "ar" "crs" "/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-ed514f00c83adf93/out/libneon.a" "build/Debug/obj.target/neon/src/neon.o"
cargo:warning=ar: build/Debug/obj.target/neon/src/neon.o: No such file or directory
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

sorry bad output ...

process didn't exit successfully: `/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-bf06a6f3713ebbc7/build-script-build` (exit code: 101)
--- stdout
Skipping node-gyp installation as part of npm install.
==================
CONFIGURE:
module.js:472
    throw err;
    ^

Error: Cannot find module '/usr/local/Cellar/node/7.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3

==================
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
running: "ar" "crs" "/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-ed514f00c83adf93/out/libneon.a" "build/Debug/obj.target/neon/src/neon.o"
cargo:warning=ar: build/Debug/obj.target/neon/src/neon.o: No such file or directory
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

OK, so that's not where it's going wrong. Let's try the next node-gyp command: at the end of build_object_file, where it says node_gyp().stderr(Stdio::null()).args(&build_args).status().ok().expect(...), change it to:

    let output = node_gyp()
        .args(&build_args)
        .output()
        .expect("Failed to run \"node-gyp build\" for neon-runtime!");
    println!("--------------------");
    println!("BUILD:");
    println!("{}", String::from_utf8_lossy(&output.stderr));
    println!("--------------------");

And then run cargo build in the neon-runtime directory again.

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

error: failed to run custom build command for `neon-runtime v0.1.12 (file:///Users/jchaput/dev/rust/neon/crates/neon-runtime)`
process didn't exit successfully: `/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-bf06a6f3713ebbc7/build-script-build` (exit code: 101)
--- stdout
Skipping node-gyp installation as part of npm install.
--------------------
BUILD:
module.js:472
    throw err;
    ^

Error: Cannot find module '/usr/local/Cellar/node/7.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3

--------------------
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
running: "ar" "crs" "/Users/jchaput/dev/rust/neon/crates/neon-runtime/target/debug/build/neon-runtime-ed514f00c83adf93/out/libneon.a" "build/Debug/obj.target/neon/src/neon.o"
cargo:warning=ar: build/Debug/obj.target/neon/src/neon.o: No such file or directory
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

We're getting warmer... What does ls /usr/local/Cellar/node/7.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js do?

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

ls: /usr/local/Cellar/node/7.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: No such file or directory

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

How about ls -l $(which node) ?

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

lrwxr-xr-x 1 jchaput admin 29 8 Feb 08:50 /usr/local/bin/node -> ../Cellar/node/7.5.0/bin/node

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

A few more -- we're making progress :)

ls -l /usr/local/Cellar/node/7.5.0/lib
ls -l /usr/local/lib/node_modules

(There's something about your node installation setup that is tripping the build script up. It seems like it might have to do with how some symlinks are organized.)

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

Actually since it looks like you have a standard homebrew installation of node, maybe I can just test that on my system. I'm using node via nvm instead of homebrew, so that's probably the root cause.

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

drwxr-xr-x 3 jchaput admin 102 31 Jan 17:19 dtrace

drwxr-xr-x  19 jchaput  admin  646 11 Feb 15:12 angular-cli
drwxr-xr-x   9 jchaput  admin  306 18 Dec 14:26 express
drwxr-xr-x   3 jchaput  admin  102 18 Dec 14:25 express-cli
drwxr-xr-x  14 jchaput  admin  476 17 Feb 13:03 neon-cli
drwxr-xr-x  27 jchaput  admin  918  8 Feb 08:50 npm
drwxr-xr-x   9 jchaput  admin  306  4 Dec 16:31 oni-plugin-typescript
drwxr-xr-x  21 jchaput  admin  714  4 Dec 16:30 oni-vim

@squiidz
Copy link
Author

squiidz commented Feb 17, 2017

let me know if it's work on your side with homebrew

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

OK I think that tells me enough -- I'll try it on my system! Thanks again…

@dherman
Copy link
Collaborator

dherman commented Feb 17, 2017

OK it looks like homebrew installs node-gyp in yet another subdirectory. Now I know of different directory structures for Windows node, unix node, nvm node, and homebrew node. O_o

This does not seem like a sustainable approach to finding and invoking node-gyp!

In my head I keep flirting with the idea of just putting the node-gyp npm package as a local dependency. The main reason I was reluctant turns out to be wrong: I thought we'd have to install different versions of node-gyp depending on which version of node the client is using, but I see that node-gyp can be used across multiple node versions, so that's not an issue.

So the only real concern then is just that it'll add another 5 or 6 seconds of build time for neon-runtime (for npm to install the node-gyp dependency). I think that's probably preferable to constantly fighting with brittle differences in directory layout across different installation flavors of node.

dherman pushed a commit that referenced this issue Feb 18, 2017
- Windows node
- macOS node with nvm
- macOS node with homebrew
- macOS node with a vanilla install
- Linux node
In other words, all 5 of the 3 OSes node runs on. :P
@dherman
Copy link
Collaborator

dherman commented Feb 18, 2017

@squiidz #189 should fix this -- it works in homebrew on my machine. I think it's just a more robust approach. It does bump the Rust version requirement up to 1.15, but I think that's OK.

@squiidz
Copy link
Author

squiidz commented Feb 19, 2017

Great, I will try it this weekend ! To me 5s more to build is not a issue. Good job :)

@squiidz
Copy link
Author

squiidz commented Feb 19, 2017

Works fine on my system ! 👍

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