tags:

views:

207

answers:

2

Hi,

I'm trying to install the ocaml-sqlite3 bindings, to access a sqlite database from an o'caml program.

The configure and make go smoothly, but the installation fails. Because the file sqlite3.cma is not a bytecode object file (see below).

    ~/Software/ocaml-sqlite3-release-1.5.6> sudo make install

[ -f *.so ] && SO_FILES=*.so; \
        ocamlfind install sqlite3 META sqlite3.cmi sqlite3.mli sqlite3.cma *.cmxa *.a *.cmx $SO_FILES
Installed /usr/lib64/ocaml/site-lib/sqlite3/dllsqlite3_stubs.so
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.cmx
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.a
Installed /usr/lib64/ocaml/site-lib/sqlite3/libsqlite3_stubs.a
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.cmxa
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.cma
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.mli
Installed /usr/lib64/ocaml/site-lib/sqlite3/sqlite3.cmi
Installed /usr/lib64/ocaml/site-lib/sqlite3/META
Updated /usr/lib64/ocaml/ld.conf
ocamlfind ocamlmktop -o sqlite3top -package "sqlite3" sqlite3.cma
The file sqlite3.cma is not a bytecode object file
make: *** [install] Error 2

What is the general reason for that and have you experienced that for this particular lib ? I'm running ocaml v 3.11.1 compiled from source.

EDIT: It seems the file is provided by ocamlfind, maybe the problem is due to the fact that i'm using a 64 environment ?

+2  A: 

So it seems the problem was coming from different directions:

First, the ocaml compiler used by ocamlfind was not the right. I've figured that out by looking at the /usr/local/etc/findlib.conf. The ocamlc was pointing towards ocamlopt.opt and that was version 3.10.

Then, I had to recompile findlib. But there was a problem because I'm on a 64 architectures and some elements were not found, so I had to reconfigure findlib modifying -bindir and -sitelib mainly.

I've also recompiled the ocaml system with -cc "gcc -m64" but I'm not sure it has any effect.

Now, it works but i've to use -I to add the directory of sqlite3.cma (/usr/lib64/ocaml/site-lib/sqlite3).

Not sure that could help anybody though :-).

LB
+2  A: 

Usually this error appears when ocaml compiler attempts to use binary files (cma,cmo,etc) created by another version of ocaml. In particular, it means that you need to recompile all the libraries when upgrading ocaml (even with minor version shift like 3.11.0 -> 3.11.1).

Could that be that ocamlfind invoked different ocaml installations at make and make install stages?

ygrek
yep you're right, this is what i wrote in my answer, the /usr/local/etc/findlib.conf was using ocamlopt.opt which pointed to an older version of ocaml.
LB