简体   繁体   English

如何指定交叉编译rustc时要使用的编译器?

[英]How do I specify the compiler to use when cross-compiling rustc?

When I compile rustc , there is a option in the configure script to specify other targets to the core libraries ( libcore , libstd , etc), so for example: 当我编译rustc ,configure脚本中有一个选项可以指定核心库( libcorelibstd等)的其他目标,例如:

./configure --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu

will compile and install the rustlibs for both these architectures. 将为这两种体系结构编译和安装rustlibs

My problem is that this command will use my default gcc to compile everything, (since my system is multilib, it will successfully compile to i686 too), but what I want is to use my toolchain compiler instead, so for example: 我的问题是这个命令将使用我的默认gcc编译所有内容,(因为我的系统是multilib,它也会成功编译到i686),但我想要的是使用我的工具链编译器,所以例如:

I have 2 toolchains in my amd64 system: i686-unknown-linux-gnu and arm-unknown-linux-gnueabi . 我的amd64系统中有2个工具链: i686-unknown-linux-gnuarm-unknown-linux-gnueabi

When I run configure with these parameters: 当我使用这些参数运行configure时:

./configure --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu,arm-unknown-linux-gnueabi

When compiling the rustlibs , I want the script to use x86_64-unknown-linux-gnu- gcc for x86_64 , and i686-unknown-linux-gnu- gcc for i686 and arm-unknown-linux-gnueabi- gcc for arm . 在编译rustlibs ,我希望脚本使用x86_64-unknown-linux-gnu- gcc for x86_64 ,i686-unknown-linux-gnu- gcc for i686和arm-unknown-linux-gnueabi- gcc for arm

That way the rustlib will be compiled using the glibc and other libraries from the toolchain and not the default from my system. 这样, rustlib将使用glibc和工具链中的其他库进行编译,而不是我系统的默认库。 Is that possible? 那可能吗?

它使用后缀环境变量指定:请参阅此处了解它们在CI中的作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM