Opened 3 years ago

Closed 3 years ago

#63105 closed defect (fixed)

ghostscript @9.54.0 does not build with GCC 4.2 because "#pragma GCC diagnostic not allowed inside functions"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: evanmiller (Evan Miller)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: leopard tiger Cc: evanmiller (Evan Miller)
Port: ghostscript

Description

make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_print_ghostscript/ghostscript/work/ghostpdl-9.54.0'
/usr/bin/gcc-4.2 -std=gnu99   -O2 -DNDEBUG -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -D"strnlen(a,b)=strlen(a)" -pipe -Os -arch ppc -DHAVE_RESTRICT=1 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1  -I./base -o ./soobj/aux/genconf ./base/genconf.c  -lm -ldl  -liconv -L/opt/local/lib -lidn -lpaper -L/opt/local/lib -ltiff  -L/opt/local/lib -lfontconfig -lfreetype -lfreetype -L/opt/local/lib -lopenjp2  -lz
./soobj/aux/genarch ./soobj/arch.h ./base/../arch/osx-x86-x86_64-ppc-gcc.h
/usr/bin/gcc-4.2 -std=gnu99  -DHAVE_MKSTEMP  -DHAVE_FSEEKO  -DHAVE_FONTCONFIG -DHAVE_LIBIDN -DHAVE_SETLOCALE   -DHAVE_BSWAP32  -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF  -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -fPIC           -isystem/opt/local/include  -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -D"strnlen(a,b)=strlen(a)" -pipe -Os -arch ppc -DHAVE_RESTRICT=1 -DUSE_LIBICONV_GNU  -DUSE_LIBPAPER  -fno-strict-aliasing -DHAVE_POPEN_PROTO=1   -I./soobj -I./base -I./devices  -DWHICH_CMS="lcms2" -o ./soobj/gp_getnv.o -c ./base/gp_getnv.c
In file included from ./base/scommon.h:25,
                 from ./base/srdline.h:23,
                 from ./base/gp.h:41,
                 from ./base/gp_getnv.c:22:
./base/stdint_.h:184:6: warning: "ARCH_SIZEOF_SIZE_T" is not defined
./base/stdint_.h:245:6: warning: "ARCH_SIZEOF_SIZE_T" is not defined
In file included from ./base/srdline.h:23,
                 from ./base/gp.h:41,
                 from ./base/gp_getnv.c:22:
./base/scommon.h: In function ‘stream_cursor_read_init’:
./base/scommon.h:122: error: #pragma GCC diagnostic not allowed inside functions
./base/scommon.h:123: error: #pragma GCC diagnostic not allowed inside functions
./base/scommon.h:129: error: #pragma GCC diagnostic not allowed inside functions
./base/scommon.h: In function ‘stream_cursor_write_init’:
./base/scommon.h:137: error: #pragma GCC diagnostic not allowed inside functions
./base/scommon.h:138: error: #pragma GCC diagnostic not allowed inside functions
./base/scommon.h:144: error: #pragma GCC diagnostic not allowed inside functions
make[2]: *** [soobj/gp_getnv.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_print_ghostscript/ghostscript/work/ghostpdl-9.54.0'
make[1]: *** [so-only-subtarget] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_print_ghostscript/ghostscript/work/ghostpdl-9.54.0'
make: *** [so] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_print_ghostscript/ghostscript/work/ghostpdl-9.54.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_print_ghostscript/ghostscript/work/ghostpdl-9.54.0" && /usr/bin/make -j1 -w so 

Attachments (3)

main.log (81.3 KB) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Main.log from PPC Leopard
patch-pragmas.diff (935 bytes) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Patch to remove #pragma statements fro GCC 4.2
move-pragmas-outside-functions.diff (1.2 KB) - added by evanmiller (Evan Miller) 3 years ago.
Patch to move pragmas outside of function bodies, instead of deleting them (submitted upstream also)

Download all attachments as: .zip

Change History (13)

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Leopard

comment:1 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

I created a first bug report for undefinded "ARCH_SIZEOF_SIZE_T": https://bugs.ghostscript.com/show_bug.cgi?id=703947

comment:2 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Removing the #pragma lines allowed Ghostscript to build. A patch file is saved and not yet tested. Right now I am trying to build with GCC7.

comment:3 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

I created a second bug report for #pragma: https://bugs.ghostscript.com/show_bug.cgi?id=703948

comment:4 in reply to:  2 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Build succeeded, make check too!

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-pragmas.diff added

Patch to remove #pragma statements fro GCC 4.2

comment:5 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Portfile has been changed like this:

--- /opt/local/var/macports/sources/nue.de.rsync.macports.org/macports/release/tarballs/ports/print/ghostscript/Portfile.orig	2021-06-04 18:50:25.000000000 +0200
+++ /opt/local/var/macports/sources/nue.de.rsync.macports.org/macports/release/tarballs/ports/print/ghostscript/Portfile	2021-06-17 14:39:54.000000000 +0200
@@ -39,6 +39,9 @@
 # https://bugs.ghostscript.com/show_bug.cgi?id=703880
 patchfiles-append   patch-configure.ac.diff
 
+# Remove #pragma statements which GCC 4.2 cannot accept:
+patchfiles-append   patch-pragmas.diff
+
 checksums           ghostpdl-9.54.0.tar.gz \
                     rmd160  a48ecd441c761a9401a5e4a34ea90afd6936d419 \
                     sha256  63e54cddcdf48ea296b6315353f86b8a622d4e46959b10d536297e006b85687b \

comment:6 Changed 3 years ago by kencu (Ken)

Keywords: tiger added
Summary: ghostscript @9.54.0 does n ot build on PPC Leopard with GCC 4.2 because "#pragma GCC diagnostic not allowed inside functions"ghostscript @9.54.0 does not build with GCC 4.2 because "#pragma GCC diagnostic not allowed inside functions"

comment:7 Changed 3 years ago by kencu (Ken)

same issue with Leopard i386 building with gcc-4.2, of course.

comment:8 Changed 3 years ago by evanmiller (Evan Miller)

Proposed fix, blacklisting old compilers instead of modifying the source code: https://github.com/macports/macports-ports/pull/11628

comment:9 Changed 3 years ago by evanmiller (Evan Miller)

Cc: evanmiller added

Changed 3 years ago by evanmiller (Evan Miller)

Patch to move pragmas outside of function bodies, instead of deleting them (submitted upstream also)

comment:10 Changed 3 years ago by evanmiller (Evan Miller)

Owner: set to evanmiller
Resolution: fixed
Status: newclosed

In ad6a8cc74656192a9e47e6994e9f06d212172bd9/macports-ports (master):

ghostscript: Fix build with GCC 4.2

Closes: #63105

Note: See TracTickets for help on using tickets.