Closed ruby-ist closed 6 months ago
@ruby-ist It is unfortunate that I can't reproduce it because I don't have MacOS. It might be just a dependency problem. I recommend trying the main
branch which has all dependencies updated. To do so, could you please delete the rustlings
directory and run the following?
git clone --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
cargo install --force --path .
Please tell me if it works :)
@mo8it That doesn't work, facing the same issue. However I found out that even though compilation failed, the cargo run
command works with default installation. And cargo run watch
command works as expected too. Is this a normal behaviour? I'm new to Rust. Can I continue this course with cargo run
command instead of rustlings
command?
Weird. It looks like a problem with the release
profile then. Could you please try to run cargo run --release
instead of cargo run
? In that case, you would get the error again.
Could you please also post the output of the command rustup toolchain list
?
Otherwise, yes, you can work with cargo run watch
. Sorry for the inconvenience. I will try to ask around to debug this issue and prevent it in the future.
I ran cargo run --release
command and yes, it threw the same error again.
Output of rustup toolchain list
:
stable-aarch64-apple-darwin (default)
Thanks for your response @mo8it. I will continue with cargo run watch
command for now.
I got a hint. Could you please share the output of the following commands?
which strip
whereis strip
echo $PATH
You might also find something helpful in https://github.com/rust-lang/cargo/issues/8913 or https://github.com/rust-lang/rust/issues/73908
Of course only if you are interested in fixing the issue. Otherwise, I hope that cargo run watch
is good enough :)
Sure, I would be happy to help you fix the issues. Here are the outputs:
$ which strip
/opt/homebrew/opt/binutils/bin/strip
$ whereis strip
strip: /usr/bin/strip /opt/homebrew/opt/binutils/share/man/man1/strip.1
$ echo "${PATH//:/\n}"
/opt/homebrew/opt/binutils/bin
/Users/srira/.bun/bin
/Users/srira/.wasmtime/bin
/opt/homebrew/opt/openjdk/bin
/Users/srira/.gem/ruby/3.1.0/bin
/Users/srira/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/bin
/Users/srira/.rubies/ruby-3.1.0/bin
/opt/homebrew/opt/sqlite/bin
/opt/homebrew/bin
/opt/homebrew/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/srira/DragonRuby
/Users/srira/.rubies/ruby-3.1.0/bin
/Users/srira/.gem/ruby/3.1.0/bin
/Users/srira/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/bin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
/Library/Apple/usr/bin
/Applications/Postgres.app/Contents/Versions/latest/bin
/Users/srira/.cargo/bin
/Users/srira/Library/Application Support/JetBrains/Toolbox/scripts
Your output shows that this has to be this bug related to stripping: https://github.com/dtolnay/proc-macro2/issues/448
See this too: https://github.com/rust-lang/cargo/issues/11641#issuecomment-1407531012
which strip
should return /usr/bin/strip
, not something from homebrew.
The solution would be to find out where the PATH
variable is changed to prepend /opt/homebrew/opt/binutils/bin
. Probably in .bash_profile
, you should find something like this (prepending):
PATH="/opt/homebrew/opt/binutils/bin:$PATH"
Then, just change it to this (appending):
PATH="$PATH:/opt/homebrew/opt/binutils/bin"
This means that binaries will be looked for in /usr/bin
before /opt/homebrew/opt/binutils/bin
. Therefore, which strip
should then return /usr/bin/strip
and the compilation in the release profile should work :D
Feel free to reopen if it doesn't work.
Thanks a lot @mo8it changing PATH
variable precedence solved the issue, though I have to remove the folder and install it again. Everything is working fine now 👍🏽
I've been trying to install Rustlings on my m1 macbook air but I'm facing the following compilation error again and again.
Here's the details about my spec:
OS:
macOS 14.0 Sonoma
Xcode version:15.3
I tried everything recommended on stackoverflow but had no luck, I also saw one other issue similar to this here. But that fix doesn't seem to be working for me. I also tried re-installing
rust
,cmake
,llvm
and xcode command line tools.Edit: I have another linux machine, in which rustlings installed successfully