Package: pushover
Version: 0.0.5+git20180420-2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch

Dear Gürkan,

The pushover package fails to build in Ubuntu because it supplies options to the
linker in the wrong order:

[...]
g++ -Wall -g -O2 `pkg-config --cflags SDL_image libpng sdl` `pkg-config --libs 
SDL_image libpng sdl` -o build_tmp/assembler data/sources/assembler.cpp
[...]
/usr/bin/ld: /tmp/cc4HwHyA.o: in function `SavePNGImage(char*, SDL_Surface*)':
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:44: undefined 
reference to `png_create_write_struct'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:54: undefined 
reference to `png_create_info_struct'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:63: undefined 
reference to `png_set_longjmp_fn'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:72: undefined 
reference to `png_init_io'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:73: undefined 
reference to `png_set_IHDR'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:95: undefined 
reference to `png_write_info'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:112: undefined 
reference to `SDL_GetRGBA'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:122: undefined 
reference to `png_write_image'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:129: undefined 
reference to `png_write_end'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:131: undefined 
reference to `png_destroy_write_struct'
/usr/bin/ld: 
/<<BUILDDIR>>/pushover-0.0.5+git20180420/data/sources/pngsaver.h:49: undefined 
reference to `png_destroy_write_struct'
[...]
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:102: build_tmp/assembler] Error 1
[...]

  (https://launchpad.net/ubuntu/+source/pushover/0.0.5+git20180420-2)

Per <https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed>,
libraries must be passed on the commandline after the objects which
reference them, otherwise they will be discarded by the linker, resulting in
errors such as the above.

I have uploaded the attached patch to pushover in Ubuntu.  Please consider
applying it in Debian as well.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru pushover-0.0.5+git20180420/debian/patches/library-link-order.patch 
pushover-0.0.5+git20180420/debian/patches/library-link-order.patch
--- pushover-0.0.5+git20180420/debian/patches/library-link-order.patch  
1969-12-31 16:00:00.000000000 -0800
+++ pushover-0.0.5+git20180420/debian/patches/library-link-order.patch  
2018-08-22 16:11:57.000000000 -0700
@@ -0,0 +1,27 @@
+Description: Ensure libraries linked are listed after objects using them
+ The Ubuntu toolchain uses -Wl,--as-needed by default, which causes
+ libraries to be dropped from the final binary if they aren't used.  For
+ portability, make sure that libraries are always listed on the linker
+ commandline /after/ the objects that reference them.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Modified: 2018-08-22
+
+Index: pushover-0.0.5+git20180420/Makefile
+===================================================================
+--- pushover-0.0.5+git20180420.orig/Makefile
++++ pushover-0.0.5+git20180420/Makefile
+@@ -94,12 +94,12 @@
+       $(CXX) $(CXXFLAGS) `$(PKG_CONFIG) --cflags $(PKGS)` $(DEF_VERSION) 
$(DEF_DATADIR) -c -o $@ $<
+ 
+ pushover: $(FILES_O)
+-      $(CXX) $(CXXFLAGS) `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) -o $@ 
$(FILES_O)
++      $(CXX) $(CXXFLAGS) -o $@ $(FILES_O) `$(PKG_CONFIG) --libs $(PKGS)` 
$(LIBS)
+ 
+ .SECONDARY: build_tmp/assembler
+ build_tmp/assembler: data/sources/assembler.cpp data/sources/pngsaver.h
+       mkdir -p $(dir $@)
+-      $(CXX) $(CXXFLAGS) `$(PKG_CONFIG) --cflags $(PKGS_ASSEMBLER)` 
`$(PKG_CONFIG) --libs $(PKGS_ASSEMBLER)` -o $@ $<
++      $(CXX) $(CXXFLAGS) `$(PKG_CONFIG) --cflags $(PKGS_ASSEMBLER)` -o $@ $< 
`$(PKG_CONFIG) --libs $(PKGS_ASSEMBLER)`
+ 
+ .SECONDARY: build_tmp/domino_images/done
+ build_tmp/domino_images/done: data/sources/domino.ini data/sources/*.pov
diff -Nru pushover-0.0.5+git20180420/debian/patches/series 
pushover-0.0.5+git20180420/debian/patches/series
--- pushover-0.0.5+git20180420/debian/patches/series    2018-04-20 
03:23:21.000000000 -0700
+++ pushover-0.0.5+git20180420/debian/patches/series    2018-08-22 
16:10:23.000000000 -0700
@@ -5,3 +5,4 @@
 sdl2
 lua53-justdoit
 disable-graphics-during-build
+library-link-order.patch

Reply via email to