Closed
Bug 137736
Opened 22 years ago
Closed 22 years ago
configure does not detect pthreads using CC on IRIX 6.5
Categories
(NSPR :: NSPR, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
4.2.2
People
(Reporter: sjulier, Assigned: netscape)
Details
Attachments
(1 file, 1 obsolete file)
1.63 KB,
patch
|
Details | Diff | Splinter Review |
The ./configure script does not detect pthreads on an SGI IRIX 6.5 platform using CC 7.3.1.3m. Browsing through config.log indicates that the problem is not due to lack of thread support but is caused by the fact that the header file which defines 'exit' is not included in the test program: ======================================================================== configure:4889: checking for pthread_create in -lpthreads CC -o dummy dummy.c -fullwarn -xansi -multigot -n32 -woff 1209 -mips3 -lpthreads cc-1116 CC: WARNING File = dummy.c, Line = 3 Non-void function "foo" (declared at line 3) should return a value. void *foo(void *v) { int a = 1; } ^ cc-3201 CC: REMARK File = dummy.c, Line = 3 The parameter "v" was never referenced. void *foo(void *v) { int a = 1; } ^ cc-1174 CC: WARNING File = dummy.c, Line = 3 The variable "a" was declared but never referenced. void *foo(void *v) { int a = 1; } ^ cc-1020 CC: ERROR File = dummy.c, Line = 9 The identifier "exit" is undefined. exit(0); ^ 1 error detected in the compilation of "dummy.c". ======================================================================== This can be rectified by adding #include <stdlib.h>
Comment 1•22 years ago
|
||
Assigned the bug to Chris.
Assignee: wtc → seawood
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•22 years ago
|
Priority: -- → P2
Target Milestone: --- → 4.2.1
Comment 2•22 years ago
|
||
On IRIX the pthread library is libpthread not libpthreads. eg % find $TOOLROOT/* $ROOT/* -name libpthrea\* /projects/sise/roots/latest_root/usr/lib/libpthread.so /projects/sise/roots/latest_root/usr/lib32/libpthread.so /projects/sise/roots/latest_root/usr/lib64/libpthread.so or % find /usr/lib /usr/lib32 /usr/lib64 -name libpthre\* /usr/lib/libpthread.so /usr/lib32/libpthread.so /usr/lib64/libpthread.so % cc -version MIPSpro Compilers: Version 7.3.1.3m Further, this works for me: configure:7329: checking for pthread_create in -lpthread cc -o dummy dummy.c -woff 3201 -woff 1506 -mips3 -n32 -woff 3262 -G 4 -n32 -lpthread -mips3 -n32 -n32 -lsocket -ldl -lm cc-1116 cc: WARNING File = dummy.c, Line = 3 Non-void function "foo" (declared at line 3) should return a value. void *foo(void *v) { int a = 1; } ^ cc-1174 cc: WARNING File = dummy.c, Line = 3 The variable "a" was declared but never referenced. void *foo(void *v) { int a = 1; } ^ ld32: WARNING 84 : /usr/lib32/libsocket.so is not used for resolving any symbol. ld32: WARNING 84 : /usr/lib32/libdl.so is not used for resolving any symbol. ld32: WARNING 84 : /usr/lib32/mips3/libm.so is not used for resolving any symbol. To cut a long story short... you should be using cc not CC. If you use cc you will not have this problem. eg: % cc -o dummy dummy.c -woff 3201 -woff 1506 -mips3 -n32 -woff 3262 -G 4 -n32 -lpthread -mips3 -n32 -n32 -lsocket -ldl -lm cc-1116 cc: WARNING File = dummy.c, Line = 2 Non-void function "foo" (declared at line 2) should return a value. void *foo(void *v) { int a = 1; } ^ cc-1174 cc: WARNING File = dummy.c, Line = 2 The variable "a" was declared but never referenced. void *foo(void *v) { int a = 1; } ^ ld32: WARNING 84 : /usr/lib32/libsocket.so is not used for resolving any symbol. ld32: WARNING 84 : /usr/lib32/libdl.so is not used for resolving any symbol. ld32: WARNING 84 : /usr/lib32/mips3/libm.so is not used for resolving any symbol. % CC -o dummy dummy.c -woff 3201 -woff 1506 -mips3 -n32 -woff 3262 -G 4 -n32 -lpthread -mips3 -n32 -n32 -lsocket -ldl -lm cc-1116 CC: WARNING File = dummy.c, Line = 2 Non-void function "foo" (declared at line 2) should return a value. void *foo(void *v) { int a = 1; } ^ cc-1174 CC: WARNING File = dummy.c, Line = 2 The variable "a" was declared but never referenced. void *foo(void *v) { int a = 1; } ^ cc-1020 CC: ERROR File = dummy.c, Line = 8 The identifier "exit" is undefined. exit(0); ^ 1 error detected in the compilation of "dummy.c".
Reporter | ||
Comment 3•22 years ago
|
||
Thanks! I'll try that. Is there any way to get the configure script to default to the correct choice of compiler? Conversely, can anything be added to the build FAQ? The reason for the configuration error is not at all obvious (I dug around the website for a while and couldn't find anything relevant). The only mention of I've found of setting CC/CXX was on the SGI Mozilla FAQ webpage and, even then, there was no explanation as to why this had to be done.
Comment 4•22 years ago
|
||
Replace exit(0) by "return 0". These are equivalent for the main() function. I also modified the foo() function to eliminate the compiler warnings and remark.
Comment 5•22 years ago
|
||
Changed another exit(0) to "return 0". Explicitly declare the main() function to return int.
Attachment #82217 -
Attachment is obsolete: true
Comment 6•22 years ago
|
||
I checked in my fix on the tip and NSPRPUB_PRE_4_2_CLIENT_BRANCH of NSPR. Chris, I'd appreciate it if you could still review my patch. Mr. Julier, configure scripts typically choose g++ and gcc by default. Whether you want to use the GNU compilers or the OS vendor's compilers (CC and cc) is a personal choice. It is possible for the configure script to detect that $CC is actually a C++ compiler, but as I point out in bug 136344, some people do that on purpose, so it's not clear whether we should flag that as an error. Lowered the severity to minor because the bug reporter specified CC (the IRIX MIPSpro C++ compiler) as the C compiler unintentionally.
Severity: major → minor
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•22 years ago
|
Target Milestone: 4.2.1 → 4.2.2
You need to log in
before you can comment on or make changes to this bug.
Description
•