Bug#657554: nss-passwords 0.1-1 fails to build with ld --as-needed
Package: nss-passwords
Severity: important
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu precise ubuntu-patch
Dear maintainer,
nss-passwords 0.1-1 fails to build in ubuntu precise with ld --as-needed.
The entire log can be found here https://launchpadlibrarian.net/89413467/buildlog_ubuntu-precise-i386.nss-passwords_0.1-1_FAILEDTOBUILD.txt.gz
This is a snippet, focusing on the error:
ocamlfind ocamlc -g -package fileutils.str,sqlite3 -ccopt -lnss3 -ccopt -lnssutil3 -ccopt -lsmime3 -ccopt -lssl3 -ccopt -lplds4 -ccopt -lplc4 -ccopt -lnspr4 -ccopt -lpthread -ccopt -ldl -custom -linkpkg -o nss-passwords main.cmo nss_stubs.o main_stubs.o
nss_stubs.o: In function `password_func':
nss_stubs.c:(.text+0x175): undefined reference to `PL_strdup'
nss_stubs.o: In function `caml_nss_cleanup':
nss_stubs.c:(.text+0x1df): undefined reference to `NSS_Shutdown'
nss_stubs.c:(.text+0x200): undefined reference to `PR_Cleanup'
nss_stubs.o: In function `caml_nss_init':
nss_stubs.c:(.text+0x277): undefined reference to `PK11_SetPasswordFunc'
nss_stubs.c:(.text+0x282): undefined reference to `NSS_Init'
nss_stubs.o: In function `caml_do_decrypt':
nss_stubs.c:(.text+0x3af): undefined reference to `NSSBase64_DecodeBuffer'
nss_stubs.c:(.text+0x3dc): undefined reference to `PORT_GetError'
nss_stubs.c:(.text+0x3fd): undefined reference to `SECITEM_FreeItem'
nss_stubs.c:(.text+0x4af): undefined reference to `PK11SDR_Decrypt'
nss_stubs.c:(.text+0x4c5): undefined reference to `SECITEM_ZfreeItem'
nss_stubs.c:(.text+0x507): undefined reference to `SECITEM_ZfreeItem'
nss_stubs.c:(.text+0x529): undefined reference to `PORT_GetError'
collect2: ld returned 1 exit status
File "_none_", line 1, characters 0-1:
Error: Error while building custom runtime system
make[1]: *** [nss-passwords] Error 2
As attachment you can find the patch that solves the problem.
Regards,
Leo.
-- System Information:
Debian Release: wheezy/sid
APT prefers oneiric-updates
APT policy: (500, 'oneiric-updates'), (500, 'oneiric'), (100, 'oneiric-backports')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-030200rc7-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Description: Fix FTBFS with ld --as-needed in Makefile.
And replace "-ccopt" with "-cclib".
According to the man page of ocamlopt, optiot -cclib is better:
-cclib -llibname
Pass the -llibname option to the linker. This causes the
given C library to be linked with the program.
Author: Leo Iannacone <l3on@ubuntu.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- nss-passwords.orig/Makefile
+++ nss-passwords/Makefile
@@ -1,7 +1,7 @@
OCAMLC = ocamlfind ocamlc -g -package fileutils.str,sqlite3
OCAMLOPT = ocamlfind ocamlopt -g -package fileutils.str,sqlite3
ML_CFLAGS = $(foreach u,$(shell pkg-config --cflags nss),-ccopt $(u))
-ML_LFLAGS = $(foreach u,$(shell pkg-config --libs nss),-ccopt $(u))
+ML_LFLAGS = $(foreach u,$(shell pkg-config --libs nss),-cclib $(u))
.PHONY: all clean
@@ -11,7 +11,7 @@ clean:
rm -f *~ *.cm[oxi] *.o nss-passwords
nss-passwords: main.cmo nss_stubs.o main_stubs.o
- $(OCAMLC) $(ML_LFLAGS) -custom -linkpkg -o $@ $^
+ $(OCAMLC) -o $@ $^ $(ML_LFLAGS) -custom -linkpkg
%.cmx: %.ml
$(OCAMLOPT) -c $<
Reply to: