Package: pdbg
Version: 1.0-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Frédéric,

The pdbg package has been failing to build in Ubuntu because it supplies
options to the linker in the wrong order:

[...]
libtool: link: gcc -I./libpdbg -Wall -Werror -DGIT_SHA1=\"unknown\" -g -O3 
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat 
-Werror=format-security -Wl,--whole-archive -Wl,-lpdbg -Wl,--no-whole-archive 
-Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/pdbg 
src/pdbg-main.o fake.dtb.o p8-fsi.dtb.o p8-i2c.dtb.o p9w-fsi.dtb.o 
p9z-fsi.dtb.o p9r-fsi.dtb.o p9-kernel.dtb.o  -lfdt ./.libs/libpdbg.so -L.libs
./.libs/libpdbg.so: undefined reference to `fdt_check_header'
./.libs/libpdbg.so: undefined reference to `fdt_get_name'
./.libs/libpdbg.so: undefined reference to `fdt_string'
./.libs/libpdbg.so: undefined reference to `fdt_offset_ptr'
./.libs/libpdbg.so: undefined reference to `fdt_next_tag'
collect2: error: ld returned 1 exit status
Makefile:568: recipe for target 'pdbg' failed
[...]

(https://launchpad.net/ubuntu/+source/pdbg/1.0-1)

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 pdbg 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                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru pdbg-1.0/debian/patches/use-debian-libfdt.patch 
pdbg-1.0/debian/patches/use-debian-libfdt.patch
--- pdbg-1.0/debian/patches/use-debian-libfdt.patch     2017-10-06 
06:55:13.000000000 -0700
+++ pdbg-1.0/debian/patches/use-debian-libfdt.patch     2018-04-09 
16:18:46.000000000 -0700
@@ -2,10 +2,15 @@
  pdbg embeds libfdt, but in Debian libfdt is packaged and we prefer to make use
  of it. So we just disable that in Makefile.am and switch to the installed 
libfdt-dev
 Author: Frédéric Bonnard <fre...@debian.org>
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Modified: 2018-04-09
+
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/Makefile.am
-+++ b/Makefile.am
+Index: pdbg-1.0/Makefile.am
+===================================================================
+--- pdbg-1.0.orig/Makefile.am
++++ pdbg-1.0/Makefile.am
 @@ -1,7 +1,5 @@
  GIT_SHA1 = `git --work-tree=$(top_srcdir) --git-dir=$(top_srcdir)/.git 
describe --always --long --dirty || echo unknown`
  
@@ -14,16 +19,16 @@
  bin_PROGRAMS = pdbg
  
  ACLOCAL_AMFLAGS = -Im4
-@@ -10,28 +8,16 @@
+@@ -10,28 +8,16 @@ AM_CFLAGS = -I$(top_srcdir)/ccan/array_s
  pdbg_SOURCES = \
        src/main.c
  pdbg_LDADD = fake.dtb.o p8-fsi.dtb.o p8-i2c.dtb.o p9w-fsi.dtb.o       \
 -      p9z-fsi.dtb.o p9r-fsi.dtb.o p9-kernel.dtb.o libpdbg.la libfdt.la \
+-      -L.libs
 +      p9z-fsi.dtb.o p9r-fsi.dtb.o p9-kernel.dtb.o libpdbg.la  \
-       -L.libs
++      -L.libs -lfdt
  
--pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
-+pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive -lfdt
+ pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
  pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\"
  
 -lib_LTLIBRARIES = libpdbg.la libfdt.la

Reply via email to