Bug 178354 - Undefined pthread functions in gcc 4.0.2
Summary: Undefined pthread functions in gcc 4.0.2
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc   
(Show other bugs)
Version: 4
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2006-01-19 19:43 UTC by Will Cladek
Modified: 2007-11-30 22:11 UTC (History)
0 users

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

Attachments (Terms of Use)

Description Will Cladek 2006-01-19 19:43:36 UTC
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)))

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):

How reproducible:

Steps to Reproduce:

Additional info:

Comment 1 Jakub Jelinek 2006-01-20 15:08:40 UTC
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 17:31:29 UTC
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.