oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

Build error with mingw-w64

Open bear24rw opened this issue 6 months ago • 1 comments

% brew info mingw-w64
==> mingw-w64: stable 13.0.0 (bottled)

% sw_vers
ProductName:            macOS
ProductVersion:         15.1

% git log -1
commit 792d31223300bc849b20722aa1d79d421b6631b8 (HEAD -> master, origin/master, origin/HEAD)
# cross-windows.cmake
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_VERSION 10)
set(CMAKE_C_COMPILER   x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER  x86_64-w64-mingw32-windres)
set(CMAKE_FIND_ROOT_PATH /opt/homebrew/opt/mingw-w64/)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
% cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=cross-windows.cmake -DTBB_TEST=OFF ..
-- Dependency signature verification during dynamic linking in run-time is DISABLED
-- IPO enabled
-- GNU Assembler version: 2.44  (2044)
-- HWLOC target HWLOC::hwloc_static doesn't exist. The tbbbind target cannot be created
-- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
-- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /private/tmp/tbbtest/build/_deps/onetbb-src/build
% ninja
[1/5] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj
FAILED: src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj
/opt/homebrew/bin/x86_64-w64-mingw32-g++ -D__TBB_BUILD -D__TBB_SKIP_DEPENDENCY_SIGNATURE_VERIFICATION=1 -D__TBB_USE_ITT_NOTIFY -I/private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/../../include -O2 -g -DNDEBUG -std=c++11 -flto=auto -fno-fat-lto-objects -fvisibility=hidden -fno-keep-inline-dllexport -flifetime-dse=1 -Wall -Wextra -Werror -Wfatal-errors -fstack-clash-protection -D__TBB_GNU_ASM_VERSION=2044 -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=/private/tmp/tbbtest/build/_deps/onetbb-src/= -ffile-prefix-map=..//= -MD -MT src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj -MF src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj.d -o src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj -c /private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/task_dispatcher.cpp
In file included from /opt/homebrew/Cellar/mingw-w64/13.0.0/toolchain-x86_64/lib/gcc/x86_64-w64-mingw32/15.1.0/include/x86gprintrin.h:95,
                 from /opt/homebrew/Cellar/mingw-w64/13.0.0/toolchain-x86_64/lib/gcc/x86_64-w64-mingw32/15.1.0/include/x86intrin.h:27,
                 from /opt/homebrew/Cellar/mingw-w64/13.0.0/toolchain-x86_64/x86_64-w64-mingw32/include/intrin.h:69,
                 from /private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/../../include/oneapi/tbb/detail/_machine.h:29,
                 from /private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:27,
                 from /private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/task_dispatcher.h:20,
                 from /private/tmp/tbbtest/build/_deps/onetbb-src/src/tbb/task_dispatcher.cpp:17:
/opt/homebrew/Cellar/mingw-w64/13.0.0/toolchain-x86_64/lib/gcc/x86_64-w64-mingw32/15.1.0/include/waitpkgintrin.h: In function 'tbb::detail::r1::prolonged_pause()':
/opt/homebrew/Cellar/mingw-w64/13.0.0/toolchain-x86_64/lib/gcc/x86_64-w64-mingw32/15.1.0/include/waitpkgintrin.h:53:1: error: inlining failed in call to 'always_inline' '_tpause': target specific option mismatch
   53 | _tpause (unsigned int __A, unsigned long long __B)
      | ^~~~~~~

bear24rw avatar Jul 16 '25 05:07 bear24rw

This works so seems like some auto-detection is missing in one of the cmake/compilers/*.cmake files

% cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../../../cross-windows.cmake -DTBB_TEST=OFF -DCMAKE_C_FLAGS="-mwaitpkg" -DCMAKE_CXX_FLAGS="-mwaitpkg" ..

bear24rw avatar Jul 16 '25 05:07 bear24rw