NVIDIA/jitify

jitify2_preprocess require -lpthread in linkage stage for safety

JunHuohuo opened this issue · 1 comments

In jitify, the app uses dlopen() to load libnvrtc.so, not dynamical link in compilation. It could cause a hidden trouble about pthread and stdc++ libraries.
This story has a description in detail :
https://stackoverflow.com/questions/51209268/using-stdthread-in-a-library-loaded-with-dlopen-leads-to-a-sigsev

It will cause the pthread_create function call into nullptr ptr in somewhere, because libnvrtc.so depends pthread but jitify2_preprocess does not.

for safety, the jitify2_preprocess could depend on pthread in linkage stage. for example:

./CMakeLists.txt:84: target_link_libraries(jitify2_preprocess PRIVATE ${CMAKE_DL_LIBS})
=> ./CMakeLists.txt:84: target_link_libraries(jitify2_preprocess PRIVATE ${CMAKE_DL_LIBS} pthread)

closed by #115