From: Keyan <ml@pulsschlag.net>
To: ygrek <ygrekheretix@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] libasmrun.a not compatible with dynamic linking on mac os x
Date: Sat, 21 Jul 2012 19:16:38 +0200 [thread overview]
Message-ID: <23488C91-9176-40A9-95C0-7F04BD90A442@pulsschlag.net> (raw)
In-Reply-To: <20120721113102.bd7e8914.ygrekheretix@gmail.com>
Hi,
thanks for trying. I just recently solved this issue by compiling the code differently:
ocamlopt -o mylib.so ocaml_source.ml -ccopt my_c_source.c -ccopt -shared
g++ -dynamiclib -o myfinallib.dylib -L/usr/local/lib/ocaml/ -lasmrun -lnums -ldl -Wl,-search_paths_first -Wl,-headerpad_max_install_names -fPIC Controller.o mylib.so
I haven't even checked yet, if all the options are really required, i.e. -fPIC, and both -Wl, options.
Best,
Keyan
On 21 Jul 2012, at 10:31, ygrek wrote:
> On Mon, 16 Jul 2012 17:05:53 +0200
> Keyan <ml@pulsschlag.net> wrote:
>
>> Hi,
>>
>> i try to compile a dynamic library on mac os x, from ocaml-code using the following lines in my makefile;
>>
>> camlopt -output-obj -o ocaml_controller.o -I /usr/local/lib/ocaml/site-lib/batteries ocaml_controller.ml
>> ocamlc -o ocaml_interface.o -c ocaml_interface.c -I /usr/local/lib/ocaml/
>> libtool -static -a -o mylib.a /usr/local/lib/ocaml/libasmrun.a ocaml_controller.o ocaml_interface.o
>> g++ -o Controller.o -c Controller.cpp
>> g++ -v -dynamiclib -o libController.dylib Controller.o mylib.a
>
> I couldn't fully reproduce these steps (on linux) because libtool doesn't want to accept such command line.
> But still what occurs to me - you probably shouldn't use "ocaml_controller.o" as -output-obj target, because
> the file with such name is generated as a .cmx companion. Name it smth like ocaml_controller_obj.o.
> I've got ocamlopt errors otherwise. Does it help?
>
> --
> ygrek
> http://ygrek.org.ua
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
next prev parent reply other threads:[~2012-07-21 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 15:05 Keyan
2012-07-21 8:31 ` ygrek
2012-07-21 17:16 ` Keyan [this message]
2012-07-24 11:34 ` Damien Doligez
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=23488C91-9176-40A9-95C0-7F04BD90A442@pulsschlag.net \
--to=ml@pulsschlag.net \
--cc=caml-list@inria.fr \
--cc=ygrekheretix@gmail.com \
/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