使用MinGW 64安装增强 - (Cygwin)

时间:2013-04-24 14:46:46

标签: c++ cygwin mingw-w64

我正在尝试安装boost库(1.53)以在Windows下的64位应用程序中使用它。但是,在尝试设置它时,我遇到了一系列错误,就像我以前使用MinGW32和较旧的boost版本一样......

现在,我在第一步仍然失败 - 执行./bootstrap.sh。返回以下错误:

mkdir bootstrap
gcc -o bootstrap/jam0 command.c compile.c constants.c debug.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
function.c: In function ÔÇścheck_alignmentÔÇÖ:
function.c:222:5: warning: cast from pointer to integer of different size
builtins.c:33:23: fatal error: sys/wait.h: No such file or directory
compilation terminated.
execunix.c:17:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
fileunix.c:98:17: fatal error: ar.h: No such file or directory
compilation terminated. 

当我运行bootstrap.bat时,Boost.Build会自行构建,但是我以后会遇到奇怪的错误。起初,我尝试将x86_64-w64-mingw32-gcc等可执行文件符号链接到gcc,但最终出现了大量的“拒绝访问”错误,所以我只是将x86_64-w64-mingw32-XX文件复制粘贴到简单的XX中.exe的。现在我可以开始正确的构建,但最终得到:

...failed gcc.archive bin.v2\libs\thread\build\gcc-mingw-4.5.3\debug\address-model-64\link-static\threading-multi\libboost_thread-mgw45-mt-d-1_53.a...
gcc.archive bin.v2\libs\thread\build\gcc-mingw-4.5.3\release\address-model-64\link-static\threading-multi\libboost_thread-mgw45-mt-1_53.a
System cannot find the path specified.
System cannot find the path specified.

我发现,它试图使用类似Win的路径斜杠(/ vs \),并且可能因为它而失败。

我不想使用MSVC,因为我试图尽可能地保持我的代码的可移植性,同样对于它是64位也是至关重要的。

提前致谢。

1 个答案:

答案 0 :(得分:1)

这看起来像是Cygwin安装中丢失的文件。尝试再次运行安装程序并确保为gcc编译器(Cygwin,而不是MinGW64)安装了所有内容。 我成功运行了bootstrap.sh,使用默认的Cygwin gcc编译器编译了bjam。在那之后,我遇到了几个减速带,但是MinGW64编译得很好。我在tools \ build \ v2 \ user-config.jam中添加了编译器可执行文件,如下所示:

using gcc : 4.5.3 : x86_64-w64-mingw32-gcc.exe ;

我最终得到了以下命令行:

./b2 --toolset=gcc target-os=windows --build-dir=/cygdrive/c/whatever/boost_build variant=debug,release link=static runtime-link=static architecture=x86 address-model=64 threadapi=win32 --layout=tagged --without-mpi --stagedir=lib/win64gcc -j4 stage

...然后我和link=shared runtime-link=shared尝试了相同的操作,但是我还有很多编译错误,我还没想到。

可能对您有所帮助的一些链接:

编辑: 我最终使用的MinGW64 TDM比Cygwin MinGW64更容易,因为它不是交叉编译器。只需安装MinGW64 TDM,添加MSYS,完成! Boost编译没有任何问题。

相关问题