From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 1FEC7820A1 for ; Fri, 9 Aug 2013 11:49:58 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.89,844,1367964000"; d="scan'208";a="28909813" Received: from adijon-153-1-57-105.w81-51.abo.wanadoo.fr (HELO alcazar) ([81.51.200.105]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 09 Aug 2013 11:49:57 +0200 Date: Fri, 9 Aug 2013 11:49:44 +0200 From: Maxence Guesdon To: caml-list@inria.fr Message-ID: <20130809114944.7111c7f5@alcazar> In-Reply-To: <5204B9D9.2060500@glondu.net> References: <20130809110908.0c2145c9@alcazar> <5204B5E7.9000409@glondu.net> <20130809113348.3a174c2f@alcazar> <5204B9D9.2060500@glondu.net> Organization: INRIA X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.20; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Problem native dynlink loading cryptokit On Fri, 09 Aug 2013 11:43:53 +0200 St=C3=A9phane Glondu wrote: > Le 09/08/2013 11:33, Maxence Guesdon a =C3=A9crit : > >>> Here is a test program: > >>> [...] > >>> gives me the following error: > >>> > >>> Fatal error: exception Failure("error loading shared > >>> library: /home/guesdon/.opam/4.00.1/lib/cryptokit/cryptokit.cmxs: > >>> undefined symbol: caml_sha1_init") > >>> > >>> Am I doing something wrong ? Or is something missing in cryptokit > >>> build ? > >> > >> It works for me (with system packages). > >> > >> caml_sha1_init should be in cryptokit.cmxs. The output of > >> > >> objdump -j .text -T /path/to/cryptokit.cmxs > >> > >> should contain all the C functions defined in cryptokit, plus some > >> caml_curry* functions and camlCryptokit__* functions (compiled from > >> OCaml). Is it true for you? > >=20 > > No, I only have camlCryptokit__sha1_init_3833 which I assume corresponds > > to the function of src/cryptokit.ml: > > external sha1_init: unit -> string =3D "caml_sha1_init" >=20 > Then, I suspect stubs were forgotten during the build of cryptokit.cmxs. > In the output of: >=20 > ocamlobjinfo /path/to/cryptokit.cmxa >=20 > there should be the following lines: >=20 > Extra C object files: -lcryptokit_stubs -lz > Extra C options: >=20 > Do you have the same lines? If so, maybe -linkall is missing in the call > to ocamlopt -shared (the one that builds cryptokit.cmxs). These lines are present in the .cmxa. But, sutdying the build commands, the .cmxs is produced from cryptokit.cmx, not cryptokit.cmxa. Running by hand=20 # camlfind ocamlopt -shared -I src src/cryptokit.cmxa -linkall -o \ src/cryptokit.cmxs includes the missing code: # objdump -j .text -T src/cryptokit.cmxs | grep sha1_init 0000000000037e2b g DF .text 000000000000001b Base caml_sha1_init I will report to the cryptokit authors. Thansk for your help ! Cheers, Maxence