简体   繁体   English

使用MinGW增强构建时出错

[英]Error building boost with MinGW

I tried to build boost library using the MinGW's GCC version that comes with CodeBLocks (gccc v5.1) and i have the bin folder in the PATH. 我试图使用CodeBLocks(gccc v5.1)附带的MinGW的GCC版本构建boost库,并且我在PATH中有bin文件夹。 When i run 当我跑步

boostrap.bat mingw

or 要么

boostrap.bat gcc

i get 我得到

execnt.c: In function 'try_wait_callback':
execnt.c:833:5: warning: implicit declaration of function 'UnregisterWait' [-Wimplicit-function-declaration]
 UnregisterWait( slot->wait_handle );

Reading a litte someone told me that my gcc version doesn't work to build boost so then i downloaded the last MinGW-w64 and copy its bin folder content into the MinGW's bin folder trying to "cheat" 读了一本书,有人告诉我说我的gcc版本无法建立增强功能,因此我下载了最新的MinGW-w64,并将其bin文件夹内容复制到MinGW的bin文件夹中,试图“作弊”

if i do gcc -v 如果我做gcc -v

i can see i have the version 7.3 我可以看到我有7.3版

Now it throws me this error: 现在,它引发了这个错误:

gcc: error: CreateProcess: No such file or directory

You should use MinGW-w64, without the step "copy its bin folder content into the MinGW" ! 您应该使用MinGW-w64,而无需执行“将其bin文件夹内容复制到MinGW中”的步骤!

You want to avoid using the pre-fork MinGW entirely. 您要避免完全使用前叉MinGW。 Download and install MinGW-w64 again and , if you want, add it to Code::Blocks . 再次下载并安装MinGW-w64,然后根据需要将其添加到Code :: Blocks中

Note that there are some sites providing MinGW-w64 and Boost bundles. 请注意,有些站点提供MinGW-w64和Boost捆绑包。

I had the same problem with MinGW provided with Code::Block. 我对Code :: Block提供的MinGW遇到了同样的问题。 So I have to add to recomendations important details. 因此,我必须在建议中添加重要的细节。 To build Boost.build tool: 要构建Boost.build工具:

  1. After installation of minGW-w64 in NEW directory you need to delete entry of old MinGW\\bin directory from PATH environment variable and add new entry with something like "C:\\MinGW-w64\\bin" entry. 在新目录中安装minGW-w64后,您需要从PATH环境变量中删除旧MinGW \\ bin目录的条目,并添加带有“ C:\\ MinGW-w64 \\ bin”条目的新条目。
  2. By some reason starting commands in command line under user or administrator didn't work as supposed in Boost documentation, but if start terminal from shortcut provided by MinGW-w64 - commands of Boost can finish building. 由于某种原因,在用户或管理员下的命令行中启动命令无法按Boost文档中的说明运行,但是如果从MinGW-w64提供的快捷方式启动终端-Boost的命令可以完成构建。 (Command "bootstrap.bat gcc") (命令“ bootstrap.bat gcc”)
  3. Then Boost documentation recomends "b2 install --prefix=PREFIX" but I had to add parameter like "b2 install --prefix=PREFIX toolset=gcc" also in terminal started from MinGW-w64 shortcut. 然后Boost文档推荐“ b2 install --prefix = PREFIX”,但我还必须在从MinGW-w64快捷方式启动的终端中添加“ b2 install --prefix = PREFIX toolset = gcc”之类的参数。
  4. Since I wanted to use MinGW32 of Code::Blocks in my projects (for other compatibility reasons), again I had to skip MinGW-w64 from availability (I had just renamed dir of MinGW-w64, you can delete entry from PATH) and to restore MinGW32 entry in PATH variable. 由于我想在项目中使用Code :: Blocks的MinGW32(出于其他兼容性原因),因此我又不得不跳过可用性的MinGW-w64(我刚刚将MinGW-w64的目录重命名,您可以从PATH中删除条目),恢复PATH变量中的MinGW32条目。 Also I added Boost build tool "bin" dir into PATH. 我也将Boost构建工具“ bin” dir添加到PATH中。 So I had got Boost.Build tool ready to use (builded by MinGW-w64 compiler) 所以我已经准备好使用Boost.Build工具(由MinGW-w64编译器构建)

To build Boost libraries' binaries: 要构建Boost库的二进制文件:

  1. Then I started terminal under administrator, changed dir to boost root directory and then use the last command like "b2 --build-dir=build-directory toolset=gcc --build-type=complete stage" (where build-directory is of your choice) 然后我以管理员身份启动终端,更改目录以增强根目录,然后使用最后一个命令,例如“ b2 --build-dir = build-directory toolset = gcc --build-type = complete stage”(其中build-directory是你的选择)

And at last I'd got the result: 最后我得到了结果:

...failed updating 1334 targets... ...未能更新1334个目标...

...skipped 732 targets... ...跳过了732个目标...

...updated 2873 targets... 更新了2873个目标

Where I could find necessary for me files of Boost filesystem like 在哪里可以找到我所需的Boost文件系统文件,例如

libboost_filesystem-mgw51-mt-x32-1_67.dll libboost_filesystem-mgw51-mt-x32-1_67.dll

libboost_filesystem-mgw51-mt-s-x32-1_67.a libboost_filesystem-mgw51-mt-s-x32-1_67.a

libboost_filesystem-mgw51-mt-x32-1_67.a libboost_filesystem-mgw51-mt-x32-1_67.a

etc. 等等

I didn't test them yet, but this can help to others to build Boost. 我尚未对其进行测试,但这可以帮助其他人构建Boost。

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

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