From: Keyan <ml@pulsschlag.net>
To: caml-list@inria.fr
Subject: [Caml-list] libasmrun.a not compatible with dynamic linking on mac os x
Date: Mon, 16 Jul 2012 17:05:53 +0200 [thread overview]
Message-ID: <6616C34B-0FEC-4031-ABA8-8181D7654533@pulsschlag.net> (raw)
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
The problem occurs at the last line, i.e. during linking of the dynamic lib.
Undefined symbols for architecture x86_64:
"_caml_code_area_start", referenced from:
_segv_handler in output.a(signals_asm.o)
_caml_code_checksum in output.a(intern.o)
_intern_rec in output.a(intern.o)
_extern_rec in output.a(extern.o)
"_caml_code_area_end", referenced from:
_segv_handler in output.a(signals_asm.o)
_caml_code_checksum in output.a(intern.o)
_intern_rec in output.a(intern.o)
_extern_rec in output.a(extern.o)
"_caml_atom_table", referenced from:
_caml_alloc in output.a(alloc.o)
_caml_alloc_dummy_float in output.a(alloc.o)
_caml_alloc_dummy in output.a(alloc.o)
_caml_alloc_array in output.a(alloc.o)
_caml_copy_string_array in output.a(alloc.o)
_intern_alloc in output.a(intern.o)
_intern_rec in output.a(intern.o)
...
ld: symbol(s) not found for architecture x86_64
libasmrun contains the symbols:
> nm /usr/local/lib/ocaml/libasmrun.a | grep _caml_code_area_start
0000000000000008 C _caml_code_area_start
U _caml_code_area_start
U _caml_code_area_start
U _caml_code_area_start
The problem only occurs while linking a dymamiclib, _not_ during a static lib, or an executable, with a c++ main. It seems that the libasmrun.a is not compatible with dynamic linking on mac os x.
Any help is very welcome!
Cheers,
Keyan
next reply other threads:[~2012-07-16 15:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 15:05 Keyan [this message]
2012-07-21 8:31 ` ygrek
2012-07-21 17:16 ` Keyan
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=6616C34B-0FEC-4031-ABA8-8181D7654533@pulsschlag.net \
--to=ml@pulsschlag.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