配置在linux-64上为linux-64构建MinGW-64的选项(最终目标是windows-64)

nsc4cvqm  于 2023-03-22  发布在  Linux
关注(0)|答案(4)|浏览(515)

我想构建MinGW-w 64,其中:
答:我想在Linux(64位)上编译MinGW本身。
B:我希望MinGW工具(编译器等)在Linux(64位)上运行。
C:我希望MinGW工具(编译器等)生成在Windows 64位(Win7和Win8)上运行的代码。
我在配置阶段遇到了麻烦。我在谷歌上搜索了一下,但我找不到我需要传递配置的选项。
我已经从(https://svn.code.sf.net/p/mingw-w64/code/trunk/)下载了MinGW-w 64 SVN的源代码。(AFAICT这是当前的官方回购)。
源代码有一个文本帮助(mingw-w64-doc/howto-build/mingw-w64-howto-build.txt)。然而,这主要是为那些想要在Windows上运行MinGW工具的人准备的。
示例选项(对于非multilib w 64目标)如下:

--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-multilib

但是我想我希望host选项引用linux(对吧?)

--host=x86_64-linux-gnu

--host=x86_64-pc-linux-gnu

但没有运气。
我得到错误:

configure: error: Please check if the mingw-w64 header set and the build/host option are set properly.

configure: error: ../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-crt/configure failed for mingw-w64-crt

完整的日志是

checking whether to enable maintainer-specific portions of Makefiles... no
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    /make/tool/MinGW/svn/mingw-w64-v6615-2014-05-07/build-aux/missing: Unknown `--is-lightweight' option
    Try `/make/tool/MinGW/svn/mingw-w64-v6615-2014-05-07/build-aux/missing --help' for more information
    configure: WARNING: 'missing' script is too old or missing
    checking for x86_64-linux-gnu-strip... no
    checking for strip... strip
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking whether to build the headers... yes
    checking whether to build the crt... yes
    checking whether to build the optional libraries... no
    checking whether to build the optional tools... no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    === configuring in mingw-w64-headers (/make/tool/MinGW/build/v6615-2014-05-07/mingw-w64-headers)
    configure: running /bin/bash ../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-headers/configure --disable-option-checking '--prefix=/make/tool/MinGW/use/v6615/x86_64-w64-mingw32'  '--target=x86_64-w64-mingw32' '--host=x86_64-linux-gnu' '--disable-multilib' '--with-sysroot=/make/tool/MinGW/use/v6615/x86_64-w64-mingw32' 'host_alias=x86_64-linux-gnu' 'target_alias=x86_64-w64-mingw32' --cache-file=/dev/null --srcdir=../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-headers
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    /make/tool/MinGW/svn/mingw-w64-v6615-2014-05-07/mingw-w64-headers/build-aux/missing: Unknown `--is-lightweight' option
    Try `/make/tool/MinGW/svn/mingw-w64-v6615-2014-05-07/mingw-w64-headers/build-aux/missing --help' for more information
    configure: WARNING: 'missing' script is too old or missing
    checking for x86_64-linux-gnu-strip... no
    checking for strip... strip
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for a sed that does not truncate output... /bin/sed
    checking whether to rebuild headers with widl... no
    checking whether to build a w32api package for Cygwin... no
    checking for c-runtime headers... yes
    checking for optional sdk headers... ddk,directx
    checking if installing idl files is enabled... no
    checking whether to enable the secure API... no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating crt/_mingw.h
    config.status: creating config.h
    config.status: config.h is unchanged
    === configuring in mingw-w64-crt (/make/tool/MinGW/build/v6615-2014-05-07/mingw-w64-crt)
    configure: running /bin/bash ../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-crt/configure --disable-option-checking '--prefix=/make/tool/MinGW/use/v6615/x86_64-w64-mingw32'  '--target=x86_64-w64-mingw32' '--host=x86_64-linux-gnu' '--disable-multilib' '--with-sysroot=/make/tool/MinGW/use/v6615/x86_64-w64-mingw32' 'host_alias=x86_64-linux-gnu' 'target_alias=x86_64-w64-mingw32' --cache-file=/dev/null --srcdir=../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-crt
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for x86_64-linux-gnu-strip... no
    checking for strip... strip
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for sysroot... /make/tool/MinGW/use/v6615/x86_64-w64-mingw32
    checking for a sed that does not truncate output... /bin/sed
    checking for gawk... (cached) gawk
    checking for x86_64-linux-gnu-gcc... x86_64-linux-gnu-gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether x86_64-linux-gnu-gcc accepts -g... yes
    checking for x86_64-linux-gnu-gcc option to accept ISO C89... none needed
    checking whether x86_64-linux-gnu-gcc understands -c and -o together... yes
    checking for style of include used by make... GNU
    checking dependency style of x86_64-linux-gnu-gcc... gcc3
    checking for x86_64-linux-gnu-g++... x86_64-linux-gnu-g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether x86_64-linux-gnu-g++ accepts -g... yes
    checking dependency style of x86_64-linux-gnu-g++... gcc3
    checking how to run the C preprocessor... x86_64-linux-gnu-gcc -E
    checking for x86_64-linux-gnu-ranlib... no
    checking for ranlib... ranlib
    checking for x86_64-linux-gnu-dlltool... no
    checking for dlltool... no
    checking for x86_64-linux-gnu-ar... no
    checking for x86_64-linux-gnu-lib... no
    checking for x86_64-linux-gnu-link... no
    checking for ar... ar
    checking the archiver (ar) interface... ar
    checking dependency style of x86_64-linux-gnu-gcc... gcc3
    checking for x86_64-linux-gnu-as... no
    checking for as... as
    checking whether to build a w32api package for Cygwin... no
    checking whether to build the Win32 libraries... no
    checking whether to build the Win64 libraries... yes
    checking whether to build the WinCE libraries... no
    checking whether to enable globbing... no
    checking whether to enable private exports... no
    checking whether to enable delay import libs... no
    checking whether to enable experimental features... no
    checking whether the compiler supports -municode... no
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking _mingw_mac.h usability... no
    checking _mingw_mac.h presence... no
    checking for _mingw_mac.h... no
    configure: error: Please check if the mingw-w64 header set and the build/host option are set properly.
    configure: error: ../../../svn/mingw-w64-v6615-2014-05-07/mingw-w64-crt/configure failed for mingw-w64-crt

注意:我可以成功地从源代码编译本地GCC和Clang。
目的:我的最终目标是使用最新的Clang为Windows 7/8 64位(包括D3 D11和OpenGL)生成C14代码。
我想构建 Backbone.js MinGW,因为最新的Clang生成默认MinGW无法汇编的汇编代码(主要是“行尾垃圾”错误)。
截至2014-05-07(今天),只有Clang提供完整的C
14支持,我正在使用仅在Clang中可用的功能(例如:可变模板)。
然而,Clang依赖GCC / MinGW进行组装和链接。
配置信息:操作系统:Linux Mint 16 64-bit(XFCE).
感谢所有的帮助。

uidvcgyl

uidvcgyl1#

老问题,但答案可能会帮助那些来自谷歌。
主机和构建标志有点误导。来自mingw-w64-crt/configure --help帮助页面的信息显示:

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

所以我们不想修改--build,而是指定要与--host交叉编译的windows系统。
因此,为64位Windows构建并包含32位和64位库以及std::experimental特性的方法是:

./configure --enable-lib32 --enable-lib64 --enable-experimental --host=x86_64-w64-mingw32

如果你想为32位windows构建,这非常相似,但当然你不能启用64位模式:

./configure --enable-lib32 --enable-experimental --host=i686-w64-mingw32
4xrmg8kj

4xrmg8kj2#

https://github.com/Zeranoe/mingw-w64-build
我想你的答案在这里:
./mingw-w64-build x86_64用于64位;

./mingw-w64-build x86_64 i686为32位。
我在配置时遇到了同样的错误。在阅读mingw-w64-build这个文件中的shell后,我想你必须执行:
./configure在文件夹../x86_64-w64-v8.0.0/mingw-w64-headers中,
那么
./configure在文件夹../x86_64-w64-v8.0.0/mingw-w64-crt中,
最后
../x86_64-w64-v8.0.0/mingw-w64-libraries/winpthreads文件夹中的./configure
我没有手动验证整个过程,因为这个shell文件只是完成了这项工作。

7bsow1i6

7bsow1i63#

也许你可以试试这个--这是mingw的最新版本,你不必自己编译它:
https://github.com/Zeranoe/mingw-w64-build
它支持几乎所有的发行版。

xpcnnkqh

xpcnnkqh4#

看来你忘记安装头文件了,看看怎么编译吧。在编译crt之前有三个步骤。前两个步骤,需要gcc和binutils的源代码。你应该用x86_64-w 64-mingw 32选项编译它们来构建交叉编译器。如果你不想编译它们,只想直接编译crt,你可以下载当前的Mingw-w 64版本。

相关问题