Bug 9555

Summary: Latest Xserver (from git) fails to compile (error: 'RTLD_DEFAULT' undeclared)
Product: xorg Reporter: Boris <voip>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: lowest CC: eric
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Possible fix none

Description Boris 2007-01-06 01:09:23 UTC
When compiling the latest xserver from git, I get the following error now.

ake[4]: Entering directory `/storage/temp/xserver/hw/xfree86/loader'
gcc -DHAVE_CONFIG_H -I. -I../../../include -I../../../hw/xfree86 -
I../../../hw/xfree86/include -I../../../hw/xfree86/common -
I../../../hw/xfree86/os-support -I../../../hw/xfree86/os-support/bus -
I../../../os -I./../parser -I./../dixmods/extmod -I./../vbe -
I../../../miext/cw -I./../int10 -I./../ddc -I./../i2c   -DIN_LOADER -
DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-
prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -
D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/X11/include -
I/usr/include/freetype2   -I../../../include -I../../../include -
I../../../Xext -I../../../composite -I../../../damageext -I../../../xfixes -
I../../../Xi -I../../../mi -I../../../miext/shadow  -I../../../miext/damage -
I../../../render -I../../../randr -I../../../fb -DHAVE_XORG_CONFIG_H -
I/usr/X11/include   -DXF86PM -g -O2 -MT dlloader.o -MD -MP -
MF .deps/dlloader.Tpo -c -o dlloader.o dlloader.c
dlloader.c: In function 'DLFindSymbol':
dlloader.c:116: error: 'RTLD_DEFAULT' undeclared (first use in this function)
dlloader.c:116: error: (Each undeclared identifier is reported only once
dlloader.c:116: error: for each function it appears in.)
make[4]: *** [dlloader.o] Error 1

I noticed about 2 days ago, some loader changes were made and it seems to be 
related to this new error.
Comment 1 David Ronis 2007-01-08 19:31:00 UTC
I can confirm this bug.  I just tried building from today's git sources and have
the same problem.  What's weird is that RTLD_DEFAULT is defined in
/usr/include/dlfcn.h (at least on my Slackware-11.0 box) and that file is
included in dlloader.c.  I've cheat to get around the bug, simply by copying the
missing define from dlfcn.h, but clearly, that isn't desirable and probably
masks a worse problem.

Comment 2 Michel Dänzer 2007-01-09 00:40:21 UTC
Created attachment 8339 [details] [review]
Possible fix

RTLD_DEFAULT is only defined if __GNU_SOURCE is defined. Maybe something like
this could work?

I don't really understand the purpose of this code though, as I haven't noticed
any libdrm symbol issues. Eric, can you elaborate?
Comment 3 Eric Anholt 2007-01-09 11:50:32 UTC
Since GNU_SOURCE is needed to enable all sorts of important defines and
prototypes on linux, why are we not just setting it all the time?

This usage was required to pick up the drm symbols on FreeBSD -- I came up with
an explanation why the previous code didn't work from the manpages when I was
talking about this fix on IRC, but I've forgotten what it was.
Comment 4 Michel Dänzer 2007-01-10 02:08:16 UTC
(In reply to comment #3)
> Since GNU_SOURCE is needed to enable all sorts of important defines and
> prototypes on linux, 

You mean on glibc. :)

> why are we not just setting it all the time?

Not sure, but FWIW

* It hasn't been needed for anything else so far.
* Is RTLD_DEFAULT available in all other environments as well?
Comment 5 Eric Anholt 2007-01-10 13:11:25 UTC
Fix committed.  _GNU_SOURCE is now always on for glibc.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.