Bug 43235

Summary: git version of xserver fails to compile
Product: xorg Reporter: Jos van Wolput <wolput>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: jeremyhu
Version: gitKeywords: regression
Hardware: All   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:

Description Jos van Wolput 2011-11-24 18:22:42 UTC
Latest git version of xserver fails to compile showing the following error:
---
Making all in dix
make[1]: Entering directory `/home/jos/src/xorg/git-master/xserver/dix'
make  all-am
make[2]: Entering directory `/home/jos/src/xorg/git-master/xserver/dix'
  CC     atom.lo
In file included from ../include/misc.h:109:0,
                 from atom.c:57:
../include/os.h:496:25: error: expected identifier or '(' before '__extension__'
In file included from atom.c:59:0:
../include/dix.h:532:22: warning: redundant redeclaration of 'ffs' [-Wredundant-decls]
atom.c: In function 'MakeAtom':
atom.c:134:12: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
atom.c: In function 'FreeAtom':
atom.c:186:7: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
make[2]: *** [atom.lo] Error 1
make[2]: Leaving directory `/home/jos/src/xorg/git-master/xserver/dix'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/jos/src/xorg/git-master/xserver/dix'
make: *** [all-recursive] Error 1
---
Comment 1 Jeremy Huddleston Sequoia 2011-11-28 09:59:33 UTC
Perhaps size_t is not defined...
#ifndef HAVE_STRNDUP
extern _X_EXPORT char * strndup(const char *str, size_t n);
#endif

Does adding this near the top of include/os.h fix your build failure:

#include <stdlib.h>
Comment 2 Jos van Wolput 2011-11-28 19:07:32 UTC
(In reply to comment #1)
> Does adding this near the top of include/os.h fix your build failure:
> 
> #include <stdlib.h>

Yes, it does fix the build failure.
Thanks!
Comment 3 Jos van Wolput 2011-11-28 20:31:21 UTC
(In reply to comment #1)
> Perhaps size_t is not defined...
> #ifndef HAVE_STRNDUP
> extern _X_EXPORT char * strndup(const char *str, size_t n);
> #endif
> 
> Does adding this near the top of include/os.h fix your build failure:
> 
> #include <stdlib.h>

Unfortunately patching /usr/include/xorg/os.h does introduce a build error in building git mesa:
---
In file included from /usr/include/xorg/misc.h:109:0,
                 from /usr/include/xorg/xf86str.h:37,
                 from /usr/include/xorg/xf86.h:44,
                 from xorg_tracker.h:41,
                 from xorg_exa.h:4,
                 from xorg_composite.h:4,
                 from xorg_composite.c:1:
/usr/include/xorg/os.h:498:25: error: expected identifier or ‘(’ before ‘__extension__’
In file included from /usr/include/xorg/randrstr.h:39:0,
                 from /usr/include/xorg/xf86Crtc.h:27,
                 from xorg_tracker.h:42,
                 from xorg_exa.h:4,
                 from xorg_composite.h:4,
                 from xorg_composite.c:1:
/usr/include/xorg/os.h:48:25: error: expected identifier or ‘(’ before ‘__extension__’
make[4]: *** [xorg_composite.o] Error 1
make[4]: Leaving directory `/home/jos/src/xorg/git-master/mesa/src/gallium/state_trackers/xorg'
make[3]: *** [subdirs] Error 1
make[3]: Leaving directory `/home/jos/src/xorg/git-master/mesa/src/gallium/state_trackers'
make[2]: *** [default] Error 1
make[2]: Leaving directory `/home/jos/src/xorg/git-master/mesa/src/gallium'
make[1]: *** [subdirs] Error 1
---
Comment 4 Jos van Wolput 2011-12-08 00:06:47 UTC
Fixed, no more build failures since latest git version!
Comment 5 Sérgio M. Basto 2012-01-13 02:07:58 UTC
(In reply to comment #4)
> Fixed, no more build failures since latest git version!

what is the fix ? I getting the same problem in fedora rawhide
Comment 6 Jeremy Huddleston Sequoia 2012-01-13 02:39:35 UTC
The "fix" is to grab the latest sources ... since the latest version builds, I don't want to spend time diving into exactly when your bug was fixed.
Comment 7 Sérgio M. Basto 2012-03-13 20:49:23 UTC
but still present in xorg-x11-server-1.12.0-1.fc17 .
the fix is very simple since is add #include <stdlib.h> before call os.h 
just FYI.
Comment 8 Sérgio M. Basto 2012-03-13 20:50:26 UTC
I got this issue also in i386
Comment 9 Sérgio M. Basto 2012-03-13 23:37:21 UTC
Sorry for spamming , but I was wrong or something went in my tests , 
so my lasts comments couldn't be correct.

I'm trying compile VirtualBox on Fedora rawhide .
and 
I got:
/usr/include/xorg/os.h:497:55: error: expected identifier or ‘(’ before ‘__extension__’

which is also related with 
#ifndef HAVE_STRNDUP
extern _X_EXPORT char * strndup(const char *str, size_t n);
#endif
Comment 10 Alan Coopersmith 2012-03-14 07:35:09 UTC
(In reply to comment #9)
> I'm trying compile VirtualBox on Fedora rawhide .

That's not this bug - you're adding comments to an already fixed bug about the
X server itself not building, and since it's marked resolved and on a different
topic, none of the X developers will be doing anything more with it.

Since you have a different problem compiling a different package, you should
file a bug in the bug tracker for that package, which is probably on
virtualbox.org.
Comment 11 Sérgio M. Basto 2012-04-12 22:06:02 UTC
(In reply to comment #1)
> Perhaps size_t is not defined...
> #ifndef HAVE_STRNDUP
> extern _X_EXPORT char * strndup(const char *str, size_t n);
> #endif
> 
> Does adding this near the top of include/os.h fix your build failure:
> 
> #include <stdlib.h>

on bug #47971, my conclusion is, HAVE_STRNDUP should be defined

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.