简体   繁体   English

如何在Windows中使用MASM构建Boost(来自github)?

[英]How to build Boost (from github) with MASM in Windows?

Last year Boost (from the modular boost git repository) could be built in Windows using these steps . 去年,可以使用以下步骤在Windows中构建Boost(来自模块化boost git存储库)。

I got quite far almost a year later, using this recipe: 差不多一年后,我使用了这个食谱:

  1. Install MinGW (32-bits) and Msys (bash etc) using mingw-get-setup 使用mingw-get-setup安装MinGW(32位)和Msys(bash等)
  2. Install the Windows Driver Kit (for W7 I used WDK 7 -- GRMWDK_EN_7600_1.ISO ), which provides MASM 8 (needed for boost > 1.51 according to this post ) 安装Windows驱动程序工具包(对于W7,我使用了WDK 7- GRMWDK_EN_7600_1.ISO ),该工具包提供了MASM 8(根据这篇文章 ,boost> 1.51时需要)
    -downloading the ISO image and extracting the files with WinRAR worked for me -下载ISO映像并使用WinRAR提取文件对我有用
    -the installer advises against installing the DSF, so skip that -安装程序建议不要安装DSF,因此请跳过
    -add the directories of ML64.exe and ML.exe to the path (both required) -将ML64.exe和ML.exe的目录添加到路径中(两者均为必需)
    C:\\Windows\\WinDDK\\7600.16385.1\\bin\\x86\\amd64; C:\\Windows\\WinDDK\\7600.16385.1\\bin\\x86
  3. Install a 64/32-bit compiler as well (I used TDM gcc 5.1.0-2 ) and 同时安装64/32位编译器(我使用了TDM gcc 5.1.0-2 ),并且
    add its bin/ directory to the Windows path 将其bin/目录添加到Windows路径
  4. open cmd.exe as administrator and start bash 以管理员身份打开cmd.exe并启动bash
  5. in the parent dir of boost , run boost的父目录中,运行
    git clone --recursive https://github.com/boostorg/boost.git boost > clone.log
  6. exit bash, goto directory boost and run: 退出bash,转到目录boost并运行:
    bootstrap gcc
  7. in project-config.jam , change using msvc ; project-config.jamusing msvc ;更改using msvc ; into using gcc ; using gcc ;
  8. run: 跑:
    b2 headers (now needed to make symbolic links) b2 headers (现在需要进行符号链接)
    b2 -a -d+2 -q --build-type=complete --build-dir=build toolset=gcc link=shared runtime-link=shared threading=multi

These options to b2 worked with previous versions of boost, but now I can only compile with b2 without options. 这些对b2选项可以与早期版本的boost一起使用,但是现在我只能使用不带选项的b2进行编译。 The full command line returns these errors: 完整的命令行返回以下错误:
undefined reference to __imp_make_fcontext and undefined reference to __imp_make_fcontext
undefined reference to __imp_jump_fcontext . undefined reference to __imp_jump_fcontext

I cannot find other posts or even web pages that describe these errors. 我找不到描述这些错误的其他帖子甚至网页。 Does anyone know a way in Windows to still use the b2 options for the latest boost from the GitHub repository? 有谁知道Windows中仍然可以使用b2选项从GitHub存储库获得最新提升的方法吗?

EDIT : 编辑

Using b2 -a -d+2 -q --build-dir=build toolset=gcc works. 使用b2 -a -d+2 -q --build-dir=build toolset=gcc可以工作。 Apparently the --build-type=complete option is the first of the ones above to break the compilation. 显然--build-type=complete选项是上面第一个破坏编译的选项。

The flags link=shared , runtime-link=shared and threading=multi also cause b2 to stop. 标志link=sharedruntime-link=sharedthreading=multi也会导致b2停止。

Has anyone got a clue how to solve this? 有没有人知道如何解决这个问题? is there a patch for MinGW that works for the current repositories? MinGW是否有适用于当前存储库的补丁?

Your best bet may be switching to MSYS2 which is a new and improved version of MSYS. 最好的选择是切换到MSYS2,这是MSYS的新版本和改进版本。 I have very good experience with MSYS2 whereas I can't say that about MSYS or Cygwin (In my case that's building a project heavily using boost and c++11). 我在MSYS2方面有很好的经验,而关于MSYS或Cygwin则不能这么说(就我而言,这是大量使用boost和c ++ 11构建项目)。

You can read some comparison here . 您可以在这里阅读一些比较。

Also taken from the answer here : 也从这里的答案中获取:

While MSYS isn't dead, I would say it's not looking very healthy either. 虽然MSYS还没死,但我也想说它也不是很健康。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM