2

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.

Louis Caron
  • 121
  • 4

2 Answers2

1

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.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 27 '21 at 20:25
0

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.

  • Could you link a reference please – Rohit Gupta Mar 21 '23 at 07:58
  • Actually, you need a multilib toolchain in order to build a 32-bit application in a 64-bit environment... https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ray_linn/ – Huy Pham Mar 24 '23 at 06:15