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

时间:2014-05-07 10:23:59

标签: linux mingw mingw-w64

我想建立MinGW-w64,其中:

答:我想在Linux(64位)上编译MinGW本身 B:我希望MinGW工具(编译器等)在Linux(64位)上运行 C:我希望MinGW工具(编译器等)生成在Windows 64位(Win7和Win8)上运行的代码。

我在配置阶段遇到了麻烦。我已经google了一下,但我找不到我需要传递给配置的选项。

我已经从(https://svn.code.sf.net/p/mingw-w64/code/trunk/)下载了MinGW-w64 SVN的源代码。 (AFAICT这是目前的官方回购)。

源代码有一个文本帮助(mingw-w64-doc / howto-build / mingw-w64-howto-build.txt)。但是,这主要适用于那些想在Windows上运行MinGW工具的人 示例选项(对于非multilib w64目标)是:

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

但我想我希望主机选项引用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为Windows 7/8 64位(包括D3D11和OpenGL)生成C ++ 14代码。
我想构建主干MinGW,因为最新的Clang产生的默认MinGW无法组装的汇编代码(主要是“行尾的垃圾”错误)。 截至2014-05-07(今天),只有Clang提供完整的C ++ 14支持,我正在使用仅在Clang中提供的功能(例如:变量模板)。
然而,Clang依靠GCC / MinGW进行组装和链接。

的信息: 操作系统:Linux Mint 16 64位(XFCE)。

感谢您的帮助。

2 个答案:

答案 0 :(得分:4)

老问题,但答案可能对来自谷歌的人有所帮助。

主机和构建标志有点误导。来自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位窗口,包括32位和64位库以及std :: experimental功能的方法是:

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

如果您想构建32位窗口,它非常相似,但当然您无法启用64位模式:

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

答案 1 :(得分:0)

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 中,

最后

./configure 在文件夹 ../x86_64-w64-v8.0.0/mingw-w64-libraries/winpthreads 中。

我没有手动验证整个过程,因为这个 shell 文件就完成了。