Bug 178354 - Undefined pthread functions in gcc 4.0.2
Undefined pthread functions in gcc 4.0.2
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
4
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-19 14:43 EST by Will Cladek
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-01-20 12:31:29 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Will Cladek 2006-01-19 14:43:36 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8) Gecko/20051130 Firefox/1.5

Description of problem:
I noticed this problem when attempting to compile nmap 3.95, but it may be more indicative of a general problem with the gcc 4.0.2-8 rpms.  When I compile nmap, and it gets to the linking stage, I receive these error messages:

nmap.o(.rodata+0x16c): undefined reference to `__gthrw_pthread_cancel(unsigned long)'
...
/usr/lib/gcc/i386-redhat-linux/4.0.2/../../../../include/c++/4.0.2/i386-redhat-linux/bits/gthr-default.h:488: undefined reference to `__gthrw_pthread_once(int*, void (*)())'

This problem was not there in gcc 4.0.0-8, and I've tracked it down to the referenced gthr-default.h file.  I'm not sure if those two referenced functions were defined in the older version, but in the older version's gthr-default.h, they were declared with
#pragma weak pthread_cancel
...
#pragma weak pthread_once

so that the linker would not complain if they weren't defined.  However in gcc 4.0.2-8, they are declared as follows:

# define __gthrw(name) \
  extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)))
...
__gthrw(pthread_once);
...
__gthrw(pthread_cancel);

Compilation works fine when those declarations and the subsequent references are commented out of gthr-default.h.  Is this a bug that it is not finding the definitions of those functions?

Version-Release number of selected component (if applicable):
gcc-4.0.2-8.fc4

How reproducible:
Always

Steps to Reproduce:
1.
2.
3.
  

Additional info:
Comment 1 Jakub Jelinek 2006-01-20 10:08:40 EST
By any chance, doesn't nmap do #define __attribute__(x) or something similarly
crappy?  Best to check by looking at -E -dD dump of nmap.C.
If so, the bug is on nmap side.
Comment 2 Will Cladek 2006-01-20 12:31:29 EST
Bingo.  That was it.  There was a:
#define __attribute__(args)

in nbase.h, which is included.  Commenting that out got rid of the errors.

Note You need to log in before you can comment on or make changes to this bug.