caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] libasmrun.a not compatible with dynamic linking on mac os x
@ 2012-07-16 15:05 Keyan
  2012-07-21  8:31 ` ygrek
  0 siblings, 1 reply; 4+ messages in thread
From: Keyan @ 2012-07-16 15:05 UTC (permalink / raw)
  To: caml-list

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-24 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 15:05 [Caml-list] libasmrun.a not compatible with dynamic linking on mac os x Keyan
2012-07-21  8:31 ` ygrek
2012-07-21 17:16   ` Keyan
2012-07-24 11:34     ` Damien Doligez

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).