Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Undefined symbols error (Was: ocamlc vs ocamlc.opt?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-02 (22:51)
From: Nathaniel Gray <n8gray@g...>
Subject: Undefined symbols error (Was: ocamlc vs ocamlc.opt?)
On 1/31/07, Robert Roessler <> wrote:
> I just ran into a problem where building a bytecode executable failed
> with findlib ("ocamlfind ocamlc ...") but the equivalent non-findlib
> command worked.  Then I saw that I could force the same error message
> in my non-findlib build by just matching findlib's ocamlc.opt, while I
> had used ocamlc.
> The command line is:
> ocamlc -o bait -I +lablgtk2 -I +lablscintilla -thread threads.cma
> lablgtk.cma gtkInit.cmo scintilla.cma
> which works fine.  Changing ocamlc to ocamlc.opt yields:
> Error on dynamically loaded library:
> /usr/lib/ocaml/stublibs/ undefined symbol:
> caml_names_of_builtin_cprim
> This is on FC6, with a Yum-installed OCaml 3.09.3 package.  Both of
> the versions of the compiler identify themselves as 3.09.3 with the
> same standard library location, and both were built on Dec 2 of 2006.
> So should the versions of ocamlc behave the same excepting performance
> issues, or ?

I'm getting this error on a g++ build step:

g++ -L/sw/lib/ -o  ml_scintilla.o
liblablscintilla.a "/usr/local/godi/lib/ocaml/std-lib"/libcamlrun.a
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
-lpangoft2-1.0 -lpango-1.0 -lfreetype.6 -lgobject-2.0 -lgmodule-2.0
-ldl -lglib-2.0 -lgthread-2.0
/usr/bin/ld: Undefined symbols:

It may or may not be a coincidence, but I'm trying to build your
lablscintilla package.  This is on OS X 10.4 with godi-installed OCaml
3.09.3.  FWIW, these symbol references appear to come from
libcamlrun.a.  They don't appear in libasmrun.

[n8gray@golux n8gray]$ nm -a
/usr/local/godi/lib/ocaml/std-lib/libcamlrun.a | grep builtin_cprim
         U _caml_names_of_builtin_cprim
         U _caml_builtin_cprim
         U _caml_names_of_builtin_cprim
[n8gray@golux n8gray]$ nm -a
/usr/local/godi/lib/ocaml/std-lib/libasmrun.a | grep builtin_cprim

Building the native-code version works fine.

>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- -->