caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Trying out Ocaml CVS HEAD
@ 2008-04-12 13:49 Dario Teixeira
  2008-04-16  6:55 ` [Caml-list] " Alain Frisch
  0 siblings, 1 reply; 4+ messages in thread
From: Dario Teixeira @ 2008-04-12 13:49 UTC (permalink / raw)
  To: caml-list

Hi,

I realise that the Ocaml CVS HEAD comes with an implicit "Here be dragons"
warning.  Still, I would like to use it so I can try running Ocsigen in
native mode (the loading of Ocsigen modules relies on dynlink; native mode
thus requires the new natdynlink feature).  I've compiled the Ocaml CVS via
GODI, using the instructions in Alain Frisch's page; though the compilation
completes with no problems and the compiler itself seems to work fine, I
always get an error when Ocsigen tries to dynlink (either in byte-code or
native-code) a module that uses stub libraries.  One example is camlzip;
here's the error message I get:

[errors.log] 2008-04-12 14:15:31 - Fatal - While loading
/home/dario/.godi/lib/ocaml/pkg-lib/camlzip/camlzip.cma:
Dynlink.Error: error loading shared library:
/home/dario/.godi/lib/ocaml/pkg-lib/stublibs/dllcamlzip_stubs.so:
/home/dario/.godi/lib/ocaml/pkg-lib/stublibs/dllcamlzip_stubs.so:
undefined symbol: caml_named_value


Now, is this a transient problem related to catching the CVS HEAD in a grumpy
day, or is there something else at play?

(This was tried out on a i386 machine running Debian Testing;  The Ocaml
version is "3.11+dev12 Private_abbrevs+natdynlink (2008-02-29)", and gcc's
version is 4.2.3 (Debian 4.2.3-3))

Thanks in advance for your help!
Cheers,
Dario Teixeira





      ___________________________________________________________ 
Yahoo! For Good helps you make a difference  

http://uk.promotions.yahoo.com/forgood/


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

* Re: [Caml-list] Trying out Ocaml CVS HEAD
  2008-04-12 13:49 Trying out Ocaml CVS HEAD Dario Teixeira
@ 2008-04-16  6:55 ` Alain Frisch
  2008-04-16 21:23   ` Dario Teixeira
  0 siblings, 1 reply; 4+ messages in thread
From: Alain Frisch @ 2008-04-16  6:55 UTC (permalink / raw)
  To: Dario Teixeira; +Cc: caml-list

Hi Dario,

> I realise that the Ocaml CVS HEAD comes with an implicit "Here be dragons"
> warning.

Sure, but it is very helpful to get some feedback!

> Still, I would like to use it so I can try running Ocsigen in
> native mode (the loading of Ocsigen modules relies on dynlink; native mode
> thus requires the new natdynlink feature).  I've compiled the Ocaml CVS via
> GODI, using the instructions in Alain Frisch's page; though the compilation
> completes with no problems and the compiler itself seems to work fine, I
> always get an error when Ocsigen tries to dynlink (either in byte-code or
> native-code) a module that uses stub libraries.

I've been able to reproduce the problem in byte-code only, when the main 
program is linked in -custom mode. The reason is that the -Wl,-E was not 
passed to the linker. This is now fixed in the CVS. (For a quick test, 
you can try to pass "-ccopt -Wl,-E" explicitly to ocamlc when linking.)

For the native-code, I don't know. Can you show me the command line 
passed to the linker (ocamlopt -verbose)? You should see -Wl,-E.
If you compile with -noautolink, you must add "-ccopt -Wl,-E" manually.


Cheers,

Alain


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

* Re: [Caml-list] Trying out Ocaml CVS HEAD
  2008-04-16  6:55 ` [Caml-list] " Alain Frisch
@ 2008-04-16 21:23   ` Dario Teixeira
  2008-04-17  8:28     ` Alain Frisch
  0 siblings, 1 reply; 4+ messages in thread
From: Dario Teixeira @ 2008-04-16 21:23 UTC (permalink / raw)
  To: Alain Frisch; +Cc: caml-list

> 
> I've been able to reproduce the problem in byte-code only, when the main 
> program is linked in -custom mode. The reason is that the -Wl,-E was not 
> passed to the linker. This is now fixed in the CVS. (For a quick test, 
> you can try to pass "-ccopt -Wl,-E" explicitly to ocamlc when linking.)
> 
> For the native-code, I don't know. Can you show me the command line 
> passed to the linker (ocamlopt -verbose)? You should see -Wl,-E.
> If you compile with -noautolink, you must add "-ccopt -Wl,-E" manually.
> 

Hi Alain,

Thanks for the help.  I have recompiled the Ocaml compiler using the latest
CVS, and bytecode now seems to work fine.  As for native code, I am still
having some problems.  There's a subset of modules that load fine, but
also one module that produces an error message when the main programme
attempts to load it.  As far as I can tell, what distinguishes this
problematic module from the ones that work fine is the fact that its cmxs
file is built from a large number of cmx files, whereas the cmxs from a
"good" module is built from a single cmx.

Here are the compiler lines that build the cmx and cmxs for a good module:
(note the "-dlcode" used to build the cmx and the "-dlcode -shared -linkall"
used to link the cmxs)

ocamlfind ocamlopt  -thread -package netstring,camlzip,sqlite3 -I ../lwt -I
../baselib -I ../http -I ../xmlp4 -I ../server -I ../extensions -I ../eliom 
-dlcode -c deflatemod.ml

ocamlfind ocamlopt  -thread -package netstring,camlzip,sqlite3 -I ../lwt -I
../baselib -I ../http -I ../xmlp4 -I ../server -I ../extensions -I ../eliom
-dlcode -shared -linkall -o deflatemod.cmxs deflatemod.cmx


The lines for the problematic module are (almost) identical, except that the
order of arguments is not the same, and the linking stage takes multiple cmx
arguments instead of just one:

ocamlfind ocamlopt -dlcode -verbose -thread -package netstring,cryptokit -I
../lwt -I ../baselib -I ../http -I ../xmlp4 -I
../server -I ../extensions -I ../eliom -shared -linkall -o eliom.cmxs \
        error_pages.cmx \
        eliommod_sessiongroups.cmx eliom_common.cmx \
        eliommod_gc.cmx eliommod_persess.cmx \
        eliommod_sessadmin.cmx eliommod_cookies.cmx  \
        eliommod_naservices.cmx eliommod_sersess.cmx eliommod_sessexpl.cmx \
        eliommod_datasess.cmx eliommod_pagegen.cmx \
        eliommod_services.cmx eliommod_timeouts.cmx \
        eliommod.cmx eliom_sessions.cmx \
        eliom_parameters.cmx eliom_services.cmx \
        eliom_mkforms.cmx eliom_mkreg.cmx eliom_predefmod.cmx \
        eliom_tools.cmx


As for the runtime error message, this is what is produced when the programme
attempts to load eliom.cmxs:

[errors.log] 2008-04-16 22:15:50 - Fatal - While loading
/home/dario/.local/lib/ocsigen/extensions/eliom.cmxs: Dynlink.Error: no
implementation available for Eliommod_persess

(note that Eliommod_persess.cmx is included in the list of modules that
are linked into eliom.cmxs)

Kind regards,
Dario Teixeira



      ___________________________________________________________ 
Yahoo! For Good helps you make a difference  

http://uk.promotions.yahoo.com/forgood/


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

* Re: [Caml-list] Trying out Ocaml CVS HEAD
  2008-04-16 21:23   ` Dario Teixeira
@ 2008-04-17  8:28     ` Alain Frisch
  0 siblings, 0 replies; 4+ messages in thread
From: Alain Frisch @ 2008-04-17  8:28 UTC (permalink / raw)
  To: caml-list

Dario Teixeira wrote:
> As for the runtime error message, this is what is produced when the programme
> attempts to load eliom.cmxs:
> 
> [errors.log] 2008-04-16 22:15:50 - Fatal - While loading
> /home/dario/.local/lib/ocsigen/extensions/eliom.cmxs: Dynlink.Error: no
> implementation available for Eliommod_persess
> 
> (note that Eliommod_persess.cmx is included in the list of modules that
> are linked into eliom.cmxs)

Could it be the case that:
- Dynlink.init is called several times?
- one of the modules raises an exception during its execution?
- the link order is wrong (Eliommod_persess is used by a module linked 
before itself)?

I'll be happy to investigate the problem if you could prepare a 
(preferably small) stand-alone reproduction case.


Alain


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

end of thread, other threads:[~2008-04-17  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-12 13:49 Trying out Ocaml CVS HEAD Dario Teixeira
2008-04-16  6:55 ` [Caml-list] " Alain Frisch
2008-04-16 21:23   ` Dario Teixeira
2008-04-17  8:28     ` Alain Frisch

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