Bug 702474

Summary: GhostPDL build fails with non-local jpeg library due to missing jmemsys.h
Product: Ghostscript Reporter: Nick Gaya <nicholasgaya+bugzilla>
Component: Build ProcessAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 9.52   
Hardware: Macintosh   
OS: MacOS X   
Customer: Word Size: ---

Description Nick Gaya 2020-06-07 01:08:58 UTC
I am currently trying to update the MacPorts GhostScript port (https://ports.macports.org/port/ghostscript/) from version 9.50 to 9.52.  When building GhostPDL 9.52 from source on Mac OS, I encountered an issue related to the JPEG library.

The build uses the MacPorts version of jpeg rather than the local version included in the GhostPDL source distribution.  Although the configuration script detects that jmemsys.h is not available, the build fails when it is absent.

Relevant configure output:

> :info:configure checking for local jpeg library source... no
> :info:configure checking for jpeg_set_defaults in -ljpeg... yes
> :info:configure checking jpeglib.h usability... yes
> :info:configure checking jpeglib.h presence... yes
> :info:configure checking for jpeglib.h... yes
> :info:configure checking for jmemsys.h... no

Build output:

> :info:build /usr/bin/clang  -DHAVE_MKSTEMP  -DHAVE_FSEEKO  -DHAVE_FONTCONFIG -DHAVE_LIBIDN -DHAVE_SETLOCALE -DHAVE_SSE2  -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  -pipe -Os -arch x86_64 -DHAVE_RESTRICT=1 -DUSE_LIBICONV_GNU -DUSE_LIBPAPER  -fno-strict-aliasing -DHAVE_POPEN_PROTO=1   -DPCL_INCLUDED -DPSI_INCLUDED -DXPS_INCLUDED  -DJPG_INCLUDED -DPWG_INCLUDED -DTIFF_INCLUDED -DJBIG2_INCLUDED -DJP2K_INCLUDED -DPNG_INCLUDED  -I./psi -I./pcl/pl -I./base -I./devices -I./soobj -c -DSHARE_LIBTIFF=1 -Isrc/libtiff -I/libtiff -I./soobj -I/opt/local/include -Isrc ./gpdl/tifftop.c -o ./soobj/tifftop_1.o
> :info:build In file included from ./gpdl/tifftop.c:29:
> :info:build ./base/jmemcust.h:21:10: fatal error: 'jmemsys.h' file not found
> :info:build #include "jmemsys.h"
> :info:build          ^~~~~~~~~~~
> :info:build 1 error generated.
> :info:build make[2]: *** [soobj/tifftop_1.o] Error 1

Is it possible to use the autoconf DONT_HAVE_JMEMSYS_H variable to avoid this error?
Comment 1 Nick Gaya 2020-06-07 01:25:13 UTC
Possibly relevant: https://bugs.ghostscript.com/show_bug.cgi?id=700564

That issue was reportedly resolved by http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=0fb8c19f9b84

Would it be possible to add a similar check in gpdl/tifftop.c?
Comment 2 Nick Gaya 2020-06-07 19:27:42 UTC
I just noticed this has already been patched on master.

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=6756b355c238

I will add this patch to the MacPorts port.