博客首页 » Lang Rust在XP安装与编译
发布于 15 Sep 2015 09:09
标签 blog
Rust是Mozilla的优秀语言,可惜它不支持在XP编译。可是实在想在XP上用Rust的我怎么办呢。只能通过曲线救国——VM,我们可以很容易地在XP中使用VmWare安装Linux的rustc。
- 安装VMWare Player
- 安装CentOS6 Minimal x86
- 安装Rust
- curl -sSf https://static.rust-lang.org/rustup.sh | sh (里面需要sudo权限,如果需要密码,需要很快地输入,所以还是一开始就用root执行稳妥)
- 安装gcc
- yum -y install gcc
这里还有一个小插曲,当万事俱备以后,做一个测试程序
hello.rs
fn main() {
println!("Hello world!");
}
执行
rustc hello.rs
./hello
但是执行会出现
panicked at 'cannot access a TLS value during or after it is destroyed', ../src/libcore/option.rs:330
fatal runtime error: Could not unwind stack, error = 5
Illegal instruction
这是因为linker的一个bug,解决方法如下:
- 升级binutils到2.25
详细的信息在这里:
https://users.rust-lang.org/t/illegal-instruction-when-i-run-main-rs/2199/9
Well, the issue has been closed as "basically a linker bug we can't do much about".
I updated binutils on my CentOS 6.6 machine which made the problem go away.
These are the steps I did:
wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz3
tar xvfz binutils-2.25.tar.gz
cd binutils-2.25
./configure
make
make installThis last step (make install) I did as root (or you can sudo).
本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用,仅有一个特殊要求,请用链接方式注明文章引用出处及作者。请协助维护作者合法权益。
系列文章
文章列表
- Lang Rust在XP安装与编译
这篇文章对你有帮助吗,投个票吧?
留下你的评论