caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Marek Kubica <marek@xivilization.net>
To: caml-list@inria.fr
Subject: [Caml-list] OASIS: linking with C library fails
Date: Wed, 19 Dec 2012 20:27:28 +0100	[thread overview]
Message-ID: <20121219202728.4fa184a3@xivilization.net> (raw)

Hi,

I have got this simple example where I try to call a C funtion from
libarchive (yes, I am aware of ocaml-archive):

https://gist.github.com/c52d47cff10e4fe8af33

launcher.ml includes Archive.ml which wraps the C file Archive_stubs.c
which calls libarchive.

Unfortunately, I get an error when I try to build it, it boils down to
this:

src/launch.o: In function `camlLaunch__entry':
/home/marek/ostreamer/_build/src/launch.ml:3: undefined reference to
`ost_version_number'
src/Archive.o: In function `camlArchive':
(.data+0x10): undefined reference to `ost_version_number'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
Command exited with code 2.

You can see the complete output (after ocaml setup.ml -clean) in the
Gist. Now I wonder how to fix it? From what I see, Archive_stubs.c gets
compiled to an .o file properly but linking fails as it doesn't seem to
get linked to the library. What am I missing?

regards,
Marek

             reply	other threads:[~2012-12-19 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 19:27 Marek Kubica [this message]
2012-12-19 19:38 ` Marek Kubica

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=20121219202728.4fa184a3@xivilization.net \
    --to=marek@xivilization.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).