Source: libnxt
Version: 0.3-1
Tags: patch
User: debian-...@lists.debian.org
Usertags: ld-as-needed

libnxt fails to build when ld defaults to --as-needed because as it passes
the libraries to the linker in the wrong order.
See http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

Build log:

gcc -o fwflash -z relro main_fwflash.o -L. -lusb -lnxt
../libnxt.a(lowlevel.o): In function `nxt_init':
/build/buildd/libnxt-0.3/lowlevel.c:49: undefined reference to `usb_init'
../libnxt.a(lowlevel.o): In function `nxt_find':
/build/buildd/libnxt-0.3/lowlevel.c:60: undefined reference to `usb_find_busses'
/build/buildd/libnxt-0.3/lowlevel.c:61: undefined reference to 
`usb_find_devices'
/build/buildd/libnxt-0.3/lowlevel.c:63: undefined reference to `usb_get_busses'
[...]
Description: Fix FTBFS with ld --as-needed.
Author: Felix Geyer <fge...@debian.org>

--- libnxt-0.3.orig/SConstruct
+++ libnxt-0.3/SConstruct
@@ -28,8 +28,8 @@ Default(BuildEnv.Library('nxt',
 			 LIBS='usb'))
 
 Default(BuildEnv.Program('fwflash', 'main_fwflash.c',
-			 LIBS=['usb', 'nxt'], LIBPATH='.',
+			 LIBS=['nxt', 'usb'], LIBPATH='.',
 			 ))
 
 Default(BuildEnv.Program('fwexec', 'main_fwexec.c',
-			 LIBS=['usb', 'nxt'], LIBPATH='.'))
+			 LIBS=['nxt', 'usb'], LIBPATH='.'))

Reply via email to