NordSecurity / nordvpn-linux

NordVPN Linux client
GNU General Public License v3.0
306 stars 44 forks source link

Build not working: cargo not found? #550

Closed Wikpi closed 2 months ago

Wikpi commented 2 months ago

Hello, I was trying to build the nordvpn-linux app and ran into a problem.

I was reading BUILD.md and executed the build command:

mage build:binariesDocker

Which then gave the following:

Running dependency: Download
exec: ci/check_dependencies.sh 
Running dependency: main.Build.RustDocker
creating docker client
creating ruster docker container
starting ruster docker container
waiting for ruster docker container to finish
allexport       off
braceexpand     on
emacs           off
errexit         on
errtrace        off
functrace       off
hashall         on
histexpand      off
history         off
ignoreeof       off
interactive-comments    on
keyword         off
monitor         off
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         on
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              off
xtrace          off
+ source /opt/ci/archs.sh
++ [[ ! -n amd64 ]]
++ ARCHS_REVERSE=([i386]=i386 [i686]=i386 [amd64]=amd64 [x86_64]=amd64 [armel]=armel [armv5l]=armel [armv5_eabi]=armel [armhf]=armhf [armhfp]=armhf [armv7_eabihf]=armhf [arm64]=aarch64 [aarch64]=aarch64)
++ declare -A ARCHS_REVERSE
++ ARCHS_DEB=([i386]=i386 [amd64]=amd64 [armel]=armel [armhf]=armhf [aarch64]=arm64)
++ declare -A ARCHS_DEB
++ ARCHS_RPM=([i386]=i386 [amd64]=x86_64 [armel]=armv5l [armhf]=armhfp [aarch64]=aarch64)
++ declare -A ARCHS_RPM
++ ARCHS_GO=([i386]=386 [amd64]=amd64 [armel]=arm [armhf]=arm [aarch64]=arm64)
++ declare -A ARCHS_GO
++ ARCHS_RUST=([i386]=i686 [amd64]=x86_64 [armel]=armv5_eabi [armhf]=armv7_eabihf [aarch64]=aarch64)
++ declare -A ARCHS_RUST
++ export ARCHS
++ export ARCHS_REVERSE
++ export ARCHS_DEB
++ export ARCHS_RPM
++ export ARCHS_GO
++ export ARCHS_RUST
+ targets=([amd64]=x86_64-unknown-linux-gnu [aarch64]=aarch64-unknown-linux-gnu [i386]=i686-unknown-linux-gnu [armhf]=armv7-unknown-linux-gnueabihf [armel]=arm-unknown-linux-gnueabi)
+ declare -A targets
+ pushd /opt/build/foss
/opt/build/foss /opt
+ for arch in "${ARCHS[@]}"
+ target=x86_64-unknown-linux-gnu
+ cargo build --target x86_64-unknown-linux-gnu --release
build/foss/build.sh: line 17: cargo: command not found
Error: exit code 127

I also looked into the docker image, where it shows, that cargo does indeed exist. So why is it not building?

BR, -Wikpi

Wikpi commented 2 months ago

I was trying to dig deeper and ran the build/foss/build.sh command in the ruster docker, which again gave an error:

error: package `bumpalo v3.16.0` cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.1
Either upgrade to rustc 1.73.0 or newer, or use
cargo update -p bumpalo@3.16.0 --precise ver
where `ver` is the latest version of `bumpalo` supporting rustc 1.72.1

Is this a problem with the ruster docker image not being updated to the newest rust version or something else?

devzbysiu commented 2 months ago

Hi, thank you for reporting. Nice investigation as well. We also stumbled upon this issue and we had a fix with different set of changes, but since it's impacting you already, I created a PR with the fix here.

If you are curious, the issue was caused by this line: https://github.com/NordSecurity/nordvpn-linux/blob/main/magefiles/docker.go#L102. We are switching the user with su and it clears the environment of the user before switch happens and this cleared PATH as well, so cargo could not be found

devzbysiu commented 2 months ago

@Wikpi you are right also with the rust version issue, we'll look into that