本文介绍了我无法从Ubuntu交叉编译到Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想从Ubuntu到Windows交叉编译一些Rust代码,并收到关于onexitbegin的错误。

I Want To Cross Compile Some Rust Code from Ubuntu to Windows, and receive an error about onexitbegin.

试图遵循各种建议,但是他们没有我的特定错误消息:
crt2.o:crtexe.c:(.rdata $ .refptr .__ onexitend [.refptr .__ onexitend] + 0x0):对`__onexitend'的未定义引用
collect2:错误:ld返回1个退出状态

Tried to follow various suggestions, but they don't have my specific error message: crt2.o:crtexe.c: (.rdata$.refptr.__onexitend[.refptr.__onexitend]+0x0): undefined reference to `__onexitend' collect2: error: ld returned 1 exit status

cargo build --release --target x86_64-pc-windows-gnu

原本是要建造东西的,但它会炸毁。
输出显示以下内容:
/ usr / bin / x86_64-w64-mingw32-ld:/home/vince/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/ x86_64-pc-windows-gnu / lib / crt2.o:crtexe.c :(。rdata $ .refptr .__ onexitbegin [.refptr .__ onexitbegin] + 0x0):对 __ onexitbegin'$ b $的未定义引用b / usr / bin / x86_64-w64-mingw32-ld:/home/vince/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2。 o:crtexe.c :(。rdata $ .refptr .__ onexitend [.refptr .__ onexitend] + 0x0):未定义引用 __ onexitend'

Expected to get something built, but it blows up.The output says this:/usr/bin/x86_64-w64-mingw32-ld: /home/vince/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o:crtexe.c:(.rdata$.refptr.__onexitbegin[.refptr.__onexitbegin]+0x0): undefined reference to __onexitbegin' /usr/bin/x86_64-w64-mingw32-ld: /home/vince/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o:crtexe.c:(.rdata$.refptr.__onexitend[.refptr.__onexitend]+0x0): undefined reference to__onexitend'

推荐答案

如果您收到有关未定义引用的消息



__ onexitbegin`或类似的内容,则您可能具有较旧的crt2版本。 o,而不是ming可用的版本。我做到了! (在稳定的锈蚀1.35上运行)。

If you receive messages about an undefined reference to

__onexitbegin` or something similar, you may have an older version of crt2.o, instead of the version that ming has available to it. I did! (running on stable rust 1.35).

在您的终端中尝试一下,看看是否有帮助:

Try this in your terminal and see if it helps:

cd ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/

mv crt2.o crt2.o.bak

cp /usr/x86_64-w64-mingw32/lib/crt2.o ./

您的可执行文件现在应该为Windows构建。

Your executable should now be built for windows.

这篇关于我无法从Ubuntu交叉编译到Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 08:57