Note: This is not a duplicate, existing solution is obsolete (not working) as of Dec 2022
There is no package cygwin32-*
(anymore?) in Cygwin64
https://www.cygwin.com/packages/summary/cygwin32-gcc-core.html
404 Not Found
I use Cygwin to build our library and app on the Windows platform. This works fine, so far. But only 64-Bit (x64) version is created until now. We need to create 32-Bit (i686) DLL too, because some developers still create 32-Bit (i686) programs, so they need our DLL as 32-Bit (i686) version!
How do I do this with Cygwin?
The gcc
that comes with Cygwin64 (setup-x86_64.exe) only creates 64-Bit (x64) binaries, it appears. I tried switch -m32
, but will fail with some obscure errors; looks like some libraries are wrong:
$ make CC="gcc -m32"
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/11//libgcc_s.dll.a when searching for -lgcc_s
I also tried installing 32-Bit Cygwin (setup-x86.exe), but setup only shows a weird error message: Cygwin is not supported on 32-Bit Windows
But I try to install Cygwin on a 64-Bit Windows machine (Windows 10 22H2, fully patched), so this error message makes no sense to me! How to install Cygwin 32-Bit version?
I also found various sources claiming that Cygwin64 can cross-compile to 32-Bit and that I need to install the cross-compiler packages cygwin32-*
for that. But how do I do this? I tried to install those packages with the "setup-x86_64.exe" program, but can not seems to find them...
What am I missing?
Regards.
I tried to install 32-Bit Cygwin (setup-x86.exe), but it cannot install on my Windows 10 system.
Also I tried to cross-compile from Cygwin64 (x86_64) to 32-Bit (i686) platform, but it cannot find how to install the required cross-compiler packages (cygwin32-*
).
Minimal example:
Command to create 64-Bit (x64) DLL in Cygwin64 shell works fine:
$ gcc -shared -o test.dll -Wl,--out-implib test.dll.a dll_test.c
But this command to create 32-Bit (i686) DLL cannot work:
$ gcc -m32 -shared -o test.dll -Wl,--out-implib test.dll.a dll_test.c
Error messages:
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/11//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/11/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/11//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/11/libgcc_s.dll.a when searching for -lgcc_s
[...]
collect2: error: ld returned 1 exit status
dll_test.c
:
int test_function(void)
{
return 42;
}