Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Installing Rust on Pi 4, 32 bit Pi OS.

Mon Nov 02, 2020 2:40 pm

Edit: This of course was a brain fart on my part. Rust does in fact install on a fresh installation of PiOS out of the box. Just using the default install option. See post below.

Turned out I had neglected the fact that I had installed a 64 bit kernel on my Pi when installing the nspawn 64 bit shell. So although the Pi was still running a 32 bit user land the kernel identified as 64 bit which confused the Rust installer.



If one follows the Rust installation instructions here: https://www.rust-lang.org/tools/install the resulting Rust installation will not run on a Pi4 with a 32 bit Pi OS. At least not if one just does the default install. Which is odd, I'm sure I had it working in the spring time. Seems the installer decides the Pi 4 is a 64 bit machine and it all goes wrong.

To get it to work:

1) Download the installer as per the link above:

Code: Select all

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2) When prompted select option "2) Custom installation"

3) When prompted for "Default host triple?" enter "arm-unknown-linux-gnueabihf"

Other options are up to you, I selected "nightly" for the default toolchain, "complete" for the profile and "y" to update my PATH. And finally 1) to kick off the installation.

After that "cargo" works fine again.
Last edited by Heater on Sat Nov 07, 2020 10:10 am, edited 1 time in total.
Memory in C++ is a leaky abstraction .

User avatar
paddyg
Posts: 2614
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Fri Nov 06, 2020 11:23 am

I thought "I only installed rust a short while ago, and it worked fine". Turns out that was back in March - how time flies when you're ...

I made a new SD and looked to see how the .sh checked for bitness. Which is the fifth byte of /proc/self/exe and it seemed to be OK (1 => 32 bit, 2 => 64) so I carried on with the default:

Code: Select all

   default host triple: armv7-unknown-linux-gnueabihf
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes
and, thankfully, everything worked fine. So it looks like the problem has been fixed.

Paddy

PS I wonder if this was related to the 'adoption' of RPi by cannonical. //TODO test out pi3d and rust on ubuntu desktop.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Sat Nov 07, 2020 10:14 am

@paddyg,

Turns out you are right. The default install of Rust does work on an out of the box Pi OS installation.

I had neglected the fact that I had installed a 64 bit kernel when I installed the nspawn 64 bit shell. So although the Pi was running a 32 bit user land the kernel identified as 64 bit, which confused the Rust installer.

This problem came to light when I was trying to build the zpugcc cross-compiler and the config could not detect the host computer type.
Memory in C++ is a leaky abstraction .

User avatar
bonzadog
Posts: 272
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 2:09 pm

Thank you for the RUST installation procedure on the RPi - work well.

I would like to see a decent IDE for Rust . Is there one, I cannot find it under duckduckgo

User avatar
paddyg
Posts: 2614
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 2:14 pm

I do everything first on my ubuntu laptop using MS code which has excellent help (drastic reduction in compiler messages!). I use cargo to compile on command line. Generally things will work on the RPi if they work on my laptop (and also cross compile to windows etc).
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
bonzadog
Posts: 272
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 2:30 pm

paddyg wrote:
Thu Mar 25, 2021 2:14 pm
I do everything first on my ubuntu laptop using MS code which has excellent help (drastic reduction in compiler messages!). I use cargo to compile on command line. Generally things will work on the RPi if they work on my laptop (and also cross compile to windows etc).
This is the way I will work too.

But still, would like to see a Windows IDE and a RPi IDE as well.

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 3:17 pm

bonzadog wrote:
Thu Mar 25, 2021 2:09 pm
I would like to see a decent IDE for Rust . Is there one, I cannot find it under duckduckgo
Use Visual Studio Code (Not "Visual Studio"): https://code.visualstudio.com/

VS Code is a cross-platform and open source (mostly) programmers editor. There are hundreds of easily installable extensions for VS Code which makes it a very good IDE with syntax highlighting and all for almost any language and text file format. Some extensions are very sophisticated and provide all the things one generally needs from a full up IDE. Coe completion, red squiggles on syntax errors, pop ups for types and and all kind of things.

Specifically I use VSCode on MacBook, Win10, Linux PC's the Raspberry Pi and others. It has very good support for Rust with the "rust -analyzer" extension: https://marketplace.visualstudio.com/it ... t-analyzer. Also Open Source and free.

VS Code is available as a package in Pi OS so it is only an "apt-get" away.

Alternatively.... Use Vim or Neovim. That also can use the rust-analyser which makes Vim as capable as any IDE for Rust.
Memory in C++ is a leaky abstraction .

User avatar
bonzadog
Posts: 272
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 3:30 pm

Heater wrote:
Thu Mar 25, 2021 3:17 pm
bonzadog wrote:
Thu Mar 25, 2021 2:09 pm
I would like to see a decent IDE for Rust . Is there one, I cannot find it under duckduckgo
Use Visual Studio Code (Not "Visual Studio"): https://code.visualstudio.com/

VS Code is a cross-platform and open source (mostly) programmers editor. There are hundreds of easily installable extensions for VS Code which makes it a very good IDE with syntax highlighting and all for almost any language and text file format. Some extensions are very sophisticated and provide all the things one generally needs from a full up IDE. Coe completion, red squiggles on syntax errors, pop ups for types and and all kind of things.

Specifically I use VSCode on MacBook, Win10, Linux PC's the Raspberry Pi and others. It has very good support for Rust with the "rust -analyzer" extension: https://marketplace.visualstudio.com/it ... t-analyzer. Also Open Source and free.

VS Code is available as a package in Pi OS so it is only an "apt-get" away.

Alternatively.... Use Vim or Neovim. That also can use the rust-analyser which makes Vim as capable as any IDE for Rust.
Yes, I have used VSCode . Not bad at all. Re Vi/Vim I am not such a Fan , preferring Emacs or the IDE Editors. I much prefer IDE's even if they , sometimes, call standard products. After some 50 odd years writing Programmes I like an easy life.

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 3:42 pm

bonzadog wrote:
Thu Mar 25, 2021 3:30 pm
After some 50 odd years writing Programmes I like an easy life.
I have some catching up to do maybe.

After 40 years programming I like an easy life too. In fact I always have done.

That is why I have always avoided big, ugly, complex IDEs and striven to do everything on the command line, automating with easily repeatable and portable scripts, and using the simplest editor I can find. It was awful back in the day when one had a different IDE on every platform, and on top of that ended up with collection of IDE's, one from every vendor of embedded systems.

Even today, IDE's cause me pain. I still need IntelJ when I want to mess with Scala and the gargantuan labyrinth of Quartus when I want to mess with FPGA.

Today, thank goodness for Rust's cross-platform build system, Cargo, and the drop dead simple VS Code that provides all the features of an IDE anyone would want.

And Vim :)
Memory in C++ is a leaky abstraction .

User avatar
paddyg
Posts: 2614
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 4:24 pm

Agree (but draw the line at vim and emac etc). I know Code runs on RPi but it's already become a bit sluggish on an i7 laptop so I would expect it to be quite unpleasant on Pi.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Thu Mar 25, 2021 6:37 pm

Interesting. VS Code is quite snappy enough on my nearly 10 year old i7 PC. Whose only upgrade has been an SSD.

But here is my dirty little secret.... I don't normally write code on a Pi. I get the bulk of the work done on PC/Laptop. Then "git clone" the code to the Pi, compile and run it. Some tweaks might happen by using VS Code on the laptop/PC editing code on the Pi via sshfs. Pi specific code gets edited on the Pi with Vim!

Vim with the rust analyser is pretty snappy.
Memory in C++ is a leaky abstraction .

User avatar
bonzadog
Posts: 272
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: Installing Rust on Pi 4, 32 bit Pi OS.

Sat Mar 27, 2021 1:06 pm

Heater wrote:
Thu Mar 25, 2021 3:42 pm
bonzadog wrote:
Thu Mar 25, 2021 3:30 pm
After some 50 odd years writing Programmes I like an easy life.
I have some catching up to do maybe.

After 40 years programming I like an easy life too. In fact I always have done.

That is why I have always avoided big, ugly, complex IDEs and striven to do everything on the command line, automating with easily repeatable and portable scripts, and using the simplest editor I can find. It was awful back in the day when one had a different IDE on every platform, and on top of that ended up with collection of IDE's, one from every vendor of embedded systems.

Even today, IDE's cause me pain. I still need IntelJ when I want to mess with Scala and the gargantuan labyrinth of Quartus when I want to mess with FPGA.

Today, thank goodness for Rust's cross-platform build system, Cargo, and the drop dead simple VS Code that provides all the features of an IDE anyone would want.

And Vim :)
IDE are not that complex and easy to learn. They offer syntax check, compile and debugging in one package. I know of noone who complains about using an IDE.. they save a lot of time. VS code is an IDE . But I suppose use vi/vim one needs a teletype ;-) ;)
.

Return to “Other programming languages”