c++ - 使用 MinGW 64 安装 boost - (Cygwin)

标签 c++ cygwin mingw-w64

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

现在,我在第一步 - 执行 ./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 等可执行文件符号链接(symbolic link)到 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 位的也很重要。

提前致谢。

最佳答案

这看起来像是您的 Cygwin 安装中缺少文件。尝试再次运行安装程序并确保为 gcc 编译器(Cygwin,而不是 MinGW64)安装了所有东西。 我成功运行了 bootstrap.sh,bjam 使用默认的 Cygwin gcc 编译器编译得很好。在那之后,我遇到了一些减速带,但使用 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 编译没有任何问题。

关于c++ - 使用 MinGW 64 安装 boost - (Cygwin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16195039/

相关文章:

C++:g++ 编译器:stdio 与虚函数的冲突?

c - mingw 是否允许在没有 page_execute 的情况下执行字节数组?

python - 为什么 Python 扩展模块需要在 Windows 上用 MSVC 编译?

c++ - GCC 声明友元函数重载,调用不明确,clang 编译

c++ - 64位架构优化

c++ - 将一维数组视为二维数组

c++ - 如何在第 32 周的 Guru 中实现 DERR_ENTRY 宏?

bash - 排序 |独特 | xargs grep ... 其中行包含空格

Perl Cygwin 很有趣。模块已加载,但程序未找到

c++ - CLion Windows 中的 clang++,如何使用 MinGW--w64 而不是 Windows VC 运行?