简体   繁体   English

如何使用 Cygwin64 和 Clang 构建 32 位应用程序?

[英]How to build a 32bit app using Cygwin64 and Clang?

I have successfully compiled and linked some C code with Windows+Cygwin64+Eclipse+LLVM toolchain.我已经成功编译并链接了一些 C 代码与 Windows+Cygwin64+Eclipse+LLVM 工具链。

I wanted to build a 32bit version, so I added -m32 flag to compiler and linker, but ended up with errors:我想构建一个 32 位版本,所以我在编译器和 linker 中添加了-m32标志,但最终出现错误:

/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/libcygwin.a when searching for -lcygwin
/usr/bin/ld: skipping incompatible /usr/lib/libcygwin.a when searching for -lcygwin
/usr/bin/ld: skipping incompatible /usr/lib/libcygwin.a when searching for -lcygwin
/usr/bin/ld: cannot find -lcygwin
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/bin/ld: cannot find -ladvapi32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/bin/ld: cannot find -lshell32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/bin/ld: cannot find -luser32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/bin/ld: cannot find -lkernel32
/usr/bin/ld: cannot find crtend.o: No such file or directory
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)

Is it possible to build a 32-bit app with 64-bit Cygwin?是否可以使用 64 位 Cygwin 构建 32 位应用程序?

You have to install the 32-bit versions of the libraries.您必须安装 32 位版本的库。 You have to install the package cygwin32-gcc-core to get all libraries+ the compiler.您必须安装 package cygwin32-gcc-core才能获取所有库+编译器。 Then you have to invoke gcc for 32 bit as i686-pc-cygwin-gcc , as gcc is normally a link to x86_64-pc-cygwin-gcc .然后你必须调用 gcc 为 32 位i686-pc-cygwin-gcc ,因为gcc通常是x86_64-pc-cygwin-gcc的链接。

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

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