View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011333CMakeModulespublic2010-10-19 07:132012-07-09 06:52
ReporterRolf Eike Beer 
Assigned ToRolf Eike Beer 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0011333: FindThreads incorrectly adds -pthread to linker options
DescriptionFindThreads sets CMAKE_THREAD_LIBS_INIT to -pthread on QNX which leads to this linker warning:

c++: unrecognized option '-pthread'

QNX has the phtread stuff in the standard library. The best way would IMHO be to check if a program that uses pthread_* can be successfully linked without specifying any linker option before trying out the different flags.
TagsNo tags attached.
Attached Filesdiff file icon pthread_libc.diff [^] (3,668 bytes) 2011-02-03 15:38 [Show Content]
patch file icon 19a4b885+0001-FindThreads-Try-pthreads-with-no-special-option-firs.patch [^] (3,618 bytes) 2011-04-25 11:38 [Show Content]

 Relationships
related to 0007830closedDavid Cole CMake 2.6.2 doesn't find pthread_* function in libc on OpenSolaris 
related to 0012457closedDavid Cole Wrong detection for pthread under Linux 

  Notes
(0024476)
Ben Boeckel (developer)
2011-01-06 14:50

Not sure if I'll have time to get around to this before 2.8.4.
(0025250)
Rolf Eike Beer (developer)
2011-02-03 15:39

Entirely untested, I'll see if I find time to test it the next days.
(0026249)
Brad King (manager)
2011-04-25 11:40

Patch "19a4b885+0001-FindThreads-Try-pthreads-with-no-special-option-firs.patch" is a git format-patch version of pthread_libc.diff based on commit 19a4b885. I created it just to make this easier to integrate later. Can anyone test this on QNX and verify that it works? Is the result changed on Linux?
(0027185)
Rolf Eike Beer (developer)
2011-08-09 14:03

Sorry, I don't have access to the QNX machine anymore.
(0027256)
David Cole (manager)
2011-08-20 14:58

Fix pushed to CMake 'next'

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd61be71401ef9e0a241562fc31539273084deff [^]
(0027417)
David Cole (manager)
2011-09-14 12:38

The patch used to fix this issue has apparently caused 0012457

What is the right fix for BOTH of these issues?

Please add notes here with your thoughts and ideas...

Thanks!
(0027419)
Funda Wang (reporter)
2011-09-14 12:42

Ugly hack:

http://svnweb.mageia.org/packages/cauldron/cmake/current/SOURCES/cmake-2.8.6-fix-thread-detection.patch [^]
(0027420)
Funda Wang (reporter)
2011-09-14 12:51

Maybe the real problem comes from CHECK_SYMBOL_EXISTS function. It does not produce real link against specific function. For instance:

$ cat a.c
#include <math.h>

 void cmakeRequireSymbol(int dummy,...){(void)dummy;}
 int main()
 {
   cmakeRequireSymbol(0,&sin);
   return 0;
 }

It is obviously when linking a.c, we should pass -lm as libs, but it does not produce 'sin' symbol.
(0027422)
Brad King (manager)
2011-09-14 16:44

Re 0011333:0027420: Your require-symbol example does really link to sin:

$ gcc a.c
/tmp/ccWOt2zo.o: In function `main':
a.c:(.text+0x71): undefined reference to `sin'
collect2: ld returned 1 exit status
$ gcc a.c -lm
$
(0027424)
Orion Poplawski (reporter)
2011-09-14 17:38

Try it with optimization (-O)
$ gcc -O a.c
$
(0027431)
Rolf Eike Beer (developer)
2011-09-16 04:06

So the problem we se here looks indeed like a problem in CHECK_SYMBOL_EXISTS for me. But on the other hand I can't find any test that checks either CHECK_SYMBOL_EXISTS or FindThreads.

Should we split out a different bug (with high priority I would say) that CHECK_SYMBOL_EXISTS is unreliable depending e.g. on optimization?
(0027478)
David Cole (manager)
2011-09-22 16:57

Not enough time left to address this issue before the 2.8.6 release. Deferred until a future release.
(0027966)
David Cole (manager)
2011-12-13 19:20

Unset target version field; too late for a fix to go into 2.8.7; deferred until a future version.
(0028137)
Rolf Eike Beer (developer)
2012-01-02 17:13

I have pushed a branch test-symbol-exists that indeed proves that this is a bug in CheckSymbolExists.
(0028387)
Rolf Eike Beer (developer)
2012-01-21 16:27

Pushed to next (again). CheckSymbolExists should really work now, so this should not cause any additional pain.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3dc6f2bfb34ff90a905b10872e98c163940f456a [^]
(0029959)
David Cole (manager)
2012-07-09 06:52

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2010-10-19 07:13 Rolf Eike Beer New Issue
2010-11-10 13:11 David Cole Assigned To => David Cole
2010-11-10 13:11 David Cole Status new => assigned
2010-11-10 13:11 David Cole Target Version => CMake 2.8.4
2010-12-08 13:43 Ben Boeckel Assigned To David Cole => Ben Boeckel
2010-12-14 13:20 Kovarththanan Rajaratnam Category CMake => Modules
2011-01-06 14:50 Ben Boeckel Note Added: 0024476
2011-01-06 14:50 Ben Boeckel Target Version CMake 2.8.4 =>
2011-02-03 15:38 Rolf Eike Beer File Added: pthread_libc.diff
2011-02-03 15:39 Rolf Eike Beer Note Added: 0025250
2011-04-18 16:17 Brad King Relationship added related to 0007830
2011-04-25 11:38 Brad King File Added: 19a4b885+0001-FindThreads-Try-pthreads-with-no-special-option-firs.patch
2011-04-25 11:40 Brad King Note Added: 0026249
2011-08-01 10:50 David Cole Assigned To Ben Boeckel => David Cole
2011-08-01 10:50 David Cole Target Version => CMake 2.8.6
2011-08-09 14:03 Rolf Eike Beer Note Added: 0027185
2011-08-20 14:58 David Cole Note Added: 0027256
2011-08-20 14:58 David Cole Status assigned => resolved
2011-08-20 14:58 David Cole Fixed in Version => CMake 2.8.6
2011-08-20 14:58 David Cole Resolution open => fixed
2011-09-14 12:37 David Cole Relationship added related to 0012457
2011-09-14 12:38 David Cole Note Added: 0027417
2011-09-14 12:38 David Cole Status resolved => feedback
2011-09-14 12:38 David Cole Resolution fixed => reopened
2011-09-14 12:40 David Cole Fixed in Version CMake 2.8.6 =>
2011-09-14 12:42 Funda Wang Note Added: 0027419
2011-09-14 12:51 Funda Wang Note Added: 0027420
2011-09-14 16:44 Brad King Note Added: 0027422
2011-09-14 17:38 Orion Poplawski Note Added: 0027424
2011-09-16 04:06 Rolf Eike Beer Note Added: 0027431
2011-09-16 04:06 Rolf Eike Beer Status feedback => assigned
2011-09-22 16:57 David Cole Note Added: 0027478
2011-09-22 16:57 David Cole Target Version CMake 2.8.6 =>
2011-10-28 12:24 David Cole Target Version => CMake 2.8.7
2011-12-13 19:20 David Cole Note Added: 0027966
2011-12-13 19:20 David Cole Target Version CMake 2.8.7 =>
2012-01-02 17:13 Rolf Eike Beer Note Added: 0028137
2012-01-04 14:18 Rolf Eike Beer Target Version => CMake 2.8.8
2012-01-21 16:27 Rolf Eike Beer Note Added: 0028387
2012-01-21 16:27 Rolf Eike Beer Assigned To David Cole => Rolf Eike Beer
2012-01-21 16:27 Rolf Eike Beer Status assigned => resolved
2012-01-21 16:27 Rolf Eike Beer Resolution reopened => fixed
2012-01-21 16:27 Rolf Eike Beer Fixed in Version => CMake 2.8.8
2012-07-09 06:52 David Cole Note Added: 0029959
2012-07-09 06:52 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team