【问题标题】:Building Intel Threading Building Blocks fails with Mingw-w64使用 Mingw-w64 构建英特尔线程构建块失败
【发布时间】:2021-05-17 15:40:54
【问题描述】:

我正在使用带有 gcc 10.2 的 Mingw-w64,我正在尝试在 MSYS2 控制台上编译英特尔线程构建块。我之前已经成功使用旧版本的构建脚本,但是带有标签“v2021.2.0”的新版本仅提供CMake构建。

我通过在 MSYS2 控制台上运行此脚本来构建:

#!/bin/bash

TBB_DIR=/c/Libraries/TBB
PARALLEL_PROCESSES=1

echo
echo Building Tbb...
echo
rm -rf $TBB_DIR/Build
mkdir $TBB_DIR/Build
cd $TBB_DIR/Build
cmake -DCMAKE_BUILD_TYPE="Release" -S "$TBB_DIR" -B "$TBB_DIR/Build" -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="$TBB_DIR/Install" -DTBB_STRICT=False -DTBB_TEST=False
cd $TBB_DIR/Build
mingw32-make -j $PARALLEL_PROCESSES install

构建失败,错误是:

In file included from C:/Libraries/TBB/include/oneapi/tbb/detail/_utils.h:26,
                 from C:/Libraries/TBB/src/tbb/allocator.cpp:21:
C:/Libraries/TBB/include/oneapi/tbb/detail/_machine.h:241:56: error: '_MCW_DN' was not declared in this scope
  241 |     static constexpr unsigned int X87CW_CONTROL_MASK = _MCW_DN | _MCW_EM | _MCW_RC;
      |                                                        ^~~~~~~
compilation terminated due to -Wfatal-errors.

为什么会这样?不支持 Mingw-w64 吗?还是我做错了什么?

【问题讨论】:

  • _MCW_DNfloat.h header file 中,所以它应该可以工作。
  • 不确定是否重要,但您指定了错误的 makefile 风格。你想要"MinGW Makefiles"切换到make而不是mingw32-make
  • @HolyBlackCat 我正在使用 UNIX shell (MSYS2)。因此,据我所知,我必须使用“MSYS Makefiles”。如果我尝试使用“MINGW Makefiles”,我会收到以下错误消息:sh.exe was found in your PATH, here: ... For MinGW make to work correctly sh.exe must NOT be in your path. Run cmake from a shell that does not have sh.exe in your PATH. If you want to use a UNIX shell, then use MSYS Makefiles.
  • @ssbssa 有趣...在我的安装中,在控制字掩码之前有一行#ifndef __STRICT_ANSI__,这会阻止它们的定义。如果我使用附加选项-U__STRICT_ANSI__ 进行编译,则会收到另一个编译错误:TBB/src/tbb/co_context.h:135:9: error: 'IsThreadAFiber' was not declared in this scope。不知道现在有没有很多人用MinGW-w64构建了v2021.*...?
  • 考虑到 mingw 支持,oneTBB 中有一个开放的拉取请求:github.com/oneapi-src/oneTBB/pull/351

标签: c++ build mingw-w64 tbb


【解决方案1】:

我可以像这样在 Windows 上使用 MinGW-w64 构建 TBB 2020.0(没有 CMake):

#ARCH=ia32
ARCH=intel64
mingw32-make compiler=gcc arch=$ARCH runtime=mingw tbb tbbmalloc CPLUS="g++ -static-libstdc++ -static-libgcc"

【讨论】:

  • 问题已经明确是关于新版本 v2021.*.
  • 抱歉,我错过了更新版本。我也有构建 2021.2.0 的问题:与 Unicode + 87 相关的问题(如 error: '_control87' was not declared in this scope
猜你喜欢
  • 2013-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-12
  • 2016-03-09
相关资源
最近更新 更多