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

Document how to install on Linux via sudo #2

Open
drauschenbach opened this issue Jan 21, 2024 · 5 comments
Open

Document how to install on Linux via sudo #2

drauschenbach opened this issue Jan 21, 2024 · 5 comments

Comments

@drauschenbach
Copy link

drauschenbach commented Jan 21, 2024

I can install this module on my Mac with sudo luarocks install lua-ryaml. However on Debian 12 Linux the Rust environment does not get set when sudo is invoked. this thread mentions something similar.

$ sudo luarocks install lua-ryaml
Installing https://luarocks.org/lua-ryaml-0.1.0-1.src.rock

lua-ryaml 0.1.0-1 depends on lua >= 5.1 (5.1-1 provided by VM)
lua-ryaml 0.1.0-1 depends on luarocks-build-rust-mlua (0.1.2-1 installed)

Error: Build error: 'cargo' is not installed.
This rock is written in Rust: make sure you have a Rust
development environment installed and try again.
$ sudo su -
$ cargo --version
cargo 1.75.0 (1d8b05cdd 2023-11-20)

In my own mlua based projects I'd like to document for the end user how to install the LuaRock.

@drauschenbach drauschenbach changed the title Document how to install via sudo Document how to install on Linux via sudo Jan 21, 2024
@khvzak
Copy link
Owner

khvzak commented Jan 22, 2024

How is rust/cargo installed? Can you run which cargo from root env?

@drauschenbach
Copy link
Author

How is rust/cargo installed? Can you run which cargo from root env?

Rust was installed with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. Yes the root env can find cargo, which is what this is demonstrating:

$ sudo su -
$ cargo --version
cargo 1.75.0 (1d8b05cdd 2023-11-20)

It is sudo that seems intentionally unsupported by the Rust tooling.

@khvzak
Copy link
Owner

khvzak commented Jan 22, 2024

Yes the root env can find cargo, which is what this is demonstrating:

But could you run which cargo on root env, to see exact path?
And could you try sudo -i cargo to see if it can be found.

It is sudo that seems intentionally unsupported by the Rust tooling.

It's not about rust tooling. This code checks for cargo presence.
So seems luarocks.fs.is_tool_available cannot find it.

@drauschenbach
Copy link
Author

Like this? I did the rustup install separately for both my user and the root user.

$ sudo su -
root@bitscope-0:~# which cargo
/root/.cargo/bin/cargo

@drauschenbach
Copy link
Author

Maybe this has to do with sudo not running the shell .profile, which contains:

mesg n 2> /dev/null || true
. "$HOME/.cargo/env"

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