4

Inside a msys2 mingw64 shell, I would like to compile a software with the -m32 option in order to run in 32bit mode.

I have installed mingw-w64-x86_64-toolchain

But when I compile with -m32, I have the following errors:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/lib\libmingw32.a when searching for -lmingw32
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingw32

I am thinking of a libraries installation issue, but I do not know how to find them.

2 Answers2

5

You can use the -m32 option if you use the gcc present in c:\mysys2\mingw32\bin.

If the folder is empty currently, go in:

  1. msys console.

  2. pacman -S mingw-w64-i686-toolchain and use this command.

Refer Subsystem section of this document for more information.

Bhaskar Jat
  • 51
  • 1
  • 3
2

I used the mingw32.exe shell also under c:\msys2 Under this I installed: pacman -S mingw-w64-i686-toolchain

Using gcc -m32 from the mingw64 bash shell seems to build i386 objs, (checking with objdump) but does not link sucessfully as you saw.