Package: httpdirfs-fuse
Version: 1.0.1-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Dear Jerome,

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

[...]
cc -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. 
-fstack-protector-strong -Wformat -Werror=format-security -g -O2 -Wall -Wextra 
-D_FILE_OFFSET_BITS=64 -DVERSION=\"1.0.1\" -Wl,-Bsymbolic-functions 
-Wl,-z,relro -Wl,-z,now -lgumbo -lcurl -lfuse -lcrypto -o httpdirfs main.o 
network.o fuse_local.o link.o
/usr/bin/ld: network.o: in function `curl_process_msgs':
./src/network.c:162: undefined reference to `curl_easy_getinfo'
/usr/bin/ld: ./src/network.c:166: undefined reference to `curl_easy_getinfo'
/usr/bin/ld: ./src/network.c:181: undefined reference to `curl_multi_remove_hand
[...]
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:15: httpdirfs] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: make -j4 "INSTALL=install --strip-program=true" returned exit 
code 2
[...]

  (https://launchpad.net/ubuntu/+source/httpdirfs-fuse/1.0.1-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 httpdirfs-fuse 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 httpdirfs-fuse-1.0.1/debian/patches/library-link-order.patch 
httpdirfs-fuse-1.0.1/debian/patches/library-link-order.patch
--- httpdirfs-fuse-1.0.1/debian/patches/library-link-order.patch        
1969-12-31 16:00:00.000000000 -0800
+++ httpdirfs-fuse-1.0.1/debian/patches/library-link-order.patch        
2019-09-03 17:10:50.000000000 -0700
@@ -0,0 +1,32 @@
+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.
+ .
+ This also avoids passing -l options to the compiler when compiling .o files.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2019-09-03
+
+Index: httpdirfs-fuse-1.0.1/Makefile
+===================================================================
+--- httpdirfs-fuse-1.0.1.orig/Makefile
++++ httpdirfs-fuse-1.0.1/Makefile
+@@ -1,7 +1,7 @@
+ VERSION=1.0.1
+ 
+ CFLAGS+= -g -O2 -Wall -Wextra -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\"
+-LDFLAGS+= -lgumbo -lcurl -lfuse -lcrypto
++LIBS = -lgumbo -lcurl -lfuse -lcrypto
+ COBJS = main.o network.o fuse_local.o link.o
+ 
+ prefix ?= /usr/local
+@@ -12,7 +12,7 @@
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $<
+ 
+ httpdirfs: $(COBJS)
+-      $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^
++      $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ 
+ install:
+       install -m 755 -D httpdirfs \
diff -Nru httpdirfs-fuse-1.0.1/debian/patches/series 
httpdirfs-fuse-1.0.1/debian/patches/series
--- httpdirfs-fuse-1.0.1/debian/patches/series  1969-12-31 16:00:00.000000000 
-0800
+++ httpdirfs-fuse-1.0.1/debian/patches/series  2019-09-03 17:09:04.000000000 
-0700
@@ -0,0 +1 @@
+library-link-order.patch

Reply via email to