Accelergy-Project / timeloop-python

Python wrapper for the timeloop project.
MIT License
7 stars 3 forks source link

Missing Linked Library: pthread #20

Closed nandeekan-nvidia closed 1 month ago

nandeekan-nvidia commented 1 year ago

It looks like the library pthread is missing as a dependency from the CMakeLists.txt files. The module does not install unless it is added.

Without it, I see the error:

    /home/utils/binutils-2.37/bin/ld: CMakeFiles/pytimeloop_cpptest.dir/test-main.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
    /home/utils/binutils-2.37/bin/ld: /lib64/libpthread.so.0: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    gmake[2]: *** [cpp_tests/pytimeloop_cpptest] Error 1
    gmake[1]: *** [cpp_tests/CMakeFiles/pytimeloop_cpptest.dir/all] Error 2
    gmake: *** [all] Error 2
gilbertmike commented 1 year ago

I haven't encountered this issue in my environment, though it makes sense. Could you try adding pthread to the cpp_tests/CMakeLists.txt:

target_link_libraries(pytimeloop_cpptest PRIVATE
    ${LIBTIMELOOP}
    config++
    yaml-cpp
    rt
    define_gterminate
    pytimeloop
    Threads::Threads)

and let me know if that fixes the issue? I can't test it on my own since I didn't encounter the problem.