Bug 696665

Summary: ghostscript-9.19rc1 configure/make/install does no longer work as before (up to 9.18)
Product: Ghostscript Reporter: jsmeix
Component: Build ProcessAssignee: Chris Liddell (chrisl) <chris.liddell>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: add_brackets_for_old_autoconf.patch

Description jsmeix 2016-03-17 02:11:22 UTC
Currently this report is only meant as an early notification
about possible backward incompatible issues
with configure/make/install since ghostscript-9.19rc1.

I did not yet analyze any details.

Here only the plain symptoms:

Since ghostscript-9.19rc1 the configure/make/install
calls in the openSUSE build service
that worked all the time up to GhostSctipt 9.18
fail on all openSUSE versions and platforms
with two different errors.

In ghostscript-9.19rc1/doc/News.htm there is
no backward incompatible change regarding
configure/make/install mentioned.

How I configure and make Ghostscript (i.e. what worked
up to version 9.18 - from our ghostscript.spec file):
----------------------------------------------------------------
%build

export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
autoreconf -fi

%define gs_font_path /usr/share/fonts/truetype:/usr/share/fonts/Type1:/usr/share/fonts/CID:/usr/share/fonts/URW

# "export SUSE_ASNEEDED=0" disables -Wl,--as-needed linker flags,
# see http://bugs.ghostscript.com/show_bug.cgi?id=693100
export SUSE_ASNEEDED=0

./configure --prefix=%{_prefix} \
            --bindir=%{_bindir} \
            --libdir=%{_libdir} \
            --datadir=%{_datadir} \
            --mandir=%{_mandir} \
            --infodir=%{_infodir} \
            --with-fontpath=%{gs_font_path} \
            --with-libiconv=maybe \
            --enable-freetype \
            --with-jbig2dec \
            --enable-openjpeg \
            --enable-dynamic \
            --with-ijs \
            --enable-cups \
            --with-drivers=ALL \
            --with-x \
            --disable-gtk \
            --without-omni \
            --without-ufst \
            --without-luratech \
            --without-libpaper
make

make so

# Configure and make libijs (that is not done
# regardless whether or not --with-ijs is used above):

pushd ijs
./autogen.sh
./configure --prefix=%{_prefix} \
            --bindir=%{_bindir} \
            --libdir=%{_libdir} \
            --datadir=%{_datadir} \
            --mandir=%{_mandir} \
            --infodir=%{_infodir} \
            --enable-shared \
            --disable-static
make
popd


%install

make install DESTDIR=%{buildroot}

# Install libgs.so gsx gsc and some header files:
make soinstall DESTDIR=%{buildroot}

# Install libijs and its header files:
pushd ijs
make install DESTDIR=%{buildroot}
popd

# Remove installed ijs example client and server and its .la file:
rm %{buildroot}%{_bindir}/ijs_client_example
rm %{buildroot}%{_bindir}/ijs_server_example
rm %{buildroot}%{_libdir}/libijs.la
----------------------------------------------------------------

Here some errors how that fails since ghostscript-9.19rc1:

On
openSUSE_Tumbleweed i586 and x86_64
openSUSE_Leap_42.1 i586 and x86_64
openSUSE_Factory i586 and x86_64
openSUSE_13.2 i586 and x86_64
openSUSE_13.1 i586 and x86_64
SLE_12 i586 and x86_64
it fails with
----------------------------------------------------------------------
make: *** No rule to make target 'install-no_gpcl6',
 needed by 'install'. Stop.
----------------------------------------------------------------------

On
SLE_11_SP4 i586 and x86_64
SLE_11_SP3 i586 and x86_64
it fails with
----------------------------------------------------------------------
checking for dlopen in -ldl... yes
./configure: line 6915: syntax error near unexpected token `newline'
./configure: line 6915: `  yes:no:'
error: Bad exit status from /var/tmp/rpm-tmp.25116 (%build)
----------------------------------------------------------------------

If you like to see all the details in full build logs
on the openSUSE build service, go to

https://build.opensuse.org/package/show/home:jsmeix:branches:Printing/ghostscript

and there you can click for each build result
on the (red) "failed" message which is a link
to the full build log.
Comment 1 Chris Liddell (chrisl) 2016-03-17 02:30:24 UTC
Damn, okay, I can revert the change that caused that. I put in a change to cure a make warning, and didn't realise it would cause problems with the gs only install.

I'll have to think about it - I'd like to avoid the warning, too. This will be fixed for the 9.19 release, though.
Comment 2 jsmeix 2016-03-17 03:16:41 UTC
Many thanks for your prompt reply!

Could you provide me the change that caused that
so that I could revert it to make it build on openSUSE
because I like to provide ghostscript-9.19rc1
via our "Printing" development project, cf.
https://build.opensuse.org/project/show/Printing

This way interested openSUSE users can try out
whether or not Ghostscript 9.19 RC1 works
on their various openSUSE systems.
Comment 3 Chris Liddell (chrisl) 2016-03-17 03:30:14 UTC
(In reply to jsmeix from comment #2)
> Many thanks for your prompt reply!
> 
> Could you provide me the change that caused that
> so that I could revert it to make it build on openSUSE
> because I like to provide ghostscript-9.19rc1
> via our "Printing" development project, cf.
> https://build.opensuse.org/project/show/Printing
> 
> This way interested openSUSE users can try out
> whether or not Ghostscript 9.19 RC1 works
> on their various openSUSE systems.

I'm just testing a fix for the "make install" problem. Hopefully that'll be done in a few minutes and you can try that.

The configure error has me baffled though. I did notice some debug code, which I have removed, but since that only echo'ed the value of a variable, it's hard to imagine it causing a problem. There's nothing I can see around the "-ldl" test, nor around the line number in the error that looks suspicious.

I notice your build script does an autoreconf, so if that recreates configure from configure.ac, then configure may well be very different from the one we ship (and test).
Comment 4 Chris Liddell (chrisl) 2016-03-17 03:40:07 UTC
Two patches (order is not really important):

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=a529498d
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d7e175bc

The first *should* fix the "make install" error, the second removes the debug code.
Comment 5 jsmeix 2016-03-17 08:22:39 UTC
The second one
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d7e175bc
is not yet sufficient to make it build on SLE11.

I guess it is because SLE11 has an older autoconf that is
more picky about the syntax that newer autoconf.

What made it build for me also on SLE11 is
(the long lines shown wrapped here):
-----------------------------------------------------------------------------
--- configure.ac.orig   2016-03-14 11:17:22.000000000 +0100
+++ configure.ac        2016-03-17 15:43:31.000000000 +0100
@@ -392,10 +392,7 @@ if test "x$ac_cv_header_inttypes_h" = xy
         GCFLAGS="$GCFLAGS -DHAVE_INTTYPES_H=1"
 fi
 
-AC_CHECK_LIB([dl], [dlopen],
-             AC_CHECK_HEADER([dlfcn.h], [GCFLAGS=
"$GCFLAGS -DHAVE_LIBDL=1";LIBS="-ldl $LIBS"])
-              )
-echo $LIBS
+AC_CHECK_LIB([dl], [dlopen], [AC_CHECK_HEADER([dlfcn.h], [GCFLAGS=
"$GCFLAGS -DHAVE_LIBDL=1";LIBS="-ldl $LIBS"])])
 
 large_color_index=1

-----------------------------------------------------------------------------

I.e. I have
your removed "echo $LIBS" line
plus
the third argument of AC_CHECK_LIB within brackets
i.e. AC_CHECK_HEADER(...) within brackets:
AC_CHECK_LIB( [...], [...], [AC_CHECK_HEADER(...)])

With that it builds also for SLE11 and the very first quick test
shows that ghostscript-9.19rc1 works for me on my SLE11 system.
Comment 6 jsmeix 2016-03-17 08:54:07 UTC
Only FYI:

Without having the third argument of AC_CHECK_LIB within brackets
autoconf in SLE11 generates this configure script
(excerpt with added line numbers):
----------------------------------------------------------------------------
6913 # So?  What about this header?
6914 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
6915   yes:no:
6916 fi
----------------------------------------------------------------------------
which is invalid bash syntax that leads to the above mentioned
bash error message:
----------------------------------------------------------------------
./configure: line 6915: syntax error near unexpected token `newline'
./configure: line 6915: `  yes:no:'
----------------------------------------------------------------------
Comment 7 Chris Liddell (chrisl) 2016-03-17 10:15:56 UTC
So, thus:
http://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commitdiff;h=2dda1c12  ?
Comment 8 jsmeix 2016-03-18 03:27:45 UTC
Created attachment 12398 [details]
add_brackets_for_old_autoconf.patch

In contrast to what I wrote before the
  echo $LIBS
line can stay - only the brackets need to be added,
see my attached patch.

Then it works for all openSUSE versions and architectures
and the build log output is always the same:
--------------------------------------------------------------------------
 checking for dlopen in -ldl... yes
 checking dlfcn.h usability... yes
 checking dlfcn.h presence... yes
 checking for dlfcn.h... yes
 -ldl
--------------------------------------------------------------------------
Comment 9 Chris Liddell (chrisl) 2016-03-18 04:00:44 UTC
(In reply to jsmeix from comment #8)
> Created attachment 12398 [details]
> add_brackets_for_old_autoconf.patch
> 
> In contrast to what I wrote before the
>   echo $LIBS
> line can stay - only the brackets need to be added,
> see my attached patch.
> 
> Then it works for all openSUSE versions and architectures
> and the build log output is always the same:
> --------------------------------------------------------------------------
>  checking for dlopen in -ldl... yes
>  checking dlfcn.h usability... yes
>  checking dlfcn.h presence... yes
>  checking for dlfcn.h... yes
>  -ldl
> --------------------------------------------------------------------------

Thanks. The "echo $LIBS" was just the debug stuff I left in by mistake, so that's gone. I'll push the brackets change, and include it on the release branch.

Thanks for helping track down the problem.

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=2dda1c1