首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >铁锈在x86机上编译x86_64库

铁锈在x86机上编译x86_64库
EN

Stack Overflow用户
提问于 2018-11-27 09:48:54
回答 1查看 6K关注 0票数 1

我有ubuntu x86_64容器,cargo build运行得很好。但我也需要构建x86库版本。据我所知,我需要添加i686工具链和目标。

代码语言:javascript
复制
rustup target add i686-unknown-linux-gnu done successful
代码语言:javascript
复制
rustup toolchain install stable-i686-unknown-linux-gnu finished with error
代码语言:javascript
复制
$ rustup toolchain install stable-i686-unknown-linux-gnu
info: syncing channel updates for 'stable-i686-unknown-linux-gnu'
info: latest update on 2018-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'

  stable-i686-unknown-linux-gnu installed - (error reading rustc version)

代码语言:javascript
复制
$ rustup  default stable-i686
info: using existing install for 'stable-i686-unknown-linux-gnu'
info: default toolchain set to 'stable-i686-unknown-linux-gnu'

  stable-i686-unknown-linux-gnu unchanged - (error reading rustc version)

我是错过了什么还是走错了路?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-27 09:52:00

不必更改您的工具链,您必须将目标添加到当前的工具链中(确保首先切换回原来的工具链)。

代码语言:javascript
复制
$ rustup target install i686-unknown-linux-gnu
$ cargo build --target=i686-unknown-linux-gnu

当然,您也需要在您的系统上安装32位库,例如在ubuntu上安装它们。

代码语言:javascript
复制
$ sudo apt install gcc-multilib

(有关此的更多信息,请参见How to Compile 32-bit Apps on 64-bit Ubuntu?)

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53496847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档