Source: cudf
Version: 0.5.99-1
Severity: important
Tags: patch
User: [email protected]
Usertags: kfreebsd

Hi,

your package FTBFS on non-Linux archs with:
| cc -g -O2 -g -Wall -O2 -o caml_hash_variant caml_hash_variant.o dummy.o 
-L/usr/lib/ocaml -lcamlrun -lm -lcurses
| /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlerror':
| (.text+0x16c): undefined reference to `dlerror'
| /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlsym':
| (.text+0x17a): undefined reference to `dlsym'
| /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlclose':
| (.text+0x19e): undefined reference to `dlclose'
| /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlopen':
| (.text+0x1bb): undefined reference to `dlopen'
| collect2: ld returned 1 exit status

Full build logs:
  https://buildd.debian.org/status/package.php?p=cudf&suite=experimental

>From a quick look, I couldn't find any obvious differences between nm -D
/usr/lib/ocaml/libcamlrun.a's output on amd64 and kfreebsd-amd64; I
guess the behaviour of the linker is slightly different, and linking
with undefined symbols is OK on Linux only.

Adding -ldl fixes it, patch attached. Not sure that's the right way
though (maybe libcamrun.a ought to be tweaked instead?).

Mraw,
KiBi.
>From ef9fff81e7417da53600f042b5dd69476a812ee1 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <[email protected]>
Date: Fri, 5 Nov 2010 08:54:25 +0100
Subject: [PATCH] link caml_hash_variant with -ldl

without that, one can run into the following issues, on non-Linux systems:
  cc -Wall -DG_LOG_DOMAIN=\"libCUDF\" -o caml_hash_variant caml_hash_variant.o 
dummy.o -L/usr/lib/ocaml -lcamlrun -lm -lcurses
  /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlerror':
  (.text+0x16c): undefined reference to `dlerror'
  /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlsym':
  (.text+0x17a): undefined reference to `dlsym'
  /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlclose':
  (.text+0x19e): undefined reference to `dlclose'
  /usr/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlopen':
  (.text+0x1bb): undefined reference to `dlopen'
  collect2: ld returned 1 exit status
---
 c-lib/Makefile.variants |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/c-lib/Makefile.variants b/c-lib/Makefile.variants
index 19af0ea..fdf2655 100644
--- a/c-lib/Makefile.variants
+++ b/c-lib/Makefile.variants
@@ -65,7 +65,7 @@ cudf-variants.h: caml_hash_variant Makefile.variants
 caml_hash_variant: caml_hash_variant.o
        > dummy.ml
        ocamlc -o dummy.o -output-obj dummy.ml
-       $(CC) $(CFLAGS) -o $@ $< dummy.o -L$(OCAML_LIBDIR) -lcamlrun -lm 
-lcurses
+       $(CC) $(CFLAGS) -o $@ $< dummy.o -L$(OCAML_LIBDIR) -lcamlrun -lm 
-lcurses -ldl
        @rm -f dummy.*
 
 clean: clean-variants
-- 
1.7.2.3

Reply via email to