【发布时间】: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_DN在float.hheader 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。