caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Aaron Bohannon <bohannon@seas.upenn.edu>
To: caml-list@yquem.inria.fr
Subject: how to use c wrapper files in libraries
Date: Mon, 20 Jul 2009 10:28:15 -0400	[thread overview]
Message-ID: <c413fcb70907200728r1ca750a1s2fa57ccc9a4b0866@mail.gmail.com> (raw)

Hello,

I am trying to use the wrapper for libsndfile contributed by Erik de
Castro Lopo (http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=556).
The wrapper code compiles just fine.  And the tests that use the OCaml
library it builds work just fine.  However, I am having a frustrating
compile-time error when I try to compile my program in a different
directory.

The wrapper code is being packaged into an OCaml library using the
following command:

ocamlc -a -o sndfile.cma -custom sndfile_stub.o sndfile.cmo \
  -ccopt -L/usr/local/lib -cclib -lsndfile

Within the same directory, the test program can be successfully compiled with:

ocamlc -o test_sndfile sndfile.cma test_sndfile.ml

Within a different directory, I used:

ocamlc -o mytest -I /path/to/libsndfile-ocaml/files/   sndfile.cma   mytest.ml

And I get:

powerpc-apple-darwin8-gcc-4.0.1: sndfile_stub.o: No such file or directory
Error while building custom runtime system

I have tried setting every path-related option I could find, and
nothing helped.  I tried reading everything I could find about
compiling and using c wrappers for OCaml, but there is a severe lack
of documentation on the topic.  In particular, I could find no example
of a c object file being given as an argument to an "ocamlc -a"
command, so I am not sure what that is supposed to do, which makes it
impossible for me to understand this error message.

I am using OCaml 3.10.1 on OS X 10.4.  Any help would be appreciated.

 - Aaron


             reply	other threads:[~2009-07-20 14:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20 14:28 Aaron Bohannon [this message]
2009-07-20 14:58 ` [Caml-list] " RABIH.ELCHAAR
2009-07-20 16:21   ` Aaron Bohannon
2009-07-21  8:48     ` RABIH.ELCHAAR
2009-07-21 13:26       ` Aaron Bohannon
2009-07-20 23:40 ` Erik de Castro Lopo

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=c413fcb70907200728r1ca750a1s2fa57ccc9a4b0866@mail.gmail.com \
    --to=bohannon@seas.upenn.edu \
    --cc=caml-list@yquem.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).