English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-23 (08:24)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] Threads?
> It's been about 5 years since I faced this situation. I'm trying to link
my program against the Thread module. Things go well until I do the ocamlopt
compilation, then it aborts the make with the message:
> ocamlfind ocamlopt -thread -o sdsp.opt   -package camlp4 -package threads
-package unix -I ../src -I /usr/local/lib/ocaml/threads  \
>	-thread -cclib threads.a  nums.cmxa sdsp.cmxa threads/threads.cmxa  
>	readline.cmx scmMain.cmx 

You're missing -linkpkg. It looks like your command should be

ocamlfind ocamlopt -thread -o sdsp.opt -package camlp4,threads,unix,num
-linkpkg -I ../src sdsp.cmxa readline.cmx scmMain.cmx

	-I /usr/local/lib/ocaml/threads ==> will be added by ocamlfind
	-cclib threads.a ==> I think will be added automatically by
	nums.cmxa ==> is better included by having num in your list of
findlib packages
	threads/threads.cmxa ==> will be included by ocamlfind (when
-linkpkg is given and -package threads)

AFAIK, ocamlfind always puts libraries first when linking (and they will be
in the correct order because findlib understands inter-library

Incidentally, when hitting problems like this with ocamlfind, passing
-verbose is really useful - because it causes ocamlfind (as well as
ocamlopt) to display precise information on what's being called so you can
diagnose the problem. When using ocamlfind, you should never have to use -I
or specify the name of a .cmxa/.cma file (if it's part of a findlib package)