[Debichem-devel] Bug#960884: libwildmagic: Fix underlinkage issues with ld --as-needed

Logan Rosen logan at ubuntu.com
Sun May 17 21:26:06 BST 2020


Package: libwildmagic
Version: 5.17+cleaned1-3
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu groovy ubuntu-patch

Hi,

I noticed that you applied a linking fix in 5.17+cleaned1-2, but it
doesn't address all of the errors output by dh-shlibdeps in the build
logs, and there's a cleaner way to fix it that we've been carrying as a
delta in Ubuntu.

Since GCC 10 uses ld --as-needed, it's important that the libraries come
after the objects that require them. The attached patch does this
accordingly and resolves all of the dh-shlibdeps warnings about
underlinkage (and fixes the same openms build issue you noticed).

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/ld-as-needed: Fix (under)linking issues with ld --as-needed.
  * d/control: Add conflicts/replaces for libwildmagic5 (can be dropped
    after next LTS, 22.04).
  * Drop d/p/fixNoLinkToLibsSymbolsUnused.patch because ld-as-needed patch
    fixes issue in a cleaner way (and Debian's patch still leads to
    dh_shlibdeps warnings).

Thanks for considering the patch.

Logan

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), (100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-29-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru libwildmagic-5.17+cleaned1/debian/patches/ld-as-needed libwildmagic-5.17+cleaned1/debian/patches/ld-as-needed
--- libwildmagic-5.17+cleaned1/debian/patches/ld-as-needed	1969-12-31 19:00:00.000000000 -0500
+++ libwildmagic-5.17+cleaned1/debian/patches/ld-as-needed	2020-05-17 16:02:46.000000000 -0400
@@ -0,0 +1,144 @@
+Description: fix (under)linking issues with ld --as-needed
+Author: Logan Rosen <logan at ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1578222
+Forwarded: no
+Last-Update: 2016-05-09
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/LibApplications/makefile.wm5
++++ b/LibApplications/makefile.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L$(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Applications.so.$(SOVER) -lWm5Core -lWm5Mathematics -lWm5Imagics -lWm5Graphics -lWm5Physics -o
++ARFLAGS := $(LDFLAGS) -L$(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Applications.so.$(SOVER) -o
++LIBS := -lWm5Core -lWm5Mathematics -lWm5Imagics -lWm5Graphics -lWm5Physics -lX11
+ LIB := $(LIBPATH)/libWm5Applications.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -44,7 +45,7 @@
+ OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
+ 
+ build : $(OBJ) $(OBJDIR)/Wm5GlxApplication.o
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJ) $(OBJDIR)/Wm5GlxApplication.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJ) $(OBJDIR)/Wm5GlxApplication.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR) 
+ 	ln -sf -T libWm5Applications.so.$(RELVER) ../SDK/Library/$(OBJDIR)/libWm5Applications.so
+ 	ln -sf -T libWm5Applications.so.$(RELVER) ../SDK/Library/$(OBJDIR)/libWm5Applications.so.$(SOVER)
+--- a/LibGraphics/makeprj.wm5
++++ b/LibGraphics/makeprj.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Graphics.so.$(SOVER) -lWm5Core -lWm5Mathematics -o
++ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Graphics.so.$(SOVER) -o
++LIBS := -lWm5Core -lWm5Mathematics -lGL
+ LIB := $(LIBPATH)/libWm5Graphics.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -50,7 +51,7 @@
+ OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
+ 
+ build : $(OBJ)
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR)
+ 
+ $(OBJDIR)/%.o : %.cpp
+--- a/LibImagics/makeprj.wm5
++++ b/LibImagics/makeprj.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Imagics.so.$(SOVER) -lWm5Core -lWm5Mathematics -o
++ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Imagics.so.$(SOVER) -o
++LIBS := -lWm5Core -lWm5Mathematics
+ LIB := $(LIBPATH)/libWm5Imagics.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -42,7 +43,7 @@
+ OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
+ 
+ build : $(OBJ)
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR)
+ 
+ $(OBJDIR)/%.o : %.cpp
+--- a/LibMathematics/makeprj.wm5
++++ b/LibMathematics/makeprj.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Mathematics.so.$(SOVER) -lWm5Core -o
++ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Mathematics.so.$(SOVER) -o
++LIBS := -lWm5Core
+ LIB := $(LIBPATH)/libWm5Mathematics.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -52,7 +53,7 @@
+ OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
+ 
+ build : $(OBJ)
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR)
+ 
+ $(OBJDIR)/%.o : %.cpp
+--- a/LibCore/makeprj.wm5
++++ b/LibCore/makeprj.wm5
+@@ -14,7 +14,7 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -shared -fPIC -Wl,-soname,libWm5Core.so.$(SOVER) -o
++ARFLAGS := $(LDFLAGS) -shared -fPIC -Wl,-soname,libWm5Core.so.$(SOVER) -pthread -o
+ LIB := ../../SDK/Library/$(CFG)/libWm5Core.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+--- a/LibPhysics/makeprj.wm5
++++ b/LibPhysics/makeprj.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Physics.so.$(SOVER) -lWm5Core -lWm5Mathematics -o
++ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Physics.so.$(SOVER) -o
++LIBS := -lWm5Core -lWm5Mathematics
+ LIB := $(LIBPATH)/libWm5Physics.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -42,7 +43,7 @@
+ OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
+ 
+ build : $(OBJ)
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR)
+ 
+ $(OBJDIR)/%.o : %.cpp
+--- a/LibGraphics/Renderers/GlxRenderer/makerend.wm5
++++ b/LibGraphics/Renderers/GlxRenderer/makerend.wm5
+@@ -16,7 +16,8 @@
+ RELVER = $(SOVER).17
+ CFLAGS += -fPIC
+ AR := $(CC)
+-ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Graphics.so.$(SOVER) -lWm5Core -lWm5Mathematics -o
++ARFLAGS := $(LDFLAGS) -L $(LIBPATH) -shared -fPIC -Wl,-soname,libWm5Graphics.so.$(SOVER) -o
++LIBS := -lWm5Core -lWm5Mathematics -lGL
+ LIB := $(LIBPATH)/libWm5Graphics.so.$(RELVER)
+ else
+ AR := /usr/bin/ar
+@@ -56,7 +57,7 @@
+ OBJ := $(RENOBJ) $(OGLOBJ) $(GLXOBJ)
+ 
+ build : $(OBJ)
+-	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o
++	$(AR) $(ARFLAGS) $(LIB) $(OBJDIR)/*.o $(LIBS)
+ 	cp -fp $(INC) $(INCDIR)
+ 
+ $(OBJDIR)/Wm5Renderer.o : ../Wm5Renderer.cpp
diff -Nru libwildmagic-5.17+cleaned1/debian/patches/series libwildmagic-5.17+cleaned1/debian/patches/series
--- libwildmagic-5.17+cleaned1/debian/patches/series	2020-05-14 09:51:00.000000000 -0400
+++ libwildmagic-5.17+cleaned1/debian/patches/series	2020-05-17 16:01:14.000000000 -0400
@@ -1,2 +1,2 @@
 wm5-path
-fixNoLinkToLibsSymbolsUnused.patch
+ld-as-needed


More information about the Debichem-devel mailing list