Mingw-w64-g++跨编译错误,不兼容的库

huangapple go评论58阅读模式
英文:

Mingw-w64-g++ cross compilation error incompatible libraries

问题

我正在尝试使用x86_64-w64-mingw32-g++-m32选项交叉编译为32位Windows。我只使用标准库,没有额外的内容。

我得到了这个输出:

x86_64-w64-mingw32-g++ -m32 *.cpp -o ../build/rook-win-x86.exe -O3 -Wall 
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lstdc++时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.dll.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lstdc++时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lstdc++时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lstdc++时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.dll.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lstdc++时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a
/usr/bin/x86_64-w64-mingw32-ld: 无法找到-lstdc++
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingw32时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmingw32.a
/usr/bin/x86_64-w64-mingw32-ld: 无法找到-lmingw32
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc_s时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc_s时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc_s时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a
/usr/bin/x86_64-w64-mingw32-ld: 无法找到-lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lgcc时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a
/usr/bin/x86_64-w64-mingw32-ld: 无法找到-lgcc
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmoldname时跳过不兼容的/usr/x86_64-w64-mingw32/lib/libmoldname.a
/usr/bin/x86_64-w64-mingw32-ld: 无法找到-lmoldname
/usr/bin/x86_64-w64-mingw32-ld: 在搜索-lmingwex时跳过不兼容的/usr/lib/gcc

<details>
<summary>英文:</summary>

I am trying to cross compile using `x86_64-w64-mingw32-g++` with the `-m32` option for 32bit windows. I am using the standard library only, nothing extra.

I am getting this output::

x86_64-w64-mingw32-g++ -m32 *.cpp -o ../build/rook-win-x86.exe -O3 -Wall
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.dll.a when searching for -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a when searching for -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a when searching for -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.dll.a when searching for -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libstdc++.a when searching for -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lstdc++
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lshell32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -luser32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lkernel32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingw32
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s.a when searching for -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc_s
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc.a when searching for -lgcc
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmoldname
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingwex
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /usr/x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lmsvcrt
collect2: error: ld returned 1 exit status


It seems the libraries are incompatible.

I found [this](https://stackoverflow.com/questions/30886645/mingw-w64-linker-skipping-incompatible-files-when-searching-for-third-party-stat) question which was about this issue. But the answer there was to use Microsoft&#39;s `link.exe` and I want to do it on linux only.

I tried installing `gcc-multilib` and `g++-multilib`. However that did not resolve it.

</details>


# 答案1
**得分**: 0

`-m32` 和 `-m64` 用于告诉 `gcc`/`g++` 你正在针对哪个版本的 Windows 进行编译,特别是在使用本地 MinGW-w64 编译器时。

在 Linux 上进行跨平台构建通常涉及在编译器工具之前添加平台的三元组。

因此,在使用 `g++` 时,使用 `i686-w64-mingw32-g++` 可以针对 Windows 32 位,而使用 `x86_64-w64-mingw32-g++` 可以针对 Windows 64 位。

<details>
<summary>英文:</summary>

The `-m32` and `-m64` are to tell `gcc`/`g++` which Windows you are targeting, especially when using native MinGW-w64 on Windows.

On Linux cross platform building usually involved prepending the compiler tools with the platform&#39;s triplet.

So in case of `g++` use `i686-w64-mingw32-g++` to target Windows 32-bit and `x86_64-w64-mingw32-g++` to target Windows 64-bit.

</details>



huangapple
  • 本文由 发表于 2023年4月4日 16:09:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926951.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定