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

Makefile: Define RUSTC to avoid "rustc: not found" during sudo make install #578

Merged
merged 1 commit into from
May 5, 2024

Conversation

keisku
Copy link
Contributor

@keisku keisku commented May 4, 2024

Through the Demo in the README, the following error happened.

# Make sure rustc is installed.
ls -la $(which rustc)
-rwxr-xr-x 14 ubuntu ubuntu 15428432 May  4 11:05 /home/ubuntu/.cargo/bin/rustc
rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)

# Cannot run rustc as root.
sudo rustc --version
sudo: rustc: command not found

sudo make --trace install
/bin/sh: 1: rustc: not found
/bin/sh: 1: rustc: not found
/bin/sh: 1: rustc: not found
/bin/sh: 1: rustc: not found
Makefile:76: target 'build-wasmedge' does not exist
cargo build --target= --target-dir=./target/ -p containerd-shim-wasmedge
/bin/sh: 1: rustc: not found
/bin/sh: 1: rustc: not found
/bin/sh: 1: rustc: not found
make: cargo: No such file or directory
make: *** [Makefile:76: build-wasmedge] Error 127

I would like to define RUSTC variable in Makefile, then run this command.

sudo CARGO=~/.cargo/bin/cargo RUSTC=~/.cargo/bin/rustc make --trace install
Makefile:76: target 'build-wasmedge' does not exist
/home/ubuntu/.cargo/bin/cargo build --target=x86_64-unknown-linux-gnu --target-dir=./target/ -p containerd-shim-wasmedge
    Updating crates.io index
  Downloaded anstream v0.6.11
  Downloaded cgroups-rs v0.3.4
  Downloaded async-stream v0.3.5
...skip...
Makefile:138: update target 'install-wasmer' due to: build-wasmer
mkdir -p /usr/local/bin
install ./target//x86_64-unknown-linux-gnu/debug/containerd-shim-wasmer-v1 /usr/local/bin/
ln -sf ./containerd-shim-wasmer-v1 /usr/local/bin/containerd-shim-wasmerd-v1
ln -sf ./containerd-shim-wasmer-v1 /usr/local/bin/containerd-wasmerd

# Make sure binaries exist in /usr/loca/bin/
ls -la /usr/local/bin/containerd*wasm*
-rwxr-xr-x 1 root root 410800840 May  5 00:02 /usr/local/bin/containerd-shim-wasmedge-v1
lrwxrwxrwx 1 root root        29 May  5 00:02 /usr/local/bin/containerd-shim-wasmedged-v1 -> ./containerd-shim-wasmedge-v1
-rwxr-xr-x 1 root root 618126120 May  5 00:05 /usr/local/bin/containerd-shim-wasmer-v1
lrwxrwxrwx 1 root root        27 May  5 00:05 /usr/local/bin/containerd-shim-wasmerd-v1 -> ./containerd-shim-wasmer-v1
-rwxr-xr-x 1 root root 581308584 May  5 00:03 /usr/local/bin/containerd-shim-wasmtime-v1
lrwxrwxrwx 1 root root        29 May  5 00:03 /usr/local/bin/containerd-shim-wasmtimed-v1 -> ./containerd-shim-wasmtime-v1
lrwxrwxrwx 1 root root        29 May  5 00:02 /usr/local/bin/containerd-wasmedged -> ./containerd-shim-wasmedge-v1
lrwxrwxrwx 1 root root        27 May  5 00:05 /usr/local/bin/containerd-wasmerd -> ./containerd-shim-wasmer-v1
lrwxrwxrwx 1 root root        29 May  5 00:03 /usr/local/bin/containerd-wasmtimed -> ./containerd-shim-wasmtime-v1

@keisku keisku force-pushed the keisku/update-Makefile branch 2 times, most recently from 740b78a to 8a702dc Compare May 4, 2024 23:25
@keisku keisku marked this pull request as draft May 4, 2024 23:39
@keisku keisku force-pushed the keisku/update-Makefile branch from 8a702dc to 731bb37 Compare May 5, 2024 00:10
@keisku keisku changed the title Makefile: fix make errors during Demo Makefile: Define RUSTC to avoid error during sudo make install May 5, 2024
@keisku keisku changed the title Makefile: Define RUSTC to avoid error during sudo make install Makefile: Define RUSTC to avoid "rustc: not found" during sudo make install May 5, 2024
@keisku keisku marked this pull request as ready for review May 5, 2024 00:20
Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

@Mossaka Mossaka merged commit b3323c2 into containerd:main May 5, 2024
51 checks passed
@jprendes
Copy link
Collaborator

jprendes commented May 5, 2024

The change is fine, but in general building the binaries with sudo is not recommended.
You should do make build-wasmedge and then sudo make install-wasmedge.

Maybe we should change the README.md to reflect that, and maybe also remove the Makefile dependency so that install doesnt call build automatically.

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

Successfully merging this pull request may close these issues.

3 participants