[tlbuild] Bug in libpng affecting Solaris 10

Mojca Miklavec mojca.miklavec.lists at gmail.com
Sat Jan 13 08:52:30 CET 2018


Dear Karl,

This problem seems to be back.
    https://sourceforge.net/p/libpng/bugs/245/

I didn't investigate the details yet.

/opt/csw/bin/gcc-5.5 -m64 -DHAVE_CONFIG_H -I. -I../../../libs/libpng
-I../../../libs/libpng/libpng-src
-I/tmp/texlive/Build/source/Work-x86_64/libs/zlib/include
-DPNG_CONFIGURE_LIBPNG -DPNG_NO_MMX_CODE  -fvisibility=hidden
-Wimplicit -Wreturn-type -Wdeclaration-after-statement
-Wno-unknown-pragmas -g -O2 -MT libpng-src/png.o -MD -MP -MF
$depbase.Tpo -c -o libpng-src/png.o
../../../libs/libpng/libpng-src/png.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.5.0/include-fixed/iso/stdlib_iso.h:39:0,
                 from /usr/include/stdlib.h:18,
                 from ../../../libs/libpng/libpng-src/pngpriv.h:44,
                 from ../../../libs/libpng/libpng-src/png.c:14:
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.5.0/include-fixed/sys/feature_tests.h:346:2:
error: #error "Compiler or options invalid for pre-UNIX 03 X/Open
applications      and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^

Mojca

On 23 March 2016 at 09:48, Mojca Miklavec wrote:
> On 15 March 2016 at 22:08, Karl Berry wrote:
>>     Would it be possible to include it into TL sources to avoid having to
>>     set additional flags when building on Solaris?
>>
>> This is software, anything's possible.  Before I merge it, though, do
>> you know if another libpng release is planned for the near-ish future?
>> Thanks, K.
>
> They released 1.6.22beta03 two weeks ago. In the 1.6.21 series it took
> them about a month to go from beta01 to the final release (which of
> course doesn't mean that one should naively extrapolate).
>
> I'm attaching a patch for TL (it applies with an offset of 7 lines),
> but I don't know how to properly regenerate the configure files
> (running autoreconf didn't change anything).
>
> Mojca
-------------- next part --------------
Index: libs/libpng/libpng-PATCHES/ChangeLog
===================================================================
--- libs/libpng/libpng-PATCHES/ChangeLog	(revision 40105)
+++ libs/libpng/libpng-PATCHES/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2016-03-23  Mojca Miklavec <mojca.miklavec.lists at gmail.com>
+
+	Create patch-02-backport-20160314-12e63e9:
+	* libpng-src/configure.ac: Force back to C89 if needed
+	(needed on Solaris with GCC 5 and later)
+
 2009-08-13  Martin Schröder <martin at oneiros.de>
 
 	* patch-01-static: Remove; has been integrated into libpng-1.2.39.
Index: libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9
===================================================================
--- libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9	(nonexistent)
+++ libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9	(working copy)
@@ -0,0 +1,36 @@
+https://github.com/glennrp/libpng/commit/12e63e91af1378225993b36e25ce3252b54e751a.patch
+
+From 12e63e91af1378225993b36e25ce3252b54e751a Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Mon, 14 Mar 2016 16:21:06 +0100
+Subject: [PATCH] Force back to C89 if needed. This fixes #245
+
+---
+ configure.ac | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 3b8746a..ee3ea05 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -114,6 +114,20 @@ AC_ARG_ENABLE(werror,
+       CFLAGS="$sav_CFLAGS"
+     fi],)
+ 
++# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
++# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
++# This is incompatible with the new default mode, so we test for that and force the 
++AC_MSG_CHECKING([if we need to force back C standard to C89])
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
++#include <stdio.h>
++])],AC_MSG_RESULT(no),[
++if test "x$GCC" != "xyes"; then
++  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
++fi
++AC_MSG_RESULT(yes)
++CFLAGS="$CFLAGS -std=c89"
++])
++
+ # Checks for header files.
+ AC_HEADER_STDC
+ 
Index: libs/libpng/libpng-src/configure.ac
===================================================================
--- libs/libpng/libpng-src/configure.ac	(revision 40105)
+++ libs/libpng/libpng-src/configure.ac	(working copy)
@@ -107,6 +107,20 @@
       CFLAGS="$sav_CFLAGS"
     fi],)
 
+# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
+# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
+# This is incompatible with the new default mode, so we test for that and force the 
+AC_MSG_CHECKING([if we need to force back C standard to C89])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
+#include <stdio.h>
+])],AC_MSG_RESULT(no),[
+if test "x$GCC" != "xyes"; then
+  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
+fi
+AC_MSG_RESULT(yes)
+CFLAGS="$CFLAGS -std=c89"
+])
+
 # Checks for header files.
 AC_HEADER_STDC
 


More information about the tlbuild mailing list