Subject: pkg/33913: devel/glib2 - in /usr/pkg/lib/glib-2.0/include/glibconfig.h the G_HAVE_GNUC_VARARGS macro causes problems with SunStudio 11 C++ compiler on Solaris
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <raymond.meyer@rambler.ru>
List: pkgsrc-bugs
Date: 07/04/2006 10:05:00
>Number:         33913
>Category:       pkg
>Synopsis:       devel/glib2 - in /usr/pkg/lib/glib-2.0/include/glibconfig.h the G_HAVE_GNUC_VARARGS macro causes problems with SunStudio 11 C++ compiler on Solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 04 10:05:00 +0000 2006
>Originator:     raymond
>Release:        
>Organization:
>Environment:
SunOS e450 5.10 Generic_118833-17 sun4u sparc SUNW,Ultra-4

>Description:
While building www/firefox package with SunStudio 11 compilers on Sparc Solaris, I got the following error:

Building deps for ./unix/nsGNOMERegistry.cpp
CC -o nsGNOMERegistry.o -c  -DMOZILLA_INTERNAL_API -DOSTYPE=\"SunOS5\" -DOSARCH=\"SunOS\" -DBUILD_ID=0000000000 -I. -I../../dist/include/xpcom -I../../dist/include/string -I../../dist/include/unicharutil -I../../dist/include/mimetype -I../../dist/include/uriloader -I../../dist/include/necko -I../../dist/include/rdf -I../../dist/include/webshell -I../../dist/include/plugin -I../../dist/include/pref -I../../dist/include/intl -I../../dist/include/uconv -I../../dist/include/docshell -I../../dist/include/windowwatcher -I../../dist/include/embed_base -I../../dist/include/toolkitcomps -I../../dist/include/exthandler -I../../dist/include -I../../dist/include/nspr -I/opt/pkg/include -I/opt/pkg/include  -I../../dist/sdk/include -I/usr/openwin/include   -KPIC  -DPNG_NO_ASSEMBLER_CODE -I/opt/pkg/include -DGLX_GLXEXT_LEGACY -I/opt/pkg/include/freetype2 -I/usr/include  -I/usr/openwin/include -xO3 -xtarget=ultra -features=%all -I/opt/pkg/include -DGLX_GLXEXT_LEGACY -I/opt/pkg/include/freety
 pe2 -I/usr/include -xbuiltin=%all -features=tmplife -pthread -mt  -DNDEBUG -DTRIMMED -xO3 -xtarget=ultra -I/opt/pkg/include/gtk-2.0 -I/opt/pkg/lib/gtk-2.0/include -I/opt/pkg/include/atk-1.0 -I/opt/pkg/include/cairo -I/opt/pkg/include/pango-1.0 -I/opt/pkg/include/glib/glib-2.0 -I/opt/pkg/lib/glib-2.0/include    -DPNG_NO_ASSEMBLER_CODE -I/opt/pkg/include -DGLX_GLXEXT_LEGACY -I/opt/pkg/include/freetype2 -I/usr/include  -I/usr/openwin/include -DMOZILLA_VERSION=\"1.8.0.4\" -DMOZILLA_VERSION_U=1.8.0.4 -DSOLARIS=1 -DNSCAP_DISABLE_DEBUG_PTR_TYPES=1 -DD_INO=d_ino -DSTDC_HEADERS=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_SIGINFO_T=1 -DHAVE_INT16_T=1 -DHAVE_INT32_T=1 -DHAVE_INT64_T=1 -DHAVE_UINT=1 -DHAVE_UINT_T=1 -DHAVE_UINT16_T=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_BYTEORDER_H=1 -DHAVE_GETOPT_H=1 -DHAVE_MEMORY_H=1 -DHAVE_UNISTD_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_MALLOC_H=1 -DHAVE_X11_XKBLIB_H=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_STATFS_H=1 -DHAVE_LIBM=1 -DHAVE_LIBDL=1 -DHAVE_LIBSOCKET=1 -DFUNCPROTO=15 -DHAVE_X
 SHM=1 -D_REENTRANT=1 -DHAVE_RANDOM=1 -DHAVE_STRERROR=1 -DHAVE_LCHOWN=1 -DHAVE_FCHMOD=1 -DHAVE_SNPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_RINT=1 -DHAVE_STAT64=1 -DHAVE_LSTAT64=1 -DHAVE_FLOCKFILE=1 -DHAVE_LOCALTIME_R=1 -DHAVE_STRTOK_R=1 -DHAVE_LANGINFO_CODESET=1 -DVA_COPY=va_copy -DHAVE_VA_COPY=1 -DHAVE_I18N_LC_MESSAGES=1 -DMOZ_ENABLE_CANVAS=1 -DMOZ_DEFAULT_TOOLKIT=\"gtk2\" -DMOZ_WIDGET_GTK2=1 -DMOZ_ENABLE_XREMOTE=1 -DMOZ_X11=1 -DMOZ_PHOENIX=1 -DMOZ_BUILD_APP=browser -DMOZ_XUL_APP=1 -DMOZ_DISTRIBUTION_ID=\"org.mozilla\" -DMOZ_ENABLE_XFT=1 -DOJI=1 -DIBMBIDI=1 -DMOZ_VIEW_SOURCE=1 -DACCESSIBILITY=1 -DMOZ_XPINSTALL=1 -DMOZ_JSLOADER=1 -DMOZ_XTF=1 -DMOZ_MATHML=1 -DMOZ_SVG=1 -DMOZ_SVG_RENDERER_CAIRO=1 -DMOZ_UPDATE_CHANNEL=default -DMOZ_LOGGING=1 -DMOZ_USER_DIR=\".mozilla\" -DMOZ_XUL=1 -DMOZ_PROFILELOCKING=1 -DMOZ_DLL_SUFFIX=\".so\" -DXP_UNIX=1 -DUNIX_ASYNC_DNS=1 -DJS_THREADSAFE=1 -DNS_PRINT_PREVIEW=1 -DNS_PRINTING=1 -DMOZ_ACCESSIBILITY_ATK=1 -DMOZILLA_LOCALE_VERSION=\"1.8\" -DMOZILLA_REGION_
 VERSION=\"1.8\" -DMOZILLA_SKIN_VERSION=\"1.8\"  -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT ./unix/nsGNOMERegistry.cpp
"/opt/pkg.obj/www/firefox/work.e450/.buildlink/include/glib/glib-2.0/glib/gmessages.h", line 142: Error: "," expected instead of "...".
"/opt/pkg.obj/www/firefox/work.e450/.buildlink/include/glib/glib-2.0/glib/gmessages.h", line 145: Error: "," expected instead of "...".
"/opt/pkg.obj/www/firefox/work.e450/.buildlink/include/glib/glib-2.0/glib/gmessages.h", line 148: Error: "," expected instead of "...".
"/opt/pkg.obj/www/firefox/work.e450/.buildlink/include/glib/glib-2.0/glib/gmessages.h", line 151: Error: "," expected instead of "...".
"/opt/pkg.obj/www/firefox/work.e450/.buildlink/include/glib/glib-2.0/glib/gmessages.h", line 154: Error: "," expected instead of "...".
5 Error(s) detected.
make[3]: *** [nsGNOMERegistry.o] Error 5
make[3]: Leaving directory `/opt/pkg.obj/www/firefox/work.e450/mozilla/uriloader/exthandler'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/opt/pkg.obj/www/firefox/work.e450/mozilla/uriloader'
make[1]: *** [tier_9] Error 2
make[1]: Leaving directory `/opt/pkg.obj/www/firefox/work.e450/mozilla'
gmake: *** [default] Error 2
*** Error code 2

Stop.
bmake: stopped in /opt/pkgsrc/www/firefox


The problem here is the following file:

/usr/pkg/lib/glib-2.0/include/glibconfig.h

it has the following macro:

#define G_HAVE_GNUC_VARARGS 1

SunStudio C compiler supports GNUC_VARARGS, however C++ compiler does not. When devel/glib2 is configured and built, it detects that GNUC_VARARGS are supported by C compiler, so it defines the above macro. Package www/firefox uses glib2 headers, but the compiler used during compilation is C++, so it fails, because Sun C++ compiler does not support GNUC_VARARGS.

To solve the problem I had to manuall edit /usr/pkg/lib/glib-2.0/include/glibconfig.h and define the macro as follows:

#ifndef __cplusplus
# define G_HAVE_GNUC_VARARGS 1
#endif

I think this needs to be done during devel/glib2 configure and build. I'm not sure how glibconfig.h file is generated, so the scripts that generate that file need to be modified.
>How-To-Repeat:

>Fix: