From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA07765; Mon, 14 Oct 2002 23:59:34 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA07883 for ; Mon, 14 Oct 2002 23:59:33 +0200 (MET DST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9ELxW501033 for ; Mon, 14 Oct 2002 23:59:32 +0200 (MET DST) Received: from [212.227.126.160] (helo=mrelayng0.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 181DFM-0006MI-00; Mon, 14 Oct 2002 23:59:32 +0200 Received: from [80.129.99.103] (helo=gate.gerd-stolpmann.de) by mrelayng0.kundenserver.de with asmtp (Exim 3.35 #1) id 181DFL-0002TD-00; Mon, 14 Oct 2002 23:59:31 +0200 Received: from ice.gerd-stolpmann.de (ice.gerd-stolpmann.de [192.168.0.13]) by gate.gerd-stolpmann.de (Postfix) with ESMTP id 68EB2CCDD; Mon, 14 Oct 2002 23:59:29 +0200 (CEST) Received: from ice (localhost [127.0.0.1]) by ice.gerd-stolpmann.de (Postfix) with ESMTP id 01BFDB0B7; Mon, 14 Oct 2002 23:59:27 +0200 (CEST) Date: Mon, 14 Oct 2002 23:59:27 +0200 From: Gerd Stolpmann To: Hans Ole Rafaelsen Cc: caml-list@inria.fr Subject: Re: [Caml-list] Problem with findlib and threads Message-ID: <20021014215927.GK1002@ice.gerd-stolpmann.de> References: <3az4rbpm89e.fsf@itherther.simula.no> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3az4rbpm89e.fsf@itherther.simula.no>; from hans@simula.no on Mon, Okt 14, 2002 at 15:59:09 +0200 X-Mailer: Balsa 1.4.0 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Am 2002.10.14 15:59 schrieb(en) Hans Ole Rafaelsen: > Hello, > > I'm having trouble linking a library which uses threads, using > ocamlfind. The library I'm having trouble with, is the xmlrpc > library. (I have added a module which handles xmlrpc requests, and > this module uses threads.) > > ocamlfind ocamlopt -linkpkg -package "stew xmlrpc threads" -o server.opt application_impl.cmx application_skeleton.cmx main_server.cmx > No implementations provided for the following modules: > Thread referenced from /usr/local//lib/ocaml/site-lib/xmlrpc/xmlrpc.cmxa(XmlRPCServer) > > If I remove threads form the package list, I get the same error, Maybe -thread is missing? Selecting the package "threads" without -thread does not have any effect. > ocamlfind ocamlopt -linkpkg -package "stew xmlrpc" -o server.opt application_impl.cmx application_skeleton.cmx main_server.cmx > No implementations provided for the following modules: > Thread referenced from > /usr/local//lib/ocaml/site-lib/xmlrpc/xmlrpc.cmxa(XmlRPCServer) > > but removing another package, results in errors related to modules > defined in that package, and which is what you would expect. > > ocamlfind ocamlopt -linkpkg -package "xmlrpc threads" -o server.opt application_impl.cmx application_skeleton.cmx main_server.cmx > No implementations provided for the following modules: > Time referenced from /usr/local//lib/ocaml/site-lib/xmlrpc/xmlrpc.cmxa(XmlRPCServer) > Thread referenced from /usr/local//lib/ocaml/site-lib/xmlrpc/xmlrpc.cmxa(XmlRPCServer) > > Thus, it seems that trying to link with the threads library have no > effect. As explained. > > I have a similar problem with the byte-code version, but I was able to > get round the problem by linking in the thread library while linking > the xmlrpc library. > > ocamlfind ocamlc -cclib '-lstew' -thread -package "xstr threads netclient netstring equeue pxp pcre stew " -a -o xmlrpc.cma \ > -predicates "" threads.cma xmlRPCTypes.cmo xmlRPCDtd.cmo > xmlRPCNet.cmo xmlRPCClient.cmo xmlRPCServerMethods.cmo > xmlRPCServer.cmo > > This is probably not the right way to do this, and trying the same > approach with the native-code version does not work. > > ocamlfind ocamlopt -cclib '-lstew' -thread -package "xstr threads netclient netstring equeue pxp pcre stew " -a -o xmlrpc.cmxa \ > -predicates "" threads.cmxa xmlRPCTypes.cmx xmlRPCDtd.cmx xmlRPCNet.cmx xmlRPCClient.cmx xmlRPCServerMethods.cmx xmlRPCServer.cmx > /usr/local//lib/ocaml//threads/threads.cmxa > is not a compilation unit description. Linking a library with libraries does not work for native code. Btw, your approach would also not work if ocaml had been configured for bytecode threads, because the -thread option has a special effect in this case (selects a different version of the standard library). This is why ocamlfind demands -thread always, even if the ocaml compiler sometimes does not need it (when linking executables for POSIX threads). Simply follow the rule: Give both -thread and -package threads for compiling and linking. I hope this helps, Gerd ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de ------------------------------------------------------------ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners