简体   繁体   中英

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.

I wanted to build a 32bit version, so I added -m32 flag to compiler and linker, but ended up with errors:

/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?

You have to install the 32-bit versions of the libraries. You have to install the package cygwin32-gcc-core to get all libraries+ the compiler. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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