Package: pgplot5
Version: 5.2.2-17
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch oneiric

When built with a linker that defaults to --as-needed, libpgplot.so and
libcpgplot.so lose their inter-library linkage.  (I noticed this when
ifeffit failed to build on Ubuntu.)  This is because of incorrect link
ordering when linking shared libraries: it puts libraries before the
objects that use them rather than after, so the DT_NEEDED entries are
discarded because the linker hasn't yet seen references to them.  See:

  http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The following patch fixes this.

  * Fix link order so that inter-library linkage of libpgplot.so and
    libcpgplot.so is recorded correctly with 'ld --as-needed'.

diff -u pgplot5-5.2.2/makemake pgplot5-5.2.2/makemake
--- pgplot5-5.2.2/makemake
+++ pgplot5-5.2.2/makemake
@@ -669,6 +669,7 @@
 # libraries when they link their executables.
 #
 SHARED_LIB_LIBS=$SHARED_LIB_LIBS
+SHARED_LIB_CPGPLOT_LIBS=$SHARED_LIB_CPGPLOT_LIBS
 #
 # Ranlib command if required
 #
@@ -1069,7 +1070,7 @@
        ./pgbind $(PGBIND_FLAGS) -w $(PG_SOURCE)
        $(CCOMPL) -c $(CFLAGC) cpg*.c
        rm -f cpg*.c
-       $(SHARED_LD) $(SHARED_LD_CPGPLOT_OPTS) cpg*.o
+       $(SHARED_LD) $(SHARED_LD_CPGPLOT_OPTS) cpg*.o $(SHARED_LIB_CPGPLOT_LIBS)
        rm -f cpg*.o
 
 cpgdemo: cpgplot.h $(SRC)/cpg/cpgdemo.c libcpgplot.a
diff -u pgplot5-5.2.2/debian/g77_gcc.conf.debian 
pgplot5-5.2.2/debian/g77_gcc.conf.debian
--- pgplot5-5.2.2/debian/g77_gcc.conf.debian
+++ pgplot5-5.2.2/debian/g77_gcc.conf.debian
@@ -108,9 +108,9 @@
 # Optional: Needed if SHARED_LIB is set.
 # How to create a shared library from a trailing list of object files.
  
-   SHARED_LD_PGPLOT_OPTS="-o $SHARED_LIB -Wl,-soname,libpgplot.so.\$(VM) 
-L/usr/X11R6/lib -lX11 -lpng -lc -lgfortran"
+   SHARED_LD_PGPLOT_OPTS="-o $SHARED_LIB -Wl,-soname,libpgplot.so.\$(VM)"
 
-   SHARED_LD_CPGPLOT_OPTS="-o libcpgplot.so -Wl,-soname,libcpgplot.so.\$(VM) 
-L. -lpgplot"
+   SHARED_LD_CPGPLOT_OPTS="-o libcpgplot.so -Wl,-soname,libcpgplot.so.\$(VM)"
   
    SHARED_LD="gfortran -shared"
 
@@ -121,7 +121,9 @@
 # library-specification flags used to specify these libraries to
 # $SHARED_LD
  
-   SHARED_LIB_LIBS=""
+   SHARED_LIB_LIBS="-L/usr/X11R6/lib -lX11 -lpng -lc -lgfortran"
+
+   SHARED_LIB_CPGPLOT_LIBS="-L. -lpgplot"
 
 # Optional:
 # Compiler name used on Next systems to compile objective-C files.

Thanks,

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to