caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: [Caml-list] Re: Problem native dynlink loading cryptokit
Date: Fri, 9 Aug 2013 12:41:09 +0000 (UTC)	[thread overview]
Message-ID: <slrnl09orc.ntq.sylvain@le-gall.net> (raw)
In-Reply-To: <20130809141346.6d240680@alcazar>

On 09-08-2013, Maxence Guesdon <Maxence.Guesdon@inria.fr> wrote:
> On Fri, 9 Aug 2013 11:49:44 +0200
> Maxence Guesdon <Maxence.Guesdon@inria.fr> wrote:
>
>> On Fri, 09 Aug 2013 11:43:53 +0200
>> Stéphane Glondu <steph@glondu.net> wrote:
>> 
>> > Le 09/08/2013 11:33, Maxence Guesdon a écrit :
>> > >>> 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?
>> > > 
>> > > No, I only have camlCryptokit__sha1_init_3833 which I assume corresponds
>> > > to the function of src/cryptokit.ml:
>> > >  external sha1_init: unit -> string = "caml_sha1_init"
>> > 
>> > Then, I suspect stubs were forgotten during the build of cryptokit.cmxs.
>> > In the output of:
>> > 
>> >   ocamlobjinfo /path/to/cryptokit.cmxa
>> > 
>> > there should be the following lines:
>> > 
>> >   Extra C object files: -lcryptokit_stubs -lz
>> >   Extra C options:
>> > 
>> > 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 
>> # camlfind ocamlopt -shared -I src  src/cryptokit.cmxa -linkall -o \
>>   src/cryptokit.cmxs
>
> For the records, as suggested by Sylvain Le Gall, adding
> use_libcryptokit_stubs in the _tags file to get:
>
>   "src/cryptokit.cmxs": use_cryptokit, use_libcryptokit_stubs
>
> also produced a .cmxs file with the C part.
>

FTR, this is an OASIS bug:
https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1304&group_id=54&atid=291

It will be quickly fixed in cryptokit and later the fix will be included
in OASIS itself so the next version of OASIS will fix this bug for all
OASIS enabled packages.

Cheers
Sylvain

--
Website:     http://sylvain.le-gall.net/
OCaml forge: http://forge.ocamlcore.org
OCaml blogs: http://planet.ocaml.org


      reply	other threads:[~2013-08-09 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  9:09 [Caml-list] " Maxence Guesdon
2013-08-09  9:27 ` Stéphane Glondu
2013-08-09  9:33   ` Maxence Guesdon
2013-08-09  9:43     ` Stéphane Glondu
2013-08-09  9:49       ` Maxence Guesdon
2013-08-09 12:13         ` Maxence Guesdon
2013-08-09 12:41           ` Sylvain Le Gall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnl09orc.ntq.sylvain@le-gall.net \
    --to=sylvain@le-gall.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).