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

Install fails on RISC-V machines #3171

Closed
ilg-ul opened this issue Aug 22, 2023 · 1 comment
Closed

Install fails on RISC-V machines #3171

ilg-ul opened this issue Aug 22, 2023 · 1 comment

Comments

@ilg-ul
Copy link

ilg-ul commented Aug 22, 2023

Operating system and version:

nvm debug output:

ubuntu@ubuntu:~$ nvm debug
nvm --version: v0.39.4
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'ubuntu'
${HOME}: /home/ubuntu
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.2.15(1)-release (riscv64-unknown-linux-gnu)'
uname -a: 'Linux 6.2.0-19-generic #19.1-Ubuntu SMP Fri Mar 31 12:41:53 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Ubuntu 23.04  
awk: /usr/bin/awk, GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0, GNU MP 6.2.1)
curl: /usr/bin/curl, curl 7.88.1 (riscv64-unknown-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh/0.10.4/openssl/zlib nghttp2/1.52.0 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.21.3 built on linux-gnu.
git: /usr/bin/git, git version 2.39.2
grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.8
sed: /usr/bin/sed, sed (GNU sed) 4.9
cut: /usr/bin/cut, cut (GNU coreutils) 9.1
basename: /usr/bin/basename, basename (GNU coreutils) 9.1
rm: /usr/bin/rm, rm (GNU coreutils) 9.1
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 9.1
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.9.0
nvm current: none
which node: 
which iojs: 
which npm: 
npm config get prefix: Command 'npm' not found, but can be installed with:
sudo apt install npm
npm root -g: Command 'npm' not found, but can be installed with:
sudo apt install npm
ubuntu@ubuntu:~$ 

nvm ls output:

ubuntu@ubuntu:~$ nvm ls
            N/A *
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.17.1 (-> N/A)
ubuntu@ubuntu:~$ 

How did you install nvm?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash

What steps did you perform?

Ran the script.

What happened?

The scrip did not locate the binary archive available in the unofficial section and tried to compile from sources, but failed in openssl since the riscv architecture was not properly identified.

ubuntu@ubuntu:~$ nvm install node
Downloading and installing node v20.5.1...
Downloading https://nodejs.org/dist/v20.5.1/node-v20.5.1-linux-riscv64.tar.xz...
curl: (22) The requested URL returned error: 404                               

Binary download from https://nodejs.org/dist/v20.5.1/node-v20.5.1-linux-riscv64.tar.xz failed, trying source.
grep: /home/ubuntu/.nvm/.cache/bin/node-v20.5.1-linux-riscv64/node-v20.5.1-linux-riscv64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 4 CPU core(s)
Running with 3 threads to speed up the build
Downloading https://nodejs.org/dist/v20.5.1/node-v20.5.1.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
$>./configure --prefix=/home/ubuntu/.nvm/versions/node/v20.5.1 <
Node.js configure: Found Python 3.11.2...
INFO: configure completed successfully
make -C out BUILDTYPE=Release V=0
  touch /home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/Release/obj.target/deps/googletest/gtest_prod.stamp
...
  cc -o /home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/Release/obj.target/openssl/deps/openssl/openssl/ssl/bio_ssl.o ../deps/openssl/openssl/ssl/bio_ssl.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_HW' '-DOPENSSL_API_COMPAT=0x10100001L' '-DSTATIC_LEGACY' '-DNDEBUG' '-DOPENSSL_USE_NODELETE' '-DL_ENDIAN' '-DOPENSSL_BUILDING_OPENSSL' '-DAES_ASM' '-DBSAES_ASM' '-DCMLL_ASM' '-DECP_NISTZ256_ASM' '-DGHASH_ASM' '-DKECCAK1600_ASM' '-DMD5_ASM' '-DOPENSSL_BN_ASM_GF2m' '-DOPENSSL_BN_ASM_MONT' '-DOPENSSL_BN_ASM_MONT5' '-DOPENSSL_CPUID_OBJ' '-DOPENSSL_IA32_SSE2' '-DPADLOCK_ASM' '-DPOLY1305_ASM' '-DRC4_ASM' '-DSHA1_ASM' '-DSHA256_ASM' '-DSHA512_ASM' '-DVPAES_ASM' '-DWHIRLPOOL_ASM' '-DX25519_ASM' '-DOPENSSL_PIC' '-DMODULESDIR="/home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/$(BUILDTYPE)/obj.target/deps/openssl/lib/openssl-modules"' '-DOPENSSLDIR="/etc/ssl"' '-DENGINESDIR="/dev/null"' '-DTERMIOS' -I../deps/openssl/openssl -I../deps/openssl/openssl/include -I../deps/openssl/openssl/crypto -I../deps/openssl/openssl/crypto/include -I../deps/openssl/openssl/crypto/modes -I../deps/openssl/openssl/crypto/ec/curve448 -I../deps/openssl/openssl/crypto/ec/curve448/arch_32 -I../deps/openssl/openssl/providers/common/include -I../deps/openssl/openssl/providers/implementations/include -I../deps/openssl/config -I../deps/openssl/config/archs/linux-x86_64/asm -I../deps/openssl/config/archs/linux-x86_64/asm/include -I../deps/openssl/config/archs/linux-x86_64/asm/crypto -I../deps/openssl/config/archs/linux-x86_64/asm/crypto/include/internal -I../deps/openssl/config/archs/linux-x86_64/asm/providers/common/include  -pthread -Wall -Wextra -Wno-unused-parameter -Wa,--noexecstack -Wall -O3 -pthread -m64 -Wall -O3 -Wno-missing-field-initializers -Wno-old-style-declaration -O3 -fno-omit-frame-pointer  -MMD -MF /home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/Release/.deps//home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/Release/obj.target/openssl/deps/openssl/openssl/ssl/bio_ssl.o.d.raw   -c
cc: error: unrecognized command-line option ‘-m64’
make[1]: *** [deps/openssl/openssl.target.mk:1171: /home/ubuntu/.nvm/.cache/src/node-v20.5.1/files/out/Release/obj.target/openssl/deps/openssl/openssl/ssl/bio_ssl.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:134: node] Error 2
nvm: install v20.5.1 failed!

What did you expect to happen?

The install to succeed.

Is there anything in any of your profile files that modifies the PATH?

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

ubuntu@ubuntu:~$ curl -I --compressed -v https://nodejs.org/dist/
*   Trying 104.20.23.46:443...
* Connected to nodejs.org (104.20.23.46) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=*.nodejs.org
*  start date: Feb  3 00:00:00 2023 GMT
*  expire date: Mar  5 23:59:59 2024 GMT
*  subjectAltName: host "nodejs.org" matched cert's "nodejs.org"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
* using HTTP/2
* h2h3 [:method: HEAD]
* h2h3 [:path: /dist/]
* h2h3 [:scheme: https]
* h2h3 [:authority: nodejs.org]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* h2h3 [accept-encoding: deflate, gzip, br, zstd]
* Using Stream ID: 1 (easy handle 0x55557613d730)
> HEAD /dist/ HTTP/2
> Host: nodejs.org
> user-agent: curl/7.88.1
> accept: */*
> accept-encoding: deflate, gzip, br, zstd
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200 
HTTP/2 200 
< date: Tue, 22 Aug 2023 06:12:49 GMT
date: Tue, 22 Aug 2023 06:12:49 GMT
< content-type: text/html
content-type: text/html
< cache-control: public, max-age=3600, s-maxage=14400
cache-control: public, max-age=3600, s-maxage=14400
< last-modified: Tue, 22 Aug 2023 04:05:18 GMT
last-modified: Tue, 22 Aug 2023 04:05:18 GMT
< cf-cache-status: HIT
cf-cache-status: HIT
< age: 3956
age: 3956
< vary: Accept-Encoding
vary: Accept-Encoding
< strict-transport-security: max-age=31536000; includeSubDomains; preload
strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
x-content-type-options: nosniff
< server: cloudflare
server: cloudflare
< cf-ray: 7fa8f762ccbf989c-OTP
cf-ray: 7fa8f762ccbf989c-OTP
< content-encoding: br
content-encoding: br

< 
* Connection #0 to host nodejs.org left intact
ubuntu@ubuntu:~$ 

Comments

I understand that this is not a direct fault of nvm, but the build scripts of node and dependencies need adjustments for risc-v.

However, the build step can be avoided, since the pre-built binary is already available in the unofficial section.

My workaround was to explicitly set NVM_NODEJS_ORG_MIRROR:

ubuntu@ubuntu:~$ export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release
ubuntu@ubuntu:~$ nvm install node
Downloading and installing node v20.5.1...
Downloading https://unofficial-builds.nodejs.org/download/release/v20.5.1/node-v20.5.1-linux-riscv64.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v20.5.1 (npm v9.8.0)
Creating default alias: default -> node (-> v20.5.1 *)
ubuntu@ubuntu:~$ nvm install-latest-npm
Attempting to upgrade to the latest working version of npm...
* Installing latest `npm`; if this does not work on your node version, please report a bug!

changed 24 packages in 56s

28 packages are looking for funding
  run `npm fund` for details
* npm upgraded to: v9.8.1
ubuntu@ubuntu:~$ node --version
v20.5.1
ubuntu@ubuntu:~$ npm --version
9.8.1
ubuntu@ubuntu:~$ npm i -g xpm

added 1 package in 1m

55 packages are looking for funding
  run `npm fund` for details
ubuntu@ubuntu:~$ xpm --version
0.16.3
ubuntu@ubuntu:~$ 

For testing, dedicated hardware is not mandatory, I ran my build under QEMU, configured as instructed in the Ubuntu page.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2023

nvm doesn’t support unofficial builds by default; duplicate of #3041.

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
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