[Libguestfs] [PATCH] Don't rely on OCaml native compiler for tests

Hilko Bengen bengen at hilluzination.de
Tue May 10 16:59:18 UTC 2011


* Richard W.M. Jones:

> On Tue, May 10, 2011 at 12:47:06PM +0200, Hilko Bengen wrote:
>> * Richard W.M. Jones:
>> 
>> > I pushed this, and also the Python/configure patch.
>> 
>> Uh-oh, I mede a mistake there.
>> 
>> The tests get built if I have libhivex.so.0 somewhere in the system
>> path, but the version in ../lib/.libs is not found.
>
> Shouldn't there always be a version in libs/.libs?  Surely it has just
> been built by 'make' ...

Yes, a fresh version of libhivex.so.0 can be found in lib/.libs, but as
it seems that ocamlc (or some other responsible component) does not look
there.

,----
| hivex.git $ ls lib/.libs/
| libhivex.a   libhivex.lai  libhivex.so.0      libhivex_la-hivex.o
| libhivex.la  libhivex.so   libhivex.so.0.0.0
| hivex.git $ cd ocaml
| ocaml $ make
| gcc -std=gnu99 -I.. -I/usr/lib/ocaml -I../ocaml -I../lib   -g -O2 -fPIC -Wall -c hivex_c.c
| ocamlfind ocamlc -package unix -c hivex.mli -o hivex.cmi
| ocamlfind ocamlc -package unix -c hivex.ml -o hivex.cmo
| ocamlmklib -o mlhivex hivex_c.o hivex.cmo -L../lib/.libs -lhivex
| ocamlfind ocamlopt -package unix -c hivex.ml -o hivex.cmx
| ocamlmklib -o mlhivex hivex_c.o hivex.cmx -L../lib/.libs -lhivex
| cd .. && /bin/bash ./config.status ocaml/META
| config.status: creating ocaml/META
| ocamlfind ocamlc -package unix -c t/hivex_005_load.ml -o t/hivex_005_load.cmo
| mkdir -p t
| ocamlfind ocamlc -cclib -L../lib/.libs -I . -package unix -linkpkg mlhivex.cma t/hivex_005_load.cmo -o t/hivex_005_load
| File "_none_", line 1, characters 0-1:
| Error: Error on dynamically loaded library: ./dllmlhivex.so: libhivex.so.0: cannot open shared object file: No such file or directory
| make: *** [t/hivex_005_load] Error 2
| ocaml $
`----

However, if I proveide the "ocamlfind ocamlc" call with a
LD_LIBRARY_PATH, this works:

,----
| ocaml $ ocamlfind ocamlc -cclib -L../lib/.libs -I . -package unix -linkpkg mlhivex.cma t/hivex_005_load.cmo -o t/hivex_005_load
| File "_none_", line 1, characters 0-1:
| Error: Error on dynamically loaded library: ./dllmlhivex.so: libhivex.so.0: cannot open shared object file: No such file or directory
| ocaml $ LD_LIBRARY_PATH=../lib/.libs ocamlfind ocamlc -cclib -L../lib/.libs -I . -package unix -linkpkg mlhivex.cma t/hivex_005_load.cmo -o t/hivex_005_load
| ocaml $
`----

Should this be the only way to get the test programs compiled in-tree?

I have experimented with passing "-dllpath ../lib/.libs" to the
"ocamlmklib" calls, but that hasn't worked, either.

-Hilko




More information about the Libguestfs mailing list