Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2430 Discussions

Building TBB on Windows using MingW & Cmake

Refactor
Beginner
1,392 Views

Hey I'm trying to build TBB on my Windows computer using MinGW & CMake. (gcc,,g++, ..) I have already tried using the premade binaries but I keep getting undefined reference issues. My cmake for the project I'm trying to import it in looks as following:

find_package(TBB REQUIRED tbb)

target_link_libraries(projectName PRIVATE ${TBB_IMPORTED_TARGETS})

I use the source code of https://github.com/oneapi-src/oneTBB/releases/tag/v2021.3.0 (latest)

and I make a build dir and cd into it and execute:

cmake .. -G "MinGW Makefiles"

followed by: cmake --build . also tried: mingw32-make Both result into

[  1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
In file included from c:\users\refactor\downloads\onetbb-2021.3.0\onetbb-2021.3.0\include\oneapi\tbb\detail\_utils.h:26,
                 from C:\Users\Refactor\Downloads\oneTBB-2021.3.0\oneTBB-2021.3.0\src\tbb\address_waiter.cpp:17:
c:\users\refactor\downloads\onetbb-2021.3.0\onetbb-2021.3.0\include\oneapi\tbb\detail\_machine.h:67: error: ignoring '#pragma intrinsic ' [-Werror=unknown-pragmas]
   67 | #pragma intrinsic(_mm_mfence)
      |
compilation terminated due to -Wfatal-errors.
cc1plus.exe: all warnings being treated as errors
mingw32-make[2]: *** [src\tbb\CMakeFiles\tbb.dir\build.make:76: src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:454: src/tbb/CMakeFiles/tbb.dir/all] Error 2
mingw32-make: *** [makefile:165: all] Error 2```
0 Kudos
7 Replies
NoorjahanSk_Intel
Moderator
1,347 Views

Hi,

Thanks for reaching out to us.

We are also able to reproduce the issue from our end. We are looking into it. We will get back to you soon.


Thanks & Regards

Noorjahan.


clevels
Employee
1,324 Views

Hello, thank you for your ticket. I will also begin an investigation into this. Thanks!


clevels
Employee
1,206 Views

Hello! Thank you for your patience. I have reviewed this issue and gone ahead nd filed a bug directly with the TBB development team and will provide an update just as soon as development reviews the issue. Thanks again.


clevels
Employee
1,176 Views

The development team has reviewed this issue and it appears that MinGW support was added in oneTBB 2021.4 (https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-threading-buil... ). 

we recommended trying sources https://github.com/oneapi-src/oneTBB/releases/tag/v2021.4.0 . 

We don't currently test on MinGW relying on the community. If still there are some problems, let us know.


clevels
Employee
1,101 Views

Hello- please let me know if you have any updates, otherwise I will be closing this issue. Thanks!


Peter_Parker
Beginner
996 Views

I tried with v2021.4.0 and latest using minGW64_810 .

v2021.4.0 configured using cmake and mingw32-make gave me:

 

mingw32-make
[ 0%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
In file included from D:\dep\oneTBBsrc\src\tbb\concurrent_monitor_mutex.h:22,
from D:\dep\oneTBBsrc\src\tbb\concurrent_monitor.h:23,
from D:\dep\oneTBBsrc\src\tbb\address_waiter.cpp:19:
D:\dep\oneTBBsrc\src\tbb\semaphore.h: In member function 'void tbb::detail::r1::semaphore::init_semaphore(size_t)':
D:\dep\oneTBBsrc\src\tbb\semaphore.h:145:15: error: 'CreateSemaphoreEx' was not declared in this scope
sem = CreateSemaphoreEx( NULL, LONG(start_cnt_), max_semaphore_cnt, NULL, 0, SEMAPHORE_ALL_ACCESS );
^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
mingw32-make[2]: *** [src\tbb\CMakeFiles\tbb.dir\build.make:76: src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:458: src/tbb/CMakeFiles/tbb.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2

FlorentD
Beginner
447 Views

Hi,

 

I also have the same problem when building oneTBB last version (2021.5.0) with CMake and GCC 9.2 :

$ mingw32-make.exe compiler=gcc arch=intel64
[ 0%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
In file included from C:\build_oneTBB\oneapi-tbb-2021.5.0\src\tbb\concurrent_monitor_mutex.h:22,
from C:\build_oneTBB\oneapi-tbb-2021.5.0\src\tbb\concurrent_monitor.h:23,
from C:\build_oneTBB\oneapi-tbb-2021.5.0\src\tbb\address_waiter.cpp:19:
C:\build_oneTBB\oneapi-tbb-2021.5.0\src\tbb\semaphore.h: In member function 'void tbb::detail::r1::semaphore::init_semaphore(size_t)':
C:\build_oneTBB\oneapi-tbb-2021.5.0\src\tbb\semaphore.h:145:15: error: 'CreateSemaphoreEx' was not declared in this scope; did you mean 'CreateSemaphoreA'?
145 | sem = CreateSemaphoreEx( NULL, LONG(start_cnt_), max_semaphore_cnt, NULL, 0, SEMAPHORE_ALL_ACCESS );
| ^~~~~~~~~~~~~~~~~
| CreateSemaphoreA
compilation terminated due to -Wfatal-errors.
mingw32-make[2]: *** [src\tbb\CMakeFiles\tbb.dir\build.make:76: src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:458: src/tbb/CMakeFiles/tbb.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2

 

What is wrong ?

 

Thanks,

 

Reply