caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem with findlib and threads
@ 2002-10-14 13:59 Hans Ole Rafaelsen
  2002-10-14 21:59 ` Gerd Stolpmann
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Ole Rafaelsen @ 2002-10-14 13:59 UTC (permalink / raw)
  To: caml-list

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,

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.

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.


I'm able to use native-threads if I don't compile it as a library, but
makes the module XmlRPCServer part of the test application I'm
creating.  So I would guess the problem is not that I have
native-threads incorrectly installed.

I'm runing debian-3 stable.  ocaml 3.06 compiled form sources, with
thread support.


Any suggestions on that I might be doing wrong?

Kindest regards,

Hans Ole Rafaelsen
-------------------
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


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

* Re: [Caml-list] Problem with findlib and threads
  2002-10-14 13:59 [Caml-list] Problem with findlib and threads Hans Ole Rafaelsen
@ 2002-10-14 21:59 ` Gerd Stolpmann
  2002-10-15  8:08   ` Hans Ole Rafaelsen
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Stolpmann @ 2002-10-14 21:59 UTC (permalink / raw)
  To: Hans Ole Rafaelsen; +Cc: caml-list


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


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

* Re: [Caml-list] Problem with findlib and threads
  2002-10-14 21:59 ` Gerd Stolpmann
@ 2002-10-15  8:08   ` Hans Ole Rafaelsen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Ole Rafaelsen @ 2002-10-15  8:08 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: caml-list

It did help.

There was just a minor problem using -thread.  It requires that a
multitreaded version of the xmlrpc library is provided.  Making a copy
of xmlrpc.cma to xmlrpc_mt.cma and the same for the .cmxa and .a file,
and then installing these files as part of xmlrpc package solved those
problems.


Thanks,

Hans Ole

Gerd Stolpmann <info@gerd-stolpmann.de> writes:

> 
> Maybe -thread is missing? Selecting the package "threads" without -thread does
> not have any effect.
> 
> 
> 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


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

end of thread, other threads:[~2002-10-15  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14 13:59 [Caml-list] Problem with findlib and threads Hans Ole Rafaelsen
2002-10-14 21:59 ` Gerd Stolpmann
2002-10-15  8:08   ` Hans Ole Rafaelsen

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