Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to build the last version oneTBB 2021.11.0 on Windows with GCC 13.2 #1298

Closed
fdiedler opened this issue Jan 19, 2024 · 2 comments
Closed

Comments

@fdiedler
Copy link

fdiedler commented Jan 19, 2024

(can you delete the issue #1297 I use the wrong github account)

Hi,

It is impossible to build the last version on Windows using CMAKE and mingw32-make :

$ mingw32-make
[  1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
[  1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/allocator.cpp.obj
[  1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena.cpp.obj
In file included from C:/nuwen-19.0/include/c++/13.2.0/atomic:41,
                 from C:/oneTBB-2021.11.0/include/oneapi/tbb/detail/_utils.h:22,
                 from C:\oneTBB-2021.11.0\src\tbb\task_dispatcher.h:20,
                 from C:\oneTBB-2021.11.0\src\tbb\arena.cpp:17:
In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]',
    inlined from 'void std::atomic<bool>::store(bool, std::memory_order)' at C:/nuwen-19.0/include/c++/13.2.0/atomic:104:20,
    inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::notify_one_relaxed() [with Context = long long unsigned int]' at C:\oneTBB-2021.11.0\src\tbb\concurrent_monitor.h:293:53,
    inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::notify_one() [with Context = long long unsigned int]' at C:\oneTBB-2021.11.0\src\tbb\concurrent_monitor.h:276:27,
    inlined from 'tbb::detail::r1::nested_arena_context::~nested_arena_context()' at C:\oneTBB-2021.11.0\src\tbb\arena.cpp:675:53:
C:/nuwen-19.0/include/c++/13.2.0/bits/atomic_base.h:481:25: warning: 'void __atomic_store_1(volatile void*, unsigned char, int)' writing 1 byte into a region of size 0 overflows the destination [-Wstringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In destructor 'tbb::detail::r1::nested_arena_context::~nested_arena_context()':
cc1plus.exe: note: destination object is likely at address zero
In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]',
    inlined from 'void std::atomic<bool>::store(bool, std::memory_order)' at C:/nuwen-19.0/include/c++/13.2.0/atomic:104:20,
    inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::notify_one_relaxed() [with Context = long long unsigned int]' at C:\oneTBB-2021.11.0\src\tbb\concurrent_monitor.h:293:53:
C:/nuwen-19.0/include/c++/13.2.0/bits/atomic_base.h:481:25: warning: 'void __atomic_store_1(volatile void*, unsigned char, int)' writing 1 byte into a region of size 0 overflows the destination [-Wstringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In member function 'void tbb::detail::r1::concurrent_monitor_base<Context>::notify_one_relaxed() [with Context = long long unsigned int]':
cc1plus.exe: note: destination object is likely at address zero
[  2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.obj
[  2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.obj
[  2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.obj
C:\oneTBB-2021.11.0\src\tbb\dynamic_link.cpp: In function 'void tbb::detail::r1::dynamic_unlink(dynamic_link_handle)':
C:\oneTBB-2021.11.0\src\tbb\dynamic_link.cpp:37:39: warning: value computed is not used [-Wunused-value]
   37 |     #define dlclose( handle )       ( ! FreeLibrary( handle ) )
      |                                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~
C:\oneTBB-2021.11.0\src\tbb\dynamic_link.cpp:370:13: note: in expansion of macro 'dlclose'
  370 |             dlclose( handle );
      |             ^~~~~~~
[  2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/exception.cpp.obj

[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/governor.cpp.obj
In file included from C:/nuwen-19.0/x86_64-w64-mingw32/include/winnt.h:27,
                 from C:/nuwen-19.0/x86_64-w64-mingw32/include/minwindef.h:163,
                 from C:/nuwen-19.0/x86_64-w64-mingw32/include/windef.h:9,
                 from C:/nuwen-19.0/x86_64-w64-mingw32/include/windows.h:69,
                 from C:\oneTBB-2021.11.0\src\tbb\rml_base.h:25,
                 from C:\oneTBB-2021.11.0\src\tbb\rml_tbb.h:23,
                 from C:\oneTBB-2021.11.0\src\tbb\governor.h:20,
                 from C:\oneTBB-2021.11.0\src\tbb\governor.cpp:17:
In function 'long long unsigned int __readgsqword(long unsigned int)',
    inlined from '_TEB* NtCurrentTeb()' at C:/nuwen-19.0/x86_64-w64-mingw32/include/winnt.h:10013:86,
    inlined from 'uintptr_t tbb::detail::r1::get_stack_base(std::size_t)' at C:\oneTBB-2021.11.0\src\tbb\governor.cpp:141:41,
    inlined from 'static void tbb::detail::r1::governor::init_external_thread()' at C:\oneTBB-2021.11.0\src\tbb\governor.cpp:202:47:
C:/nuwen-19.0/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int [0]' [-Warray-bounds=]
  838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
      | ^~~~~~~~~~~~~~
In static member function 'static void tbb::detail::r1::governor::init_external_thread()':
cc1plus.exe: note: source object is likely at address zero
[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/global_control.cpp.obj
[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/itt_notify.cpp.obj
[  4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/main.cpp.obj
[  4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/market.cpp.obj
[  4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/tcm_adaptor.cpp.obj
[  5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc.cpp.obj
[  5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc_ex.cpp.obj
[  5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/observer_proxy.cpp.obj
[  5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/parallel_pipeline.cpp.obj
[  6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/private_server.cpp.obj
[  6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/profiling.cpp.obj
[  6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rml_tbb.cpp.obj
[  7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_mutex.cpp.obj
[  7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_rw_mutex.cpp.obj
[  7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/semaphore.cpp.obj
[  8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/small_object_pool.cpp.obj
[  8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task.cpp.obj
In file included from C:/nuwen-19.0/x86_64-w64-mingw32/include/intrin.h:41,
                 from C:/oneTBB-2021.11.0/include/oneapi/tbb/detail/_machine.h:29,
                 from C:/oneTBB-2021.11.0/include/oneapi/tbb/detail/_utils.h:27,
                 from C:\oneTBB-2021.11.0\src\tbb\scheduler_common.h:20,
                 from C:\oneTBB-2021.11.0\src\tbb\task.cpp:18:
In function 'long long unsigned int __readgsqword(long unsigned int)',
    inlined from 'void* GetCurrentFiber()' at C:/nuwen-19.0/x86_64-w64-mingw32/include/winnt.h:10014:73,
    inlined from 'void tbb::detail::r1::swap_coroutine(void*&, void*&)' at C:\oneTBB-2021.11.0\src\tbb\co_context.h:296:37,
    inlined from 'void tbb::detail::r1::co_context::resume(tbb::detail::r1::co_context&)' at C:\oneTBB-2021.11.0\src\tbb\co_context.h:144:23,
    inlined from 'void tbb::detail::r1::suspend_point_type::resume(tbb::detail::r1::suspend_point_type*)' at C:\oneTBB-2021.11.0\src\tbb\scheduler_common.h:395:28,
    inlined from 'bool tbb::detail::r1::task_dispatcher::resume(tbb::detail::r1::task_dispatcher&)' at C:\oneTBB-2021.11.0\src\tbb\task.cpp:140:28:
C:/nuwen-19.0/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int [0]' [-Warray-bounds=]
  838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
      | ^~~~~~~~~~~~~~
In member function 'bool tbb::detail::r1::task_dispatcher::resume(tbb::detail::r1::task_dispatcher&)':
cc1plus.exe: note: source object is likely at address zero
[  8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.obj
In file included from C:/nuwen-19.0/x86_64-w64-mingw32/include/intrin.h:41,
                 from C:/oneTBB-2021.11.0/include/oneapi/tbb/detail/_machine.h:29,
                 from C:/oneTBB-2021.11.0/include/oneapi/tbb/detail/_utils.h:27,
                 from C:\oneTBB-2021.11.0\src\tbb\task_dispatcher.h:20,
                 from C:\oneTBB-2021.11.0\src\tbb\task_dispatcher.cpp:17:
In function 'long long unsigned int __readgsqword(long unsigned int)',
    inlined from 'void* GetCurrentFiber()' at C:/nuwen-19.0/x86_64-w64-mingw32/include/winnt.h:10014:73,
    inlined from 'void tbb::detail::r1::current_coroutine(void*&)' at C:\oneTBB-2021.11.0\src\tbb\co_context.h:286:43,
    inlined from 'tbb::detail::r1::co_context::co_context(std::size_t, void*)' at C:\oneTBB-2021.11.0\src\tbb\co_context.h:120:30,
    inlined from 'tbb::detail::r1::suspend_point_type::suspend_point_type(tbb::detail::r1::arena*, size_t, tbb::detail::r1::task_dispatcher&)' at C:\oneTBB-2021.11.0\src\tbb\task_dispatcher.h:97:7,
    inlined from 'void tbb::detail::r1::task_dispatcher::init_suspend_point(tbb::detail::r1::arena*, std::size_t)' at C:\oneTBB-2021.11.0\src\tbb\task_dispatcher.cpp:239:48:
C:/nuwen-19.0/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int [0]' [-Warray-bounds=]
  838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
      | ^~~~~~~~~~~~~~
In member function 'void tbb::detail::r1::task_dispatcher::init_suspend_point(tbb::detail::r1::arena*, std::size_t)':
cc1plus.exe: note: source object is likely at address zero
[  9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_group_context.cpp.obj
[  9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/thread_dispatcher.cpp.obj
[  9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/thread_request_serializer.cpp.obj
[  9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/threading_control.cpp.obj
[ 10%] Building CXX object src/tbb/CMakeFiles/tbb.dir/version.cpp.obj
[ 10%] Building CXX object src/tbb/CMakeFiles/tbb.dir/queuing_rw_mutex.cpp.obj
[ 10%] Building RC object src/tbb/CMakeFiles/tbb.dir/tbb.rc.obj
[ 11%] Linking CXX shared library ..\..\gnu_13.2_cxx11_64_relwithdebinfo\libtbb12.dll
C:/nuwen-19.0/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognized option '-z'
C:/nuwen-19.0/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\tbb\CMakeFiles\tbb.dir\build.make:633: gnu_13.2_cxx11_64_relwithdebinfo/libtbb12.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:468: src/tbb/CMakeFiles/tbb.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2

There is an error with the linker : bin/ld.exe: unrecognized option '-z'

I disabled the TBB_ENABLE_IPO and same error...

How to fix it please ?

Thanks,

@sarathnandu
Copy link
Contributor

sarathnandu commented Jan 21, 2024

I believe this is due to the lack of support for the -z options in Windows versions of ld within MinGW.
This issue has been fixed in the commit
#1193

set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now,-z,noexecstack)

The -z option shouldn't be included while linking in MINGW environment if you are using the latest tbb master branch.

@fdiedler
Copy link
Author

@sarathnandu Oh nice, I found this line in the makefile but was not sure if I could delete it.
Thanks a lot, it works now for MinGW environment :)

By the way, can someone delete the duplicate issue #1297 I opened with my profesional Github acccount ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants