MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0010710 | CMake | Modules | public | 2010-05-13 19:11 | 2016-06-10 14:31 |
| Reporter | Daniel Richard G. | ||||
| Assigned To | Bill Hoffman | ||||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | CMake-2-8 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0010710: FindThreads.cmake does not work properly on Tru64 | ||||
| Description | find_package(Threads) in CMake 2.8.1 does not work correctly on OSF/Tru64. There are multiple problems with the module as it is currently written: 1. At line 141, there is a platform-specific conditional (CMAKE_SYSTEM MATCHES "OSF1-V*") that blanks out the name of the pthread library. This is not correct for my particular system; without a threading directive passed to the compiler, code fails to link due to missing pthread functions. 2. Prior to that point, the module does find -lpthread. But this is not the correct directive to use, according to the cc(1) man page: it's -pthread. (Note, of course, that this does not necessarily apply if GCC is being used.) 3a. The situation on this system is even more complicated than that, however. Both -lpthread (singular) and -lpthreads (plural) exist, and 3b. -lpthreads exports "pthread_create", while -lpthread exports "__pthread_create", and 3c. If you do a normal CHECK_LIBRARY_EXISTS() call, then -lpthreads appears to be the correct library. But if you do your own test program, which #includes pthread.h, pthread_create() becomes a preprocessor macro that expands to __pthread_create(). So -lpthread is the actual library needed. Here's what I see as the takeaway: 1. If -pthread/-thread/-mt/etc. does the trick, use that in preference to any -l* library specifier. 2. The function-link test has to be done with a source file that #includes pthread.h, otherwise it's useless. 3. There's no need to special-case OSF/Tru64, because a robust enough FindThreads module can handle it. | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2010-05-13 19:11 | Daniel Richard G. | New Issue | |||
| 2010-08-03 12:24 | Kovarththanan Rajaratnam | Category | CMake => Modules | ||
| 2010-12-15 09:11 | David Cole | Assigned To | => Bill Hoffman | ||
| 2010-12-15 09:11 | David Cole | Status | new => assigned | ||
| 2014-10-06 16:20 | Rolf Eike Beer | Note Added: 0036988 | |||
| 2016-06-10 14:28 | Kitware Robot | Note Added: 0041696 | |||
| 2016-06-10 14:28 | Kitware Robot | Status | assigned => resolved | ||
| 2016-06-10 14:28 | Kitware Robot | Resolution | open => moved | ||
| 2016-06-10 14:31 | Kitware Robot | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||