We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 257 - Build fails on Solaris 10 because of a redeclared function
Summary: Build fails on Solaris 10 because of a redeclared function
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 1.2
Hardware: Other Solaris
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
: 500 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-21 05:49 UTC by Laurent Blume
Modified: 2007-12-30 11:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Blume 2006-06-21 05:49:51 UTC
The build fails on Solaris, with the long error below.

From what I understand, the macro on line 165 of src/video/x11/SDL_x11sym.h redefines _XData32:

SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)

Which is different from the original in /usr/openwin/include/X11/Xlibint.h:
#ifdef LONG64
extern void _XRead32 (Display *dpy, long *data, long len);
extern void _XData32 (Display *dpy, long *data, unsigned long len);
#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
#else

Build is on Solaris 10 U1 AMD64, using Sun Studio 11.

The complete error:

/bin/bash ./libtool --mode=compile cc -fast -xarch=amd64a -I/usr/openwin/include -I/usr/X11/include -I./include -D_GNU_SOURCE=1  -DXTHREADS -D_REENTRANT -c ./src/video/x11/SDL_x11dyn.c  -o build/SDL_x11dyn.lo
 cc -fast -xarch=amd64a -I/usr/openwin/include -I/usr/X11/include -I./include -D_GNU_SOURCE=1 -DXTHREADS -D_REENTRANT -c ./src/video/x11/SDL_x11dyn.c  -KPIC -DPIC -o build/.libs/SDL_x11dyn.o
"src/video/x11/SDL_x11sym.h", line 165: identifier redeclared: _XData32
        current : function(pointer to struct _XDisplay {pointer to struct _XExtData {..} ext_data, pointer to struct _XFreeFuncs {..} free_funcs, int fd, int conn_checker, int proto_major_version, int proto_minor_version, pointer to char vendor, unsigned long resource_base, unsigned long resource_mask, unsigned long resource_id, int resource_shift, pointer to function(..) returning unsigned long resource_alloc, int byte_order, int bitmap_unit, int bitmap_pad, int bitmap_bit_order, int nformats, pointer to struct  {..} pixmap_format, int vnumber, int release, pointer to struct _XSQEvent {..} head, pointer to struct _XSQEvent {..} tail, int qlen, unsigned long last_request_read, unsigned long request, pointer to char last_req, pointer to char buffer, pointer to char bufptr, pointer to char bufmax, unsigned int max_request_size, pointer to struct _XrmHashBucketRec {..} db, pointer to function(..) returning int synchandler, pointer to char display_name, int default_screen, int nscreens, pointer to struct  {..} screens, unsigned long motion_buffer, unsigned long flags, int min_keycode, int max_keycode, pointer to unsigned long keysyms, pointer to struct  {..} modifiermap, int keysyms_per_keycode, pointer to char xdefaults, pointer to char scratch_buffer, unsigned long scratch_length, int ext_number, pointer to struct _XExten {..} ext_procs, array[128] of pointer to function(..) returning int event_vec, array[128] of pointer to function(..) returning int wire_vec, unsigned long lock_meaning, pointer to struct _XLockInfo {..} lock, pointer to struct _XInternalAsync {..} async_handlers, unsigned long bigreq_size, pointer to struct _XLockPtrs {..} lock_fns, pointer to function(..) returning void idlist_alloc, pointer to struct _XKeytrans {..} key_bindings, unsigned long cursor_font, pointer to struct _XDisplayAtoms {..} atoms, unsigned int mode_switch, unsigned int num_lock, pointer to struct _XContextDB {..} context_db, pointer to pointer to function(..) returning int error_vec, struct  {..} cms, pointer to struct _XIMFilter {..} im_filters, pointer to struct _XSQEvent {..} qfree, unsigned long next_event_serial_num, pointer to struct _XExten {..} flushes, pointer to struct _XConnectionInfo {..} im_fd_info, int im_fd_length, pointer to struct _XConnWatchInfo {..} conn_watchers, int watcher_count, pointer to char filedes, pointer to function(..) returning int savedsynchandler, unsigned long resource_max, int xcmisc_opcode, pointer to struct _XkbInfoRec {..} xkb_info, pointer to struct _XtransConnInfo {..} trans_conn}, pointer to long, unsigned int) returning int
        previous: function(pointer to struct _XDisplay {pointer to struct _XExtData {..} ext_data, pointer to struct _XFreeFuncs {..} free_funcs, int fd, int conn_checker, int proto_major_version, int proto_minor_version, pointer to char vendor, unsigned long resource_base, unsigned long resource_mask, unsigned long resource_id, int resource_shift, pointer to function(..) returning unsigned long resource_alloc, int byte_order, int bitmap_unit, int bitmap_pad, int bitmap_bit_order, int nformats, pointer to struct  {..} pixmap_format, int vnumber, int release, pointer to struct _XSQEvent {..} head, pointer to struct _XSQEvent {..} tail, int qlen, unsigned long last_request_read, unsigned long request, pointer to char last_req, pointer to char buffer, pointer to char bufptr, pointer to char bufmax, unsigned int max_request_size, pointer to struct _XrmHashBucketRec {..} db, pointer to function(..) returning int synchandler, pointer to char display_name, int default_screen, int nscreens, pointer to struct  {..} screens, unsigned long motion_buffer, unsigned long flags, int min_keycode, int max_keycode, pointer to unsigned long keysyms, pointer to struct  {..} modifiermap, int keysyms_per_keycode, pointer to char xdefaults, pointer to char scratch_buffer, unsigned long scratch_length, int ext_number, pointer to struct _XExten {..} ext_procs, array[128] of pointer to function(..) returning int event_vec, array[128] of pointer to function(..) returning int wire_vec, unsigned long lock_meaning, pointer to struct _XLockInfo {..} lock, pointer to struct _XInternalAsync {..} async_handlers, unsigned long bigreq_size, pointer to struct _XLockPtrs {..} lock_fns, pointer to function(..) returning void idlist_alloc, pointer to struct _XKeytrans {..} key_bindings, unsigned long cursor_font, pointer to struct _XDisplayAtoms {..} atoms, unsigned int mode_switch, unsigned int num_lock, pointer to struct _XContextDB {..} context_db, pointer to pointer to function(..) returning int error_vec, struct  {..} cms, pointer to struct _XIMFilter {..} im_filters, pointer to struct _XSQEvent {..} qfree, unsigned long next_event_serial_num, pointer to struct _XExten {..} flushes, pointer to struct _XConnectionInfo {..} im_fd_info, int im_fd_length, pointer to struct _XConnWatchInfo {..} conn_watchers, int watcher_count, pointer to char filedes, pointer to function(..) returning int savedsynchandler, unsigned long resource_max, int xcmisc_opcode, pointer to struct _XkbInfoRec {..} xkb_info, pointer to struct _XtransConnInfo {..} trans_conn}, pointer to long, unsigned long) returning void : "/usr/openwin/include/X11/Xlibint.h", line 441
cc: acomp failed for ./src/video/x11/SDL_x11dyn.c
*** Error code 1
make: Fatal error: Command failed for target `build/SDL_x11dyn.lo'
Comment 1 Sam Lantinga 2006-06-23 21:12:29 UTC
This is fixed in subversion.
Comment 2 Thomas Klausner 2006-10-26 15:36:31 UTC
Could you please specify which SVN revision fixed this?
Comment 3 Ryan C. Gordon 2006-10-26 17:51:26 UTC
Revision #2450, I think, "fixed" it. But Revision #2548 will disable runtime loading of X11 on platforms without gcc4 (so it dynamically links at build time instead, like the old behaviour) ... loading X11 at runtime is mostly useful for shipping binaries on Linux distributions that may or may not want to supply that dependency...on Solaris, it's probably safe to assume SDL users will have Xlib installed and functioning, so it's not a big deal to abandon the dynamic loading there.

Both patches are in SDL 1.2.11, I think.

--ryan.
Comment 4 Serge van den Boom 2007-10-06 13:58:37 UTC
*** Bug 500 has been marked as a duplicate of this bug. ***
Comment 5 Serge van den Boom 2007-10-06 14:00:48 UTC
It's now one year later, and SDL 1.2.12 triggers the exact same bug.
Comment 6 Ryan C. Gordon 2007-10-06 16:40:26 UTC
Is it possible that Solaris moved to gcc4, so it started triggering this again?

(Try configuring with --disable-x11-shared too.)

--ryan.
Comment 7 Serge van den Boom 2007-10-06 16:52:32 UTC
Oh, I should probably have said that this is no system gcc. I compiled it from source (4.2.1).

But I don't think gcc is at fault; the prototype really is different.
/usr/openwin/include/X11/Xlibint.h contains
    extern void _XData32 (Display *dpy, long *data, unsigned long len);
while src/video/x11/SDL_x11sym.h contains
    SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
(Note that both the return type and the type of the last argument differ.)

I have now changed the latter to
    SDL_X11_SYM(void,_XData32,(Display *dpy,register long *data,unsigned long len),(dpy,data,len),return)

and the build completes, and other libraries can link against it. I haven't yet tested an application with the built SDL.

Comment 8 Sam Lantinga 2007-12-29 14:34:55 UTC
Oh, I see the problem.  I'm using Sun Studio's cc rather than gcc.
My configure output is:
checking for X... libraries /usr/openwin/lib, headers /usr/openwin/include
checking whether -R must be followed by a space... no
checking for gethostbyname... no
checking for gethostbyname in -lnsl... yes
checking for connect... no
checking for connect in -lsocket... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for X11/extensions/Xrandr.h... no
checking for X11/extensions/dpms.h... yes
Comment 9 Sam Lantinga 2007-12-30 10:50:31 UTC
Okay, I finally got gcc 4.1.2 compiled on Solaris, but the -fvisibility=hidden stuff doesn't work.  I disabled dynamic X11 when gcc doesn't support it, but I'm not sure if that takes care of your environment.

Does -fvisibility=hidden work for you?  If so, how did you get it working? :)
Comment 10 Serge van den Boom 2007-12-30 11:20:55 UTC
Hmm? Where does -fvisibility-hidden come in?

I don't have access to the Solaris machine where I encountered this problem at, at the moment, so I can't test anything right now.
Comment 11 Sam Lantinga 2007-12-30 11:41:29 UTC
The bug would only show up if dynamic X11 is enabled, and it's only enabled if
-fvisibility=hidden is supported by the compiler (to avoid symbol collisions
between SDL's X11 symbols and the real ones)

I'll mark this fixed for now, go ahead and reopen it if it's still active with
SDL in subversion (or 1.2.13 release)

Thanks!