我如何交叉编译C code对Windows中的二进制也可以在Unix(的Solaris / HPUX / Linux)的运行? [英] How do I cross-compile C code on Windows for a binary to also be run on Unix (Solaris/HPUX/Linux)?
问题描述
我一直在寻找到 Cygwin的 /的称为Mingw / LCC 以及我喜欢能够编译在我的Windows的perl本机C扩展(preferably在cygwin下),然后在Solaris和HP UNIX运行它们没有任何进一步做文章,这可能吗?
I been looking into Cygwin/Mingw/lcc and I liked to be able to compile perl native C extensions on my windows(preferably under cygwin) and then run them on Solaris and HP unix without any further fuss, is this possible?
这都是从我原来的perl跨平台的问题<一茎href=\"http://stackoverflow.com/questions/570762/how-can-i-create-a-portable-perl-when-i-cant-install-modules-on-the-target-host\">here.
This all stems from my original perl cross-platform question here.
推荐答案
交叉编译器是很难建立,并得到正常工作。
Cross-compiler are very hard to setup and get working correctly.
考虑到(的人)的NetBSD要投入巨大的工作量让交叉编译工作,而他们正在运行相同的操作系统,只是不同的架构。
Consider that (the people at) NetBSD have to put in a huge amount of work to get cross-compiling to work, and they're running the same OS, just different architectures.
您不得不,至少,复制所有从其他操作系统到Windows头,并得到一个交叉编译器,连接器等为目标OS /架构。
You'd have to, at least, copy all the headers from the other OSs to Windows, and get a cross-compiler, linker etc for the target OS/architecture.
此外,可能也无法实现 - Perl和共享库可以与本地/非gcc编译器将无法在Windows在所有被编译。
Also that may well not be possible - perl and shared libraries may be compiled with a native/non-gcc compiler which won't be available on Windows at all.
这篇关于我如何交叉编译C code对Windows中的二进制也可以在Unix(的Solaris / HPUX / Linux)的运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!