File tree Expand file tree Collapse file tree 4 files changed +7
-18
lines changed Expand file tree Collapse file tree 4 files changed +7
-18
lines changed Original file line number Diff line number Diff line change 82
82
83
83
%endfor
84
84
%endfor
85
-
86
- namespace {
87
- // This uselessFunc is needed to ensure that pthread is linked correctly against
88
- // ur_loader.so for gcc-9
89
- void uselessFunc() {
90
- std::thread UselessThread([]{});
91
- }
92
- }
93
-
94
85
} // extern "C"
Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ if (UNIX)
48
48
set (THREADS_PREFER_PTHREAD_FLAG TRUE )
49
49
find_package (Threads REQUIRED )
50
50
target_link_libraries (ur_loader PRIVATE Threads::Threads )
51
+ # Older gcc versions need -pthread, not just -lpthread
52
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
53
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.1 )
54
+ find_library (PTHREAD_LIBRARY pthread )
55
+ target_link_libraries (ur_loader PRIVATE "-pthread" )
56
+ endif ()
57
+ endif ()
51
58
endif ()
52
59
53
60
if (WIN32 )
Original file line number Diff line number Diff line change 26
26
#include < atomic>
27
27
#include < mutex>
28
28
#include < set>
29
- #include < thread>
30
29
#include < vector>
31
30
32
31
struct ur_loader_config_handle_t_ {
Original file line number Diff line number Diff line change @@ -7743,12 +7743,4 @@ ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp(
7743
7743
return exceptionToResult (std::current_exception ());
7744
7744
}
7745
7745
7746
- namespace {
7747
- // This uselessFunc is needed to ensure that pthread is linked correctly against
7748
- // ur_loader.so for gcc-9
7749
- void uselessFunc () {
7750
- std::thread UselessThread ([] {});
7751
- }
7752
- } // namespace
7753
-
7754
7746
} // extern "C"
You can’t perform that action at this time.
0 commit comments