pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/54722: devel/glib2 still does not compile on Solaris 11.3



* On 2019-11-27 at 09:01 GMT, Clausen, Jörn wrote:

> >   _XOPEN_SOURCE=1 is completely incompatible with C99 that glib2
> >   requires.  I guess Solaris 11.x removed the feature tests errors?
> 
> Oracle reworked /usr/include/sys/feature_tests.h with a recent patch to
> 11.3. I had problems compiling several packages before upgrading to the
> latest patch level of Solaris 11.3. Sometimes adding random combinations of
> _XOPEN_SOURCE or _XPG* to CPPFLAGS helped, sometimes not. Using the latest
> version of 11.3, these "fixes" were not necessary any more.
> 
> glib2 is the exception to this rule, see pkg/54634. But after taking a
> closer look at /usr/include/sys/socket.h, I can offer this patch:
> 
> --- Makefile    2019/11/27 07:23:05     1.1
> +++ Makefile    2019/11/27 08:58:20
> @@ -13,6 +13,7 @@
> 
>  MAKE_ENV+= LD_LIBRARY_PATH=${WRKSRC}/output/gio:${WRKSRC}/output/glib:${WRKSRC}/output/gobject:${WRKSRC}/output/gmodule
> 
> +CPPFLAGS.SunOS+=-D_XPG4_2 -D__EXTENSIONS__

So the tl;dr is that you should never set _XPG*, I don't know if
Solaris removed the comment from feature tests too but it should be
documented in there not to set them.

The correct way to set _XPG* is via _XOPEN_SOURCE, and setting
_XOPEN_SOURCE depends on your C compilation environment.  I've tried
to summarise how to fix this here;

  https://gist.github.com/jperkin/b08f9108daf8d0ac695067d71f882a9d

In the case of glib2, we already set USE_LANGUAGES=c99 so in theory do
not need to perform any of the __STDC_VERSION__ checks, and can just
explicitly require _XOPEN_SOURCE=600.  If you set that I assume it
still works for you?

There's a separate question of why this is failing on Solaris 11.x and
not on illumos, especially as building with _XOPEN_SOURCE < 600 with a
C99 compiler should be a hard fail.

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index