Hi,

current releases of ocaml-vorbis & ocaml-shout gets their links to the
libs they're binding dropped if -Wl,--as-needed is present in LDFLAGS.

Patches fixing that are enclosed.

Example without the patch :


ldd /usr/lib64/ocaml/site-packages/stublibs/dllvorbis_stubs.so
        libc.so.6 => /lib/libc.so.6 (0x00002b57d4953000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)


With the patch :


ldd /usr/lib64/ocaml/site-packages/stublibs/dllvorbis_stubs.so
        libogg.so.0 => /usr/lib/libogg.so.0 (0x00002b389c3c1000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2
(0x00002b389c5c6000) libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3
(0x00002b389c9a4000) libvorbis.so.0 => /usr/lib/libvorbis.so.0
(0x00002b389cbac000) libm.so.6 => /lib/libm.so.6 (0x00002b389cdd7000)
        libc.so.6 => /lib/libc.so.6 (0x00002b389d02d000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)



Explanations :

the build systems puts -loptions in LDFLAGS, what is not correct, it is
meant for options not for libs to link with. The OCamlMakefile handles
those correctly when the libs are in the CLIBS variable but not in
LDFLAGS.


More background info here :
http://www.gentoo.org/proj/en/qa/asneeded.xml

(this applies mostly to autotoolized C/C++ programs, but the idea
remains the same here ( e.g. Code Listing 2.4 ) )

For the other bindings, ocaml-ssl is fine, but I've not checked the
other ones.


Regards,

Alexis.
Index: ocaml-vorbis-0.3.0/src/Makefile.in
===================================================================
--- ocaml-vorbis-0.3.0.orig/src/Makefile.in
+++ ocaml-vorbis-0.3.0/src/Makefile.in
@@ -35,8 +35,10 @@ RESULT = vorbis
 LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.a *.so)
 LIBS = unix str
 ACLIBS = @LIBS@
-CLIBS = $(ACLIBS:-l%=%)
-LDFLAGS = @LDFLAGS@ @OGG_LIBS@ @VORBIS_LIBS@
+OGG_LIBS = @OGG_LIBS@
+VORBIS_LIBS = @VORBIS_LIBS@
+CLIBS = $(ACLIBS:-l%=%) $(OGG_LIBS:-l%=%) $(VORBIS_LIBS:-l%=%)
+LDFLAGS = @LDFLAGS@
 
 all: $(BEST)
 
Index: ocaml-shout-0.2.2/src/Makefile.in
===================================================================
--- ocaml-shout-0.2.2.orig/src/Makefile.in
+++ ocaml-shout-0.2.2/src/Makefile.in
@@ -28,8 +28,9 @@ RES_CLIB_SUF = _stubs
 RESULT = shout
 LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.a *.so)
 ACLIBS = @LIBS@
-CLIBS = $(ACLIBS:-l%=%)
-LDFLAGS = @LDFLAGS@ @SHOUT_LIBS@
+SHOUT_LIBS = @SHOUT_LIBS@
+CLIBS = $(ACLIBS:-l%=%) $(SHOUT_LIBS:-l%=%)
+LDFLAGS = @LDFLAGS@
 CC = @CC@
 CFLAGS = @CFLAGS@ @SHOUT_CFLAGS@
 CPPFLAGS = @CPPFLAGS@

Attachment: pgp6piibxcu8M.pgp
Description: PGP signature

Répondre à