[vbox-dev] x11-clipboard.cpp (2.2.4 OSE) fails to compile on Solaris 10 U6 with /usr/sfw/bin/gcc

Matt Burt developer10 at vocalistic.com
Tue Jun 2 19:31:10 GMT 2009


Hi all,

Environment as follows :-

Platform : Solaris 10 U6
Compiler : /usr/sfw/bin/gcc (delivered with Solaris 10)
Sources : VirtualBox 2.2.4 OSE

The following errors are encountered when trying to compile
src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp :-

--------
x11-clipboard.cpp:2036: error: conflicting declaration 'const char XtStrings[]'
/usr/include/X11/StringDefs.h:268: error: 'XtStrings' has a previous declaration as `char XtStrings[]'
x11-clipboard.cpp:2036: error: declaration of `const char XtStrings[]'
/usr/include/X11/StringDefs.h:268: error: conflicts with previous declaration `char XtStrings[]'
x11-clipboard.cpp:2038: error: conflicting declaration 'const char XtShellStrings[]'
/usr/include/X11/Shell.h:190: error: 'XtShellStrings' has a previous declaration as `char XtShellStrings[]'
x11-clipboard.cpp:2038: error: declaration of `const char XtShellStrings[]'
/usr/include/X11/Shell.h:190: error: conflicts with previous declaration `char XtShellStrings[]'
--------

/usr/include/X11/StringDefs.h on this platform contains something like
the following :-

--------
#if __STDC__
#define _XtConst_ const
#else
#define _XtConst_ /**/
#endif
extern _XtConst_ char XtStrings[];
--------

On this platform however, /usr/sfw/bin/gcc declares __STDC__ as 0 when
parsing system headers. Hence the error.

Solution seems to be to delete lines 2036-2038 of x11-clipboard.cpp.
These declarations have already been encountered in the X11 header files
and so are not needed.

Patch follows. This has only been tested on Solaris 10 :-

----- Start Patch ------
--- src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp.orig	Fri May
29 19:36:45 2009
+++ src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp	Tue Jun
2 12:50:23 2009
@@ -2033,10 +2033,6 @@
     RTMemFree(list);
 }
 
-const char XtStrings [] = "";
-_WidgetClassRec* applicationShellWidgetClass;
-const char XtShellStrings [] = "";
-
 #define MAX_BUF_SIZE 256
 
 static bool testStringFromX11(VBOXCLIPBOARDCONTEXTX11 *pCtx, uint32_t
cbBuf,
--- src/VBox/GuestHost/SharedClipboard/Makefile.kmk.orig	Fri May
29 19:36:45 2009
+++ src/VBox/GuestHost/SharedClipboard/Makefile.kmk	Mon Jun  1
14:31:09 2009
@@ -32,7 +32,7 @@
    tstClipboardX11_TEMPLATE = VBOXR3TSTEXE
    tstClipboardX11_DEFS     = VBOX_WITH_HGCM TESTCASE
    tstClipboardX11_SOURCES  = x11-clipboard.cpp clipboard-helper.cpp
-   tstClipboardX11_LIBS     = $(LIB_RUNTIME)
+   tstClipboardX11_LIBS     = $(LIB_RUNTIME) X11 Xt
 
    tstClipboardX11Smoke_TEMPLATE = VBOXR3TSTEXE
    tstClipboardX11Smoke_DEFS     = VBOX_WITH_HGCM SMOKETEST

------ End Patch ------






More information about the vbox-dev mailing list