You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在MinGW-w64环境下使用gccrs编译Rust程序时无法找到core crate的解决方法求助

在MinGW-w64环境下使用gccrs编译Rust程序时无法找到core crate的解决方法求助

我最近成功在基于MinGW-w64的原生Windows版GNU Compiler Collection(GCC)发行版中编译出了GCC Rust编译器(gccrs),运行gccrs.exe --version得到的输出如下:

gccrs.exe (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 16.0.1 20260308 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

不过当我尝试用它编译一个简单的测试程序时,却遇到了问题。我用的编译命令是这样的:

GCCRS_INCOMPLETE_AND_EXPERIMENTAL_COMPILER_DO_NOT_USE=1
echo -e 'fn main() {\nprintln!("Hello World!");\n}\n' |
 gccrs.exe -xrust - -o test.exe && rm test.exe

执行后得到了如下错误:

crab1.exe: error: failed to locate crate 'core'
crab1.exe: error: unknown crate 'core'
crab1.exe: error: unknown crate 'core'
-:2:1: error: could not resolve macro invocation 'println' [E0433]
crab1.exe: error: unknown crate 'core'

请问有没有办法在不依赖rustc.exe的前提下解决这个问题,让测试程序能正常编译运行?

备注:内容来源于stack exchange,提问作者Brecht Sanders

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 18:33:08