Quasi-newb drowning

This is extremely interesting to me; I actually use Linux Mint right now for Rust (installed from rustup) and Python (preinstalled), and I've never had any problems with this combination. What method did you use to install Rust?

I suspect part of the problem is learning Linux at the same time as learning Rust. Almost every single command is new to me. And I'm also spoiled from the WIndows world. I've written installers for Windows and a requirement is they have to be brain dead easy. Click Click click done. I'm having flashbacks to college and Sun Sparc workstations and X Windows.

I think I may start a new thread and document this for posterity, Good walk throughs are really nice to have lying about.

I will say that I was really impressed at the Mint install. Linux has come a long way since the last time I played with it (20+ years ago).

2 Likes

I'd agree with @Kornel. When in doubt try to use the distro's packages for things because that'll eliminate the unnecessary pain of installing and configuring everything manually. Installing Rust is a little different in that there's a new release every 6 weeks and the version in the distro's repositories will likely be 6-12 months out of date. Getting started with rustup is essentially Linux's equivalent of a one-click installer (curl ... | sh), so you shouldn't have any troubles there.

Rust doesn't require any specific IDE so you can use pretty much any text editor you are familiar with. I usually like Vim, but VS Code is really good too and a lot more beginner friendly. If you prefer more heavy-weight solutions, IntelliJ has pretty good support for Rust and should let you do the usual things like compiling + running and debugging.

I've found you tend to use a debugger significantly less often than most other languages (only a handful of times in the last 2 years compared to almost every day). 90% of the time the type system will make sure that if something compiles, it's pretty much correct. Rust has pretty good support for testing out of the box (i.e. you don't need any 3rd party test harness libraries like GoogleTest or ctest), so that is usually enough to make sure you don't have logic errors.

That said, gdb and lldb already work well with Rust code and I've had to use them several times when interoperating with C or other languages (e.g. writing DLLs).

1 Like

My suggestion is to avoid going "big bang" in life. Change one parameter at a time and change things step by step, going one step forward when you are feeling OK.

5 Likes

Hmm. I can only speak for the two distributions I've tried, which are Ubuntu and Arch Linux.


Ubuntu is, from what I understand, probably similar to Linux Mint; after all Mint is derived from Ubuntu. It's a fairly popular distribution, meaning you'll have an easy time finding help.

Ubuntu was my first Linux, and I used it as my primary OS for over six years, beginning with 9.10 Karmic Koala. The destop grid feature alone multiplied my productivity by a hundred compared to Windows, and I was blown away by how easy it was to install software (again, compared to Windows). Judging from release dates, I guess this was the first release to come with the (GUI-based) Ubuntu Software Center, and perhaps that's why I never used it (as most guides at the time used the CLI tool apt-get).

Over the years, I became increasingly frustrated with Ubuntu. Doing a full system upgrade can be a hassle, so I stuck to the LTS releases that came every two years. And I found myself in this repeating cycle where every two years I'd find myself having to manually build more and more parts of my toolchain as I would find that every package related to code dev on the Canonical repositories is incredibly out-of-date!

(note: Mint probably has this same issue as well, since their releases vaguely follow the Ubuntu LTS schedule)

You say you'd like to install everything yourself, but I can't really tell what you have in mind there. "Manually installing" something on Linux almost always means building it from source yourself, which is basically just a bunch of gruntwork of locating the source, RTFM, running a few commands, and, most importantly, installing all of its dependencies first (and all of their dependencies, etc.). That last point makes the process brutally tedious, and it is why you should let a package manager take care of this whenever it is humanly possible.

This is why I switched to Arch Linux.


Arch Linux is different. Here's the thing:

The problem of having outdated tools does not exist in Arch Linux, because it uses a rolling distribution model. Everything is up-to-date, all the time, so you always have the latest, greatest, (and buggiest!) software. The only reason I ever need to build anything myself is if the thing I'm trying to install is not too popular yet.

However, Arch is also not for beginners. If you try Arch out right now, it'll basically be sink or swim, and you'll need to learn a lot of Linux before you get to any Rust. The Arch installation process is 100% CLI driven. A minimal arch install will plop you into a terminal with virtually nothing at all (at which point you'll probably discover that you forgot to install tools for WiFi or something and will have to switch back to the Live USB).

That doesn't mean you can't start with Arch. I know a couple of people who started with Arch basically as a sort of rite of passage. They seemed to turn out alright. (a bit pompous, perhaps, for some of them, but this was in high school!)

After installing it, you'll be able to install any desktop environment you like; even the one from Mint. (I've been trying out KDE plasma lately, but good heavens is it buggy)

4 Likes

Others have commented about switching to Linux, which I agree with(didn't read heavily tho), so I'll skip commenting on your switch of OS.

I absolutely have to say that is a really big switch. I tried learning Rust a year or two ago, but didn't actually pick it up successfully until I played with a somewhat similar language for a while(used OCaml for a roughly a year before picking up Rust properly).

Ditto. Maybe just first focus on using Linux with your last favourite programming language and doing everyday stuff, then add Rust to the formula after a while.

Some resources you may find helpful

  • Thread about IDEs and stuff
  • If you're thinking about going with Emacs, I'd recommend spacemacs(especially if you like vim binding), or anything more ergonomic by default. Last time I used vanilla Emacs I almost wore my pinkie out entirely in a day.

A lot of great comments. Let's see if I can catch the highlights.

First - why Rust? The memory safety is really important but it goes further than that. There is something about the ownership and borrowing that seems like is was tailor made for the way this project needs to operate. Like someone created the language just for me. Weird. Without going into the details, nodes in this computational mesh have very limited knowledge of global states and receive and operate on data in a manner that requires the rest of the mesh to "not care" what the results of those operations are. In something like C, it would be extraordinarily easy to alter data in ways that corrupt the states of nodes far outside the "awareness" of the node performing the operations.

I agree. I think the first step is to focus more on Linux. Try out a few text editors, research mor on debuggers and wrestle with basics.

Outdated tools are part of what I ran into setting up rust on my first try. But it sounds like Arch might be a stretch right now. I'll keep it in the back of my mind. One thing I have to keep in mind is that this will result in production code that will be distributed to end users. So the nightly tool chain may become problematic once it gets that far. But I may be thinking too far ahead.

I've already looked at VSCode. It might be the better choice over EMACS. I really don't want a heavy IDE. One of the things I don't like about Visual Studio is that it is so damn fat and bloated. Net Beans is heavy. Eclipse not as bad as those two. Since I'm not doing a GUI around this kernel, a light weight tool set is more suitable. A good text editor and debugger is enough. I like how Clippy adds another layer of checks to writing good code.

I'm thinking Python to cut my teeth on. I did do some limited Python programming a few years ago, It was fun and it was actually easy to learn so I think I'll play with a few editors and get a feel for how they work debugging and managing files. I'm leaning towards VSCode, Emacs or Gnome Builder

3 Likes

Just to clarify, Arch won't pin you to nightly rust. Actually, the rust experience should be pretty much the same in any Linux distribution so long as you use rustup (which you should, because it is awesome):

  • You check your distribution has a package for rustup. If it does, install it, and your package manager will manage rustup (but not rust itself). If not, go to https://www.rustup.rs/ and install.
  • rustup default stable to install the latest stable and make it the default.
    (note: your package manager may have done this for you)
  • You can also rustup toolchain add nightly (you'll need it for clippy).
    Then cargo +nightly [ARGS]... will let you temporarily switch to nightly for a single build.
  • At any time later, you can use rustup update to update to a new stable or nightly.
1 Like

I would recommend getting familiar with Linux with a "stable" distribution like Mint before moving to rolling releases. The reason is that there is one major counterpart to the "freshness" of rolling release distributions, and that is reduced reliability. Upgrades are much less tested in the rolling world, and from time to time (not too often thankfully) you will see one that breaks your system, generally by being incompatible with proprietary software that you need to use such as the NVidia graphics driver. When that happens, you must be ready to fix it, and that can require significant background knowledge of the underlying system.

With that disclaimer, there is an interesting middle-ground between the user-friendliness of Mint and the hardcore-geekiness of Arch, which is openSUSE Tumbleweed. It is a rolling release which tries to retain many of the graphical conveniences of popular stable-release distros, and adds to that several useful tools that enhance the rolling release experience such as a more extensive automatic QA infrastructure before packages are accepted, or an automatic system snapshot mechanism in the spirit of Windows System Restore. As a drawback, it is less popular than other rolling releases such as Gentoo or Arch, so you will need to use the annoying "manually build packages" approach relatively more often.

Personally, I have found it to be my favorite Linux distro compromise so far. It allows me to use the latest software, it doesn't break too often, and when it does it is relatively easy to fix ("snapper rollback" now, investigate more later). This allowed me to use it as my daily driver both at home and at work, where I would never have dared that with Gentoo or Arch due to traumatic memories of that one time where a bad package update completely broke one of my systems.

But again: still not a beginner distribution. It is best to stick with the likes of Ubuntu and Mint while you are getting comfortable with the OS, as stability is an invaluable property at this stage of the learning process.

2 Likes

You could use Visual Studio Code which runs on Windows/Linux/Mac and has nice support for Rust. That way you might be able to stay on Windows at least to start with. It's a quick start - install vscode, rustup, and use the extension manager in vscode to install the rls plugin and you are good to go.

I often write code that I am intending to deploy on Linux on a Windows machine and use WSL (Windows Subsystem for Linux) to run the tests as I am working. I use the Ubuntu image in WSL which works well.

It will depend a lot on what your code needs to interface with, but pretty much everything I work on in Rust will run on Linux/Windows/Mac with essentially no porting.

I'm not a big python user, but I think virtualenv will let you (effectively) create an isolated python installation with a specific set of packages installed.

2 Likes

Hi, @BobC,

Yes, you've definitely taken on a big task in a new language in a new environment! It's a lot, to be sure.

I don't know if it's too late, but in the interest of trying to make things just a bit easier on yourself, have you considered using Windows as your development environment, since you are more familiar with it?

If you really want to learn Linux, you can eventually fire up the Windows Subsystem for Linux, which is an officially supported Ubuntu Linux environment on Windows, but for the time being, you can get going in a more familiar, traditional Windows environment.

I develop on Windows 10 for a client, and IIRC, it was a three-step process to get things going.
Here is what I am thinking might be good for you:

  1. Install the MinGW/MSYS2 toolchain as outlined here (since you will likely be working with GNU (Linux) based libraries). Rust needs to use the linker from this toolchain to create binaries.

  2. Intall rustup: here is the 64-bit Windows/GNU installer. (That should be the right installer for a modern Windows installation, but if not, you can select your installer from here.) I strongly recommend installing rustup (as opposed to via a package manager, regardless of which platform you are on).

  3. Install Visual Studio Code with this Rust extension and you should be all set.

Feel free to ask lots of questions here, on gitter or on the #rust-beginners IRC channel--you'll find the community very open and incredibly helpful. You are not alone! :slight_smile:

Take care, and all the best, @BobC,
U007D

2 Likes

I can echo this sentiment. The breakage is real. Even though I've only been using Arch for a year, I can already recall two breakages that I never would have been able to work through without at least a few years of experience with Linux. Recommending Arch to a beginner really is a bad idea.

Ah! It appears I have been living under a rock for the last couple of years!

Looking into it, it appears that this is some sort of Linux emulation layer, kind of like Wine in reverse? There's a couple of distributions to choose from on the Windows store, and they do include package management. IIUC, programs built for the WSL target the Linux platform, as opposed to on MinGW/msys where they would target Windows.

Indeed, it sounds like this could be a convenient, fairly non-committal way for a learner to get the Linux experience on Windows.

That said, the main reason that I personally use Linux for everyday use is because the window managers available for it are so powerful; despite the name, it still feels like Windows was never designed to support having more than one (or I guess two, now) windows open at once. So while you do not need to make the switch, I still feel that anybody who seriously wants to be productive should consider taking a serious go at Linux eventually.

2 Likes

@ExpHP WSL does indeed include the package management. It's a better marriage of Linux and Windows than MinGW or Cygwin, IMHO, but if you want to build native Windows apps under WSL, I believe you will be cross-compiling, yes.

But what is interesting is you can launch Windows executables from WSL. So if you want to build Windows binaries, at least in theory, you could set your Rust config to default to cross-compile to Windows, and launch your .exe's transparently? (Disclaimer: I've never tried this.)

I brought this up merely to let @BobC know that learning Linux isn't mutually exclusive with building on Windows... @BobC can start with a traditional Windows environment, where they stated they have more background and easily migrate to Linux later, whenever the time is right.

A few of you have recommended learning Rust in a Windows environment since I'm already familiar with it. Normally I would agree wholeheartedly, but if this project comes together, it will be at least partially open source and operating within the cryptocurrency/blockchain ecosystem which strongly leans to the Linux side of The Force. And we are planning on scaling up the proof of concept onto a Beowulf Cluster. I will end up leading the tech team and they are going to most likely be a Linux shop first and Windows/Mac second. So I need to be able to work well with Linux adepts even if I'm just competent with the OS. So I need to bite the bullet.

Yes, but, if you get it working/developed in Windows, it will be easy to port to Linux. Rust cross-compiles really well and easily.

Sounds fair, then yeah, choosing the path with the least resistance to begin with is best, otherwise you will absolutely get burned out very quickly.

Ubuntu, Fedora, Linux Mint, OpenSUSE, and other more user friendly distros are very good to start with. Most distros share a lot of common software, so you don't have to worry about switching between distros too much.

Arch does not end up being very usable even after years of use, unless you write your own installer suite(mine), or use a Arch based distro with nice installer(e.g. Manjaro). So unless you absolutely want heavy customizations, not much need to look into Arch/Gentoo/etc.

One good thing about working on Linux is that you will almost always be able to debug errors thanks to quite explicit error messages, and Googling "How do I ... Linux?" practically works all the time(you will find a blog/article, or a stackoverflow answer about whatever you want to do).

Otherwise you can always ask in the forum of your distro or reddit, usually people are pretty friendly.

Nope. I actually invented and hold the patent for the computational mesh. I was expecting that the hard core coding would be done by others, Turns out it isn't working out very well that way so I need to resurrect my programming skills. It's a long story. But truthfully, I prefer doing it this way instead of spending so much energy talking to investors and business development organizations. I'm handing that off to someone else with better soft skills.

5 Likes

Maybe, since I've never been a brilliant coder. But I understand how this mesh works better than anyone since I invented it.

1 Like

That is just a matter of perspective I would say. Installing in Windows used to be simpler in comparison, but recently I think the Linux way is actually simpler. Look up a package in package manager, tell package manager you want the package installed, and then it downloads the package for you, installs it, sets it up, and keeps it up-to-date for you... All of it is automated, very simple to use. As long as the package is part of the distro's repos, it's probably going to be very very easy to install. (If it's not, then it depends.) On Windows, in constrast, you have to obtain an installer, run it granting it admin privileges, click through several screens, uncheck installation of Ask Toolbar or somesuch... And then the udate process (or rather thereof) is whole another matter...

Linux isn't hard or uncomfortable, at least not anymore. It's just different / unfamiliar...

3 Likes

I think you are biting off way too much. First, your choice of Rust: you say you chose it because of memory safety and it runs on multiple platforms. Do you understand that there are multiple ways to achieve memory safety and Rust is the most difficult in terms of the burden it places on the programmer? Garbage collected languages like Go, Nim, Haskell, Ocaml, etc., all run on a variety of platforms and provide memory safety (and compile-time type safety due to static typing) without getting you into the demands that Rust will make on you. I have written code in most of the languages I've cited, as well as Rust, and I am a deeply experienced programmer (=old) and Rust is by far the most difficult to master and there are some things that are almost impossible to do in Rust (see the thread I started on caching prepared sqlite statements; I got a lot of help from some smart people who contribute to this list and I've finally concluded that it just isn't worth it, as well as concluding that doing this without static global state, at least with the sqlite crate, is impossible, whereas it is trivial in any of the other languages I cited; I should probably send another message to that thread explaining why I reached that conclusion). So unless you have a specific reason for needed memory safety without a garbage collector, I would avoid Rust, given your long hiatus from programming. If you haven't driven a car in a long time, a Formula One car is not the way to become reacquainted. And almost no one needs a Formula One car for daily transportation (where would you put the groceries?).

I would also comment that while memory safety and thread safety are important, the most challenging part of programming is at the forest level, not the trees. Properly organizing a large piece of software is difficult and getting the algorithms right is essential for good performance. In most cases, the latter has a greater influence on the ultimate performance of your application than the particular language you choose, especially on today's hardware, unless you try to do something that is inherently computationally very intense in an interpreted language. I would recommend reading Structure and Interpretation of Computer Programs (Sussman, Abelson and Sussman) for an eye-opening course on how to use abstraction techniques to divide and conquer the problem of software organization. I'm not necessary advocating using Scheme, though you could do worse (I highly recommend Chez Scheme -- open-source (now), rock-solid and very fast). Most of the techniques discussed in that book are not language-specific.

Second: Linux. I'd recommend Debian. I'm typing this on an Arch system, but the comments about Arch (by HadrienG) are right on the mark. Sometimes the rolling release strategy will result in breakage. Debian is extremely stable and not as bloated as Mint (Mint is based on Ubuntu which is based on Debian). You won't get the latest and greatest version of everything, but you can compile things from source or load static binaries in some cases to get later versions of things where that is necessary.