Rust 语言的编译问题:从 'Hello World' 开始

Compiling issues with Rust language: starting with 'Hello World'

我正在使用 up2date Linux Mint 系统,我将其用于大量试错项目。 今天我偶然发现了 Rust 并想尝试一下。

到目前为止一切顺利。安装 Rust 简单易行。

使用建议的方法,设置环境变量并执行更新:

到目前为止一切顺利,没有错误或其他干扰信号。所以在我尝试之前,就像每个人一样,编译 'Hello world'-example。在这里它横盘整理。错误:

...
$ rustc main.rs
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" [....... ]"-lutil" "-lutil"
  = note: /usr/bin/ld: cannot find Scrt1.o: No such file or directory
          /usr/bin/ld: cannot find crti.o: No such file or directory
          collect2: error: ld returned 1 exit status
...

我的系统安装了cc: cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

有人知道我该如何解决这个问题吗?

我在其他 post for Clang 中找到了对我有用的答案:Compiling problems: cannot find crt1.o.

Dmitry Pavlenko 给出的答案对我来说也很好用:

The problem is you likely only have the gcc for your current architecture and that's 64bit. You need the 32bit support files. For that, you need to install

sudo apt install gcc-multilib