diff -Nru listserialportsc-1.4.0/debian/changelog listserialportsc-1.4.0/debian/changelog --- listserialportsc-1.4.0/debian/changelog 2018-03-21 09:35:06.000000000 +0100 +++ listserialportsc-1.4.0/debian/changelog 2022-09-26 17:22:35.000000000 +0200 @@ -1,3 +1,10 @@ +listserialportsc (1.4.0-1ubuntu1) jammy; urgency=medium + + * d/p/0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch: + Fix linking of listSerialsj with --as-needed (LP: #1916278) + + -- Tobias Heider Mon, 26 Sep 2022 17:22:35 +0200 + listserialportsc (1.4.0-1) unstable; urgency=low [ Rock Storm ] diff -Nru listserialportsc-1.4.0/debian/patches/0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch listserialportsc-1.4.0/debian/patches/0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch --- listserialportsc-1.4.0/debian/patches/0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch 1970-01-01 01:00:00.000000000 +0100 +++ listserialportsc-1.4.0/debian/patches/0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch 2022-09-26 17:22:32.000000000 +0200 @@ -0,0 +1,30 @@ +From: Tobias Heider +Date: Thu, 11 Aug 2022 18:56:37 +0200 +Subject: Makefile: Fix linkage in order to make --as-needed usable + +When using the --as-needed linker flag only libraries that are actually +used are linked into the final build product. With this flag enabled the +order of arguments passed to the linker matters, because input files +mentioned after the library on the command line are simply ignored. The +fix is to simply move LDFLAGS after the input files. + +The flag is enabled by default on Ubuntu which causes the Arduino IDE to +fail with an undefined symbol error on start as reported in: +https://bugs.launchpad.net/ubuntu/+source/arduino/+bug/1916278 +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 0f43911..8b70f3a 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,7 +32,7 @@ listserialportsc: main.c + $(CC) -g -o $@ $< -l serialport + + $(LSJ_REALNAME): $(LSJ_OBJS) +- $(CC) $(LDFLAGS) $(CUSTOM_LDFLAGS) -Wl,-soname,$(LSJ_SONAME) -o $@ $^ ++ $(CC) $^ $(LDFLAGS) $(CUSTOM_LDFLAGS) -Wl,-soname,$(LSJ_SONAME) -o $@ + ln -sf $@ $(LSJ_SONAME) + ln -sf $(LSJ_SONAME) $(LSJ_LINKERNAME) + diff -Nru listserialportsc-1.4.0/debian/patches/series listserialportsc-1.4.0/debian/patches/series --- listserialportsc-1.4.0/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ listserialportsc-1.4.0/debian/patches/series 2022-09-26 17:22:32.000000000 +0200 @@ -0,0 +1 @@ +0001-Makefile-Fix-linkage-in-order-to-make-as-needed-usab.patch