Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Windows 10 build error xray_electron\node_modules\napi\Cargo.toml can't be found #23

Closed
Ben3eeE opened this issue Mar 6, 2018 · 13 comments

Comments

@Ben3eeE
Copy link

Ben3eeE commented Mar 6, 2018

Following the instructions in the contribution guide:

  1. Install Node 8.9.3
  2. Install Rust
  3. git clone this repository
  4. cd into xray_electron
  5. run npm install

npm install exits saying that I:\xray\xray\xray_electron\node_modules\napi\Cargo.toml does not exist.
I've checked inside that folder and it does not exist.

No rush for me to get anything up and running just mostly curious 🙂

Versions

I:\xray\xray\xray_electron>node --version
v8.9.3
I:\xray\xray\xray_electron>rustc --version
rustc 1.24.1 (d3ae9a9e0 2018-02-27)
Full output
I:\xray\xray\xray_electron>npm install

> xray@0.0.1 install I:\xray\xray\xray_electron\node_modules\xray
> npm run build-release


> xray@0.0.1 build-release I:\xray\xray\xray_electron\node_modules\xray
> napi build --release

error: failed to load source for a dependency on `napi`

Caused by:
  Unable to update file:///I:/xray/xray/xray_electron/node_modules/napi

Caused by:
  failed to read `I:\xray\xray\xray_electron\node_modules\napi\Cargo.toml`

Caused by:
  The system cannot find the path specified. (os error 3)
child_process.js:644
    throw err;
    ^

Error: Command failed: cargo rustc --release -- -Clink-args="-undefined dynamic_lookup -export_dynamic"
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at Object.<anonymous> (I:\xray\xray\napi\scripts\napi.js:31:8)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xray@0.0.1 build-release: `napi build --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xray@0.0.1 build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bene\AppData\Roaming\npm-cache\_logs\2018-03-06T22_08_16_150Z-debug.log
npm WARN Xray@0.1.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xray@0.0.1 install: `npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xray@0.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bene\AppData\Roaming\npm-cache\_logs\2018-03-06T22_08_16_320Z-debug.log
@arpit1997
Copy link

arpit1997 commented Mar 7, 2018

I was getting the same error on my linux machine, I installed cargo and it solved the problem. Try installing and see if it works. @Ben3eeE

@Ben3eeE
Copy link
Author

Ben3eeE commented Mar 7, 2018

Hey, thanks for the tip 🙇 I do have cargo installed though:

I:\xray\xray\xray_electron> cargo --version
cargo 0.25.0 (96d8071da 2018-02-26)

Is there some step I need to perform with cargo to get it to build?

@arpit1997
Copy link

check out #27 cargo and clang solved the above problem but getting new error

@itsnotvalid
Copy link

Looks like the napi script wasn't run the correct working directory. For my installation on win 10, there is only xray (symlinked) in node_modues, and there is some Cargo.toml files in those places. However, the error message points to .\xray\xray_electron\node_modules\napi\, which the folder itself isn't there.

@Ben3eeE
Copy link
Author

Ben3eeE commented Mar 9, 2018

Yeah. I think it's supposed to be .\xray\napi and not .\xray\xray_electron\node_modules\napi. I think this is because xray\xray_electron\node_modules\xray\Cargo.toml has ../napi as a dependency because it's symlinked from xray\xray_node.

Two other things I found:

  • clang/llvm is required and should probably be added to the contributing guide
  • The node include path is not going to be correct on Windows:

https://github.com/atom/xray/blob/8c67a8e887ccd3793e5c075644d91d0fe313e816/napi/scripts/napi.js#L22-L25

This is C:\Program Files\include\node? The node headers are not in that folder and I am not even sure if they are installed on Windows by default. At least when using the installer. So maybe this also needs to be documented. I haven't had time to check and see if I was able to build something correctly with clang/llvm and the node include path setup.

A lot of maybe and uncertainty from me because I haven't had time to dig into it. But hopefully this helps 🙂

@itsnotvalid
Copy link

Further down the road, the Cargo.toml defined the dependencies relative to the original location of the package, not the symbolic-linked one (../napi etc.). This caused cargo to complain not finding the deps.

So my workaround for now is, go to xray\xray_node, and you would notice that node_modules has been created, and run npm build-release there. Hopefully the next time you run it would compile.

@itsnotvalid
Copy link

LoL @Ben3eeE I just stumbled on the include path problem. Definitely this won't work as the README says it was only tested on Mac OS. I don't think cargo would use any external compiler unless there has been any specific setups. Right now I am trying to figure out how to plug the src of node correctly.

@itsnotvalid
Copy link

After manually setting up headers for node@v8, I tried various setups (like stable-msvc, stable-gnu, mingw64, etc.), for some reason cc-rs would bind to use particular compiler, yet I couldn't find a way to specify usage of clang. As such, they kept complaining the flag dynamic_lookup, e.g.:

gcc.exe: error: dynamic_lookup: No such file or directory

If there is any ways i can tell cc-rs to use clang, that would be very helpful.

@Ben3eeE
Copy link
Author

Ben3eeE commented Mar 9, 2018

Maybe clang is not required on Windows? The cc-rs readme seems to indicate to use msvc. I only got the clang requirement from reading Linux/macOS comments.

The dynamic_lookup seems to come from:
https://github.com/atom/xray/blob/8c67a8e887ccd3793e5c075644d91d0fe313e816/napi/scripts/napi.js#L39

Which is part of platform specific arguments. Maybe these are incorrect on Windows?

It seems possible that can be are incorrect since it's not been tested on Windows yet. Just guessing since I have no experience and haven't tested myself yet 😀

@nathansobo
Copy link

I'm going to close this out because we're going to make a pretty big shift in our architecture that will probably change the build situation. If after that change (some time next week) there are new issues building, feel free to reopen. Thanks again for your interest.

@canfeit
Copy link

canfeit commented Mar 24, 2018

@nathansobo Don't consider build on Windows anymore?:sob::cry::sweat::cold_sweat::disappointed::u7533:

@Ben3eeE
Copy link
Author

Ben3eeE commented Mar 24, 2018

@canfeit If you still have issues building now that the architecture change is done I recommend you open a new issue with as much details as possible about the issue you are having. I haven't had the chance to test it myself yet.

@nathansobo
Copy link

nathansobo commented Mar 24, 2018

It’s probably because we’re using domain sockets to connect to the server. This is definitely solvable by switching to named pipes on windows, but their semantics are a bit different and so for now we decided to delay dealing with it. This is definitely an area where we wild accept a PR. Otherwise we will get to it once we make a bit more progress elsewhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants