Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Build Error on a Mac #12

Closed
brianlong opened this issue Apr 10, 2020 · 18 comments
Closed

Build Error on a Mac #12

brianlong opened this issue Apr 10, 2020 · 18 comments

Comments

@brianlong
Copy link
Contributor

Hi,

I am currently working through the "example-helloworld" instructions on a Mac. I have been taking notes along the way and will submit a PR to enhance the README file when I am done.

I am currently stuck on npm run build:program. Here is the error:

$ npm run build:program

> [email protected] build:program /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> npm run clean:store && ./src/program/do.sh build


> [email protected] clean:store /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> rm -rf store

Building /Users/brianlong/Projects/example-helloworld/src/program
+ cargo + install xargo
error: no such subcommand: `+`

   Did you mean `doc`?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:program: `npm run clean:store && ./src/program/do.sh build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:program 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!     /Users/brianlong/.npm/_logs/2020-04-10T19_23_38_809Z-debug.log

Suggestions? TIA!

@brianlong
Copy link
Contributor Author

Related log file: 2020-04-10T19_23_38_809Z-debug.log

@jackcmay
Copy link
Contributor

jackcmay commented Apr 10, 2020

Hi @brianlong, thanks for the issue!

What version of cargo do you have?

This should fix it: solana-labs/solana#9437

@brianlong
Copy link
Contributor Author

Hi @jackcmay cargo 1.42.0

@jackcmay
Copy link
Contributor

Strange, same version as me, wonder why I don't see it on my mac :-(

If you try that patch out let me know if it works for you

@jackcmay
Copy link
Contributor

@brianlong btw, you can make that change in the helloworld project here:
node_modules/@solana/web3.js/bpf-sdk/scripts/install.sh

@brianlong
Copy link
Contributor Author

Thanks, @jackcmay. That help me get a little further down the road. After running npm run build:program, I now see:

warning: be sure to add `/Users/brianlong/.cargo/bin` to your PATH to be able to run the installed binaries
+ xargo --version
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:program: `npm run clean:store && ./src/program/do.sh build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:program 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!     /Users/brianlong/.npm/_logs/2020-04-10T22_49_45_861Z-debug.log

@brianlong
Copy link
Contributor Author

Here's that log: 2020-04-10T22_49_45_861Z-debug.log

@brianlong
Copy link
Contributor Author

@jackcmay I just updated my Solana version to 1.0.15 and I am making progress. Stay tuned...

@jackcmay
Copy link
Contributor

@brianlong Not Solana v1.1.2? Did it work for you in gitpod?

@brianlong
Copy link
Contributor Author

@jackcmay The funny thing is that I updated my default Solana from 1.0.7 to 1.0.15 and then I could move past that error. Hidden dependency?

I do see 1.1.2 being downloaded via npm. Current status:

$ npm run start

> [email protected] start /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> babel-node src/client/main.js

Let's say hello to a Solana account...
Connection to cluster established: http://localhost:8899 { 'solana-core': '1.1.2' }
[Error: ENOENT: no such file or directory, open 'src/program/target/bpfel-unknown-unknown/release/solana_bpf_helloworld.so'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'src/program/target/bpfel-unknown-unknown/release/solana_bpf_helloworld.so'
}

I don't see 'solana_bpf_helloworld.so' on my system.

@brianlong
Copy link
Contributor Author

At the moment, port forwarding from Mac OS to the Docker is only for 8899. Should I add forwarding for 8900 & 9900?

@brianlong
Copy link
Contributor Author

I went back to the beginning for a clean start and this is the current status:

$ npm run build:program

> [email protected] build:program /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> npm run clean:store && ./src/program/do.sh build


> [email protected] clean:store /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> rm -rf store

Building /Users/brianlong/Projects/example-helloworld/src/program
+ [[ -n '' ]]
+ cargo install xargo
    Updating crates.io index
     Ignored package `xargo v0.3.20` is already installed, use --force to override
warning: be sure to add `/Users/brianlong/.cargo/bin` to your PATH to be able to run the installed binaries
+ xargo --version
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:program: `npm run clean:store && ./src/program/do.sh build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:program 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!     /Users/brianlong/.npm/_logs/2020-04-10T23_31_18_869Z-debug.log

FWIW, my installation notes are in this README: https://github.com/brianlong/example-helloworld/tree/202004-bl-changes

@jackcmay
Copy link
Contributor

I haven't tried running the local net in virtialbox...
Looks like you are getting a cargo error with paths? Is rust set up correctly on your machine?

@brianlong
Copy link
Contributor Author

brianlong commented Apr 11, 2020

Hi, I used Mac Homebrew to install rust & docker. I made a little more progress and I now see some errors related to rustup. Are you using rustup? I think my next step is to uninstall rust & then install rustup.

@brianlong
Copy link
Contributor Author

@jackcmay Good news! That worked.

I uninstalled rust and then installed rustup. (FWIW, I am an experienced Ruby developer, but this is my first time using Rust or Docker.) If you have a few minutes, please take a look at my proposed changes to the README: https://github.com/brianlong/example-helloworld/tree/202004-bl-changes

I have started a PR (still WIP) here: #13 and I would like to get some feedback before I send that in for a merge.

Finally, your change above still needs to be merged in for this to work.

Thanks for your help!

@brianlong
Copy link
Contributor Author

@jackcmay I have successfully run the hello world example on both Mac & Linux. I think we can close this issue. I will @ you on PR #13 and ask for your help to review & merge that. Thanks for you help!

@jackcmay
Copy link
Contributor

Great news @brianlong !

@phenomax
Copy link

Hi @jackcmay,
sorry to revive this issue.
I am experiencing similar building errors on OSX 10.15.2:

Running npm run build:program-c yields


0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/14.8.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build:program-c'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:program-c', 'build:program-c', 'postbuild:program-c' ]
5 info lifecycle [email protected]~prebuild:program-c: [email protected]
6 info lifecycle [email protected]~build:program-c: [email protected]
7 verbose lifecycle [email protected]~build:program-c: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build:program-c: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/phenomax/projects/solana/example-helloworld/node_modules/.bin:/Users/phenomax/opt/anaconda3/bin:/Users/phenomax/opt/anaconda3/condabin:/Users/phenomax/.local/share/solana/install/active_release/bin:/usr/local/opt/[email protected]/sbin:/usr/local/opt/[email protected]/bin:/usr/local/opt/openssl/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/share/dotnet/dotnet:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Users/phenomax/projects/go/bin/Users/phenomax/.pyenv/shims:/Users/phenomax/.bashhub/bin
9 verbose lifecycle [email protected]~build:program-c: CWD: /Users/phenomax/projects/solana/example-helloworld
10 silly lifecycle [email protected]~build:program-c: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'rm -f ./dist/program/helloworld.so && V=1 make -C ./src/program-c && npm run clean:store'
10 silly lifecycle ]
11 silly lifecycle [email protected]~build:program-c: Returned: code: 2  signal: null
12 info lifecycle [email protected]~build:program-c: Failed to exec build:program-c script
13 verbose stack Error: [email protected] build:program-c: `rm -f ./dist/program/helloworld.so && V=1 make -C ./src/program-c && npm run clean:store`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/phenomax/projects/solana/example-helloworld
16 verbose Darwin 19.2.0
17 verbose argv "/usr/local/Cellar/node/14.8.0/bin/node" "/usr/local/bin/npm" "run" "build:program-c"
18 verbose node v14.8.0
19 verbose npm  v6.14.7
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build:program-c: `rm -f ./dist/program/helloworld.so && V=1 make -C ./src/program-c && npm run clean:store`
22 error Exit status 2
23 error Failed at the [email protected] build:program-c script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Versions

(base) ➜  example-helloworld git:(master) ✗ node --version
v14.8.0
(base) ➜  example-helloworld git:(master) ✗ npm --version
6.14.7
(base) ➜  example-helloworld git:(master) ✗ docker -v
Docker version 19.03.12, build 48a66213fe
(base) ➜  example-helloworld git:(master) ✗ wget --version
GNU Wget 1.20.3 built on darwin19.0.0.

-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls
+ntlm +opie -psl +ssl/openssl

Wgetrc:
    /usr/local/etc/wgetrc (system)
Locale:
    /usr/local/Cellar/wget/1.20.3_2/share/locale
Compile:
    clang -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc"
    -DLOCALEDIR="/usr/local/Cellar/wget/1.20.3_2/share/locale" -I.
    -I../lib -I../lib -I/usr/local/opt/[email protected]/include -DNDEBUG -g
    -O2
Link:
    clang -DNDEBUG -g -O2 -lidn2 -L/usr/local/opt/[email protected]/lib -lssl
    -lcrypto -ldl -lz ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a
    -liconv -lintl -Wl,-framework -Wl,CoreFoundation -lunistring

Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <[email protected]>.
Please send bug reports and questions to <[email protected]>.
(base) ➜  example-helloworld git:(master) ✗ rustc --version
rustc 1.45.2
(base) ➜  example-helloworld git:(master) ✗ cargo --version
cargo 1.45.1

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

3 participants