* Tom Stellard:

> On 8/2/21 8:38 PM, Richard Shaw wrote:
>> I'm trying to fix vigra to work with OpenEXR 3 via the CONFIG method.
>> In the OpenEXR config it has a "find_dependency(Threads REQUIRED)"
>> and there's no complaint, but then building fails[1] with no such
>> library as "Threads::Threads" which means it's not getting
>> translated into the library name, presumable libpthread.so.0.
>> I added a "Find(Threads)" just to see what's up and that is failing
>> even though the library is provided by the glibc package which is
>> definitely installed!
>> Anyone else have any ideas?
>> 
>
> Could this be related to merging libpthread.so into libc.so?
>
> https://fedoraproject.org/wiki/Changes/GNUToolchainF35#Scope

Right.  I think the unqualified use of Threads::Threads is not correct
according to FindThreads.

<https://cmake.org/cmake/help/latest/module/FindThreads.html> says:

    Threads::Threads
    
        The thread library, if found.
  
But FindThreads does not really make an effort to find the thread
library (possibly empty) if it determines that is is not needed:

    # Check if pthread functions are in normal C library.
    # We list some pthread functions in PTHREAD_C_CXX_TEST_SOURCE test code.
    # If the pthread functions already exist in C library, we could just use
    # them instead of linking to the additional pthread library.
    if(CMAKE_C_COMPILER_LOADED)
      CHECK_C_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" 
CMAKE_HAVE_LIBC_PTHREAD)
    elseif(CMAKE_CXX_COMPILER_LOADED)
      CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" 
CMAKE_HAVE_LIBC_PTHREAD)
    endif()
    if(CMAKE_HAVE_LIBC_PTHREAD)
      set(CMAKE_THREAD_LIBS_INIT "")
      set(CMAKE_HAVE_THREADS_LIBRARY 1)
      set(Threads_FOUND TRUE)

This suggests that CMAKE_THREAD_LIBS_INIT is actually the variable to
use without a conditional check.  That seems to be what other packages
use.  Its documentation matches this:

    CMAKE_THREAD_LIBS_INIT
    
        The thread library to use. This may be empty if the thread
        functions are provided by the system libraries and no special
        flags are needed to use them.


Thanks,
Florian
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to