caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Dynlink and ocamlfind for camlp4 3.11?
@ 2009-10-04 14:22 Conglun Yao
  2009-10-04 14:24 ` Conglun Yao
  2009-10-04 19:05 ` [Caml-list] " Richard Jones
  0 siblings, 2 replies; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 14:22 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Dear all,

I have tried to use json-static in OCaml 3.11, but met the annoying problem:

                    Reference to undefined global `Dynlink'


As Camlp4 3.11 requires explicit load of  dynlink, so I tried

                   ocamlfind ocamlc -package dynlink, json-static -syntax
camlp4o -o test  test.ml -linkpkg

But failed with the same error.

Thanks for any help.

Conglun

[-- Attachment #2: Type: text/html, Size: 473 bytes --]

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

* Re: Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 14:22 Dynlink and ocamlfind for camlp4 3.11? Conglun Yao
@ 2009-10-04 14:24 ` Conglun Yao
  2009-10-04 19:05 ` [Caml-list] " Richard Jones
  1 sibling, 0 replies; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 14:24 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

On Sun, Oct 4, 2009 at 3:22 PM, Conglun Yao <yaoconglun@gmail.com> wrote:

> Dear all,
>
> I have tried to use json-static in OCaml 3.11, but met the annoying
> problem:
>
>                     Reference to undefined global `Dynlink'
>
>
> As Camlp4 3.11 requires explicit load of  dynlink, so I tried
>
>                    ocamlfind ocamlc -package dynlink, json-static -syntax
> camlp4o -o test  test.ml -linkpkg
>
> But failed with the same error.
>


Sorry, forget to say,  I tried this under cygwin.



>
> Thanks for any help.
>
> Conglun
>

[-- Attachment #2: Type: text/html, Size: 1092 bytes --]

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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 14:22 Dynlink and ocamlfind for camlp4 3.11? Conglun Yao
  2009-10-04 14:24 ` Conglun Yao
@ 2009-10-04 19:05 ` Richard Jones
  2009-10-04 19:32   ` Conglun Yao
  1 sibling, 1 reply; 17+ messages in thread
From: Richard Jones @ 2009-10-04 19:05 UTC (permalink / raw)
  To: Conglun Yao; +Cc: caml-list

On Sun, Oct 04, 2009 at 03:22:31PM +0100, Conglun Yao wrote:
> Dear all,
> 
> I have tried to use json-static in OCaml 3.11, but met the annoying problem:
> 
>                     Reference to undefined global `Dynlink'
> 
> 
> As Camlp4 3.11 requires explicit load of  dynlink, so I tried
> 
>                    ocamlfind ocamlc -package dynlink, json-static -syntax
> camlp4o -o test  test.ml -linkpkg

Is there really a space in "dynlink, json-static".  You'll need to try
it without the space, or quote it.

Rich.

-- 
Richard Jones
Red Hat


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:05 ` [Caml-list] " Richard Jones
@ 2009-10-04 19:32   ` Conglun Yao
  2009-10-04 19:37     ` Richard Jones
  0 siblings, 1 reply; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 19:32 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

Thanks, Rich.

ocamlfind ocamlc -package dynlink,json-static -syntax camlp4o -c test.ml
ocamlfind ocamlc -package "dynlink,json-static" -syntax camlp4o -c test.ml
ocamlfind ocamlc -package 'dynlink,json-static' -syntax camlp4o -c test.ml

But it still does not work.

System:  cygwin  + OCaml 3.11.1 + findlib 1.2.5 + json-staic 0,9.8

Everything works fine when I use Ubuntu, but when changed to cygwin, it
breaks.

Conglun

On Sun, Oct 4, 2009 at 8:05 PM, Richard Jones <rich@annexia.org> wrote:

> On Sun, Oct 04, 2009 at 03:22:31PM +0100, Conglun Yao wrote:
> > Dear all,
> >
> > I have tried to use json-static in OCaml 3.11, but met the annoying
> problem:
> >
> >                     Reference to undefined global `Dynlink'
> >
> >
> > As Camlp4 3.11 requires explicit load of  dynlink, so I tried
> >
> >                    ocamlfind ocamlc -package dynlink, json-static -syntax
> > camlp4o -o test  test.ml -linkpkg
>
> Is there really a space in "dynlink, json-static".  You'll need to try
> it without the space, or quote it.
>
> Rich.
>
> --
> Richard Jones
> Red Hat
>

[-- Attachment #2: Type: text/html, Size: 1694 bytes --]

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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:32   ` Conglun Yao
@ 2009-10-04 19:37     ` Richard Jones
  2009-10-04 19:53       ` Conglun Yao
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Jones @ 2009-10-04 19:37 UTC (permalink / raw)
  To: Conglun Yao; +Cc: caml-list

On Sun, Oct 04, 2009 at 08:32:17PM +0100, Conglun Yao wrote:
> Thanks, Rich.
> 
> ocamlfind ocamlc -package dynlink,json-static -syntax camlp4o -c test.ml
> ocamlfind ocamlc -package "dynlink,json-static" -syntax camlp4o -c test.ml
> ocamlfind ocamlc -package 'dynlink,json-static' -syntax camlp4o -c test.ml
> 
> But it still does not work.
> 
> System:  cygwin  + OCaml 3.11.1 + findlib 1.2.5 + json-staic 0,9.8

In that case, try listing dynlink explicitly, like:

  ocamlfind ocamlc dynlink.cma -package json-static [etc]

Anyhow, it sounds like a bug in the META files that are supplied with
your cygwin OCaml distribution.

Rich.

-- 
Richard Jones
Red Hat


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:37     ` Richard Jones
@ 2009-10-04 19:53       ` Conglun Yao
  2009-10-04 20:06         ` Conglun Yao
                           ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 19:53 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list


[-- Attachment #1.1: Type: text/plain, Size: 756 bytes --]

>
>
> In that case, try listing dynlink explicitly, like:
>
>  ocamlfind ocamlc dynlink.cma -package json-static [etc]
>

$ ocamlfind ocamlc dynlink.cma -package json-static -syntax camlp4o -c
test.ml

$ ocamlfind ocamlc -I /home/conglun/godi/lib/ocaml/pkg-lib/camlp4
dynlink.cma -package json-static -syntax camlp4o -c t.ml


Error: Error while linking
/home/conglun/godi/lib/ocaml/std-lib/camlp4/camlp4lib.cma(Camlp4):
Reference to undefined global `Dynlink'


>
> Anyhow, it sounds like a bug in the META files that are supplied with
> your cygwin OCaml distribution.
>
>
I think you are right, the problem happens on the camlp4o or cygwin, which
can't load dynlink.  But I can't find problem in the camlp4's META  (in the
attachment)

Thanks,

Conglun

[-- Attachment #1.2: Type: text/html, Size: 1332 bytes --]

[-- Attachment #2: META --]
[-- Type: application/octet-stream, Size: 4889 bytes --]

# Specifications for the "camlp4" preprocessor:
requires = ""
version = "[distributed with Ocaml]"
description = "Base for Camlp4 syntax extensions"
directory = "/home/conglun/godi/lib/ocaml/std-lib/camlp4"

# For the toploop:
requires(byte,toploop) = "dynlink"
archive(byte,toploop,camlp4o) = "camlp4o.cma"
archive(byte,toploop,camlp4r) = "camlp4r.cma"

# For the preprocessor itself:
archive(syntax,preprocessor,camlp4o) = "-parser o -parser op -printer p"
archive(syntax,preprocessor,camlp4r) = "-parser r -parser rp -printer p"
preprocessor = "safe_camlp4"

package "lib" (
  requires = "camlp4 dynlink"
  version = "[distributed with Ocaml]"
  description = "Camlp4 library"
  archive(byte) = "camlp4lib.cma"
  archive(byte,toploop) = ""  # already contained in camlp4*.cma
  archive(native) = "camlp4lib.cmxa"
)

package "gramlib" (
  requires = "camlp4.lib"
  version = "[distributed with Ocaml]"
  description = "Compatibilty name for camlp4.lib"
)

package "quotations" (
  version = "[distributed with Ocaml]"
  description = "Syntax extension: Quotations to create AST nodes"
  requires = "camlp4.quotations.r"  # backward compat
  archive(syntax,preprocessor) = "-ignore foo"
  package "o" (
    requires = "camlp4"
    version = "[distributed with Ocaml]"
    description = "Syntax extension: Quotations to create AST nodes (original syntax)"
    archive(syntax,preprocessor) = "-parser Camlp4QuotationCommon -parser Camlp4OCamlOriginalQuotationExpander"
    archive(syntax,toploop) = "Camlp4Parsers/Camlp4QuotationCommon.cmo Camlp4Parsers/Camlp4OCamlOriginalQuotationExpander.cmo"
  )
  package "r" (
    requires = "camlp4"
    version = "[distributed with Ocaml]"
    description = "Syntax extension: Quotations to create AST nodes (revised syntax)"
    archive(syntax,preprocessor) = "-parser Camlp4QuotationCommon -parser Camlp4OCamlRevisedQuotationExpander"
    archive(syntax,toploop) = "Camlp4Parsers/Camlp4QuotationCommon.cmo Camlp4Parsers/Camlp4OCamlRevisedQuotationExpander.cmo"
  )
)

package "extend" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension: EXTEND the camlp4 grammar"
  archive(syntax,preprocessor) = "-parser Camlp4GrammarParser"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4GrammarParser.cmo"
)

package "listcomprehension" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension for list comprehensions"
  archive(syntax,preprocessor) = "-parser Camlp4ListComprehension"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4ListComprehension.cmo"
)

package "macro" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension: Conditional compilation"
  archive(syntax,preprocessor) = "-parser Camlp4MacroParser"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4MacroParser.cmo"
)

package "mapgenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Traverse data structure (map style)"
  archive(syntax,preprocessor) = "-filter Camlp4MapGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4MapGenerator.cmo"
)

package "foldgenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Traverse data structure (fold style)"
  archive(syntax,preprocessor) = "-filter Camlp4FoldGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4FoldGenerator.cmo"
)

package "metagenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Generate AST generator for data structure"
  archive(syntax,preprocessor) = "-filter Camlp4MetaGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4MetaGenerator.cmo"
)

package "locationstripper" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Remove location info from AST"
  archive(syntax,preprocessor) = "-filter Camlp4LocationStripper"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4LocationStripper.cmo"
)

package "tracer" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Trace execution"
  archive(syntax,preprocessor) = "-filter Camlp4Tracer"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4Tracer.cmo"
)

package "exceptiontracer" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Trace exception execution"
  archive(syntax,preprocessor) = "-filter Camlp4ExceptionTracer"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4ExceptionTracer.cmo"
)

package "profiler" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Count events during execution"
  archive(syntax,preprocessor) = "-filter Camlp4Profiler"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4Profiler.cmo"
  archive(byte) = "camlp4prof.cmo"
  archive(native) = "camlp4prof.cmx"
)

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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:53       ` Conglun Yao
@ 2009-10-04 20:06         ` Conglun Yao
  2009-10-04 20:33         ` Richard Jones
  2009-10-05 13:35         ` Gerd Stolpmann
  2 siblings, 0 replies; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 20:06 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list


[-- Attachment #1.1: Type: text/plain, Size: 1038 bytes --]

On Sun, Oct 4, 2009 at 8:53 PM, Conglun Yao <yaoconglun@gmail.com> wrote:

>
>
>>
>> In that case, try listing dynlink explicitly, like:
>>
>>  ocamlfind ocamlc dynlink.cma -package json-static [etc]
>>
>
> $ ocamlfind ocamlc dynlink.cma -package json-static -syntax camlp4o -c
> test.ml
>
> $ ocamlfind ocamlc -I /home/conglun/godi/lib/ocaml/pkg-lib/camlp4
> dynlink.cma -package json-static -syntax camlp4o -c t.ml
>
>
> Error: Error while linking
> /home/conglun/godi/lib/ocaml/std-lib/camlp4/camlp4lib.cma(Camlp4):
> Reference to undefined global `Dynlink'
>
>
>>
>> Anyhow, it sounds like a bug in the META files that are supplied with
>> your cygwin OCaml distribution.
>>
>>
> I think you are right, the problem happens on the camlp4o or cygwin, which
> can't load dynlink.  But I can't find problem in the camlp4's META  (in the
> attachment)
>
> Thanks,
>
> Conglun
>


However, if I do the following test, it works fine.

test.ml

    let x = 1

    let _ = print_int x

ocamlfind ocamlc -package camlp4 -syntax camlp4o -c t.ml

[-- Attachment #1.2: Type: text/html, Size: 2027 bytes --]

[-- Attachment #2: META --]
[-- Type: application/octet-stream, Size: 4889 bytes --]

# Specifications for the "camlp4" preprocessor:
requires = ""
version = "[distributed with Ocaml]"
description = "Base for Camlp4 syntax extensions"
directory = "/home/conglun/godi/lib/ocaml/std-lib/camlp4"

# For the toploop:
requires(byte,toploop) = "dynlink"
archive(byte,toploop,camlp4o) = "camlp4o.cma"
archive(byte,toploop,camlp4r) = "camlp4r.cma"

# For the preprocessor itself:
archive(syntax,preprocessor,camlp4o) = "-parser o -parser op -printer p"
archive(syntax,preprocessor,camlp4r) = "-parser r -parser rp -printer p"
preprocessor = "safe_camlp4"

package "lib" (
  requires = "camlp4 dynlink"
  version = "[distributed with Ocaml]"
  description = "Camlp4 library"
  archive(byte) = "camlp4lib.cma"
  archive(byte,toploop) = ""  # already contained in camlp4*.cma
  archive(native) = "camlp4lib.cmxa"
)

package "gramlib" (
  requires = "camlp4.lib"
  version = "[distributed with Ocaml]"
  description = "Compatibilty name for camlp4.lib"
)

package "quotations" (
  version = "[distributed with Ocaml]"
  description = "Syntax extension: Quotations to create AST nodes"
  requires = "camlp4.quotations.r"  # backward compat
  archive(syntax,preprocessor) = "-ignore foo"
  package "o" (
    requires = "camlp4"
    version = "[distributed with Ocaml]"
    description = "Syntax extension: Quotations to create AST nodes (original syntax)"
    archive(syntax,preprocessor) = "-parser Camlp4QuotationCommon -parser Camlp4OCamlOriginalQuotationExpander"
    archive(syntax,toploop) = "Camlp4Parsers/Camlp4QuotationCommon.cmo Camlp4Parsers/Camlp4OCamlOriginalQuotationExpander.cmo"
  )
  package "r" (
    requires = "camlp4"
    version = "[distributed with Ocaml]"
    description = "Syntax extension: Quotations to create AST nodes (revised syntax)"
    archive(syntax,preprocessor) = "-parser Camlp4QuotationCommon -parser Camlp4OCamlRevisedQuotationExpander"
    archive(syntax,toploop) = "Camlp4Parsers/Camlp4QuotationCommon.cmo Camlp4Parsers/Camlp4OCamlRevisedQuotationExpander.cmo"
  )
)

package "extend" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension: EXTEND the camlp4 grammar"
  archive(syntax,preprocessor) = "-parser Camlp4GrammarParser"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4GrammarParser.cmo"
)

package "listcomprehension" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension for list comprehensions"
  archive(syntax,preprocessor) = "-parser Camlp4ListComprehension"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4ListComprehension.cmo"
)

package "macro" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax extension: Conditional compilation"
  archive(syntax,preprocessor) = "-parser Camlp4MacroParser"
  archive(syntax,toploop) = "Camlp4Parsers/Camlp4MacroParser.cmo"
)

package "mapgenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Traverse data structure (map style)"
  archive(syntax,preprocessor) = "-filter Camlp4MapGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4MapGenerator.cmo"
)

package "foldgenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Traverse data structure (fold style)"
  archive(syntax,preprocessor) = "-filter Camlp4FoldGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4FoldGenerator.cmo"
)

package "metagenerator" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Generate AST generator for data structure"
  archive(syntax,preprocessor) = "-filter Camlp4MetaGenerator"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4MetaGenerator.cmo"
)

package "locationstripper" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Remove location info from AST"
  archive(syntax,preprocessor) = "-filter Camlp4LocationStripper"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4LocationStripper.cmo"
)

package "tracer" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Trace execution"
  archive(syntax,preprocessor) = "-filter Camlp4Tracer"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4Tracer.cmo"
)

package "exceptiontracer" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Trace exception execution"
  archive(syntax,preprocessor) = "-filter Camlp4ExceptionTracer"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4ExceptionTracer.cmo"
)

package "profiler" (
  requires = "camlp4"
  version = "[distributed with Ocaml]"
  description = "Syntax filter: Count events during execution"
  archive(syntax,preprocessor) = "-filter Camlp4Profiler"
  archive(syntax,toploop) = "Camlp4Filters/Camlp4Profiler.cmo"
  archive(byte) = "camlp4prof.cmo"
  archive(native) = "camlp4prof.cmx"
)

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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:53       ` Conglun Yao
  2009-10-04 20:06         ` Conglun Yao
@ 2009-10-04 20:33         ` Richard Jones
  2009-10-04 20:35           ` Richard Jones
  2009-10-05 13:35         ` Gerd Stolpmann
  2 siblings, 1 reply; 17+ messages in thread
From: Richard Jones @ 2009-10-04 20:33 UTC (permalink / raw)
  To: Conglun Yao; +Cc: caml-list

On Sun, Oct 04, 2009 at 08:53:50PM +0100, Conglun Yao wrote:
> $ ocamlfind ocamlc dynlink.cma -package json-static -syntax camlp4o -c
> test.ml
> 
> $ ocamlfind ocamlc -I /home/conglun/godi/lib/ocaml/pkg-lib/camlp4
> dynlink.cma -package json-static -syntax camlp4o -c t.ml
> 
> 
> Error: Error while linking
> /home/conglun/godi/lib/ocaml/std-lib/camlp4/camlp4lib.cma(Camlp4):
> Reference to undefined global `Dynlink'

OK, I remember what this one is now.  camlp4 in 3.11.0 introduced an
extra dependency on Dynlink, and in the other distributions of OCaml
this meant that certain META files (distributed with findlib) had to
change.

This was the patch that we added for Fedora to fix the relevant META
file:

http://cvs.fedoraproject.org/viewvc/devel/ocaml-findlib/ocaml-findlib-1.2.3-camlp4-META.patch?revision=1.1&view=markup

(Although more recent versions of findlib include the necessary
correction).

So you could try the patch above, or try a later version of findlib.

Rich.

-- 
Richard Jones
Red Hat


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 20:33         ` Richard Jones
@ 2009-10-04 20:35           ` Richard Jones
  2009-10-04 21:14             ` David Allsopp
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Jones @ 2009-10-04 20:35 UTC (permalink / raw)
  To: Conglun Yao; +Cc: caml-list

Ah but wait, your META file has that patch incorporated already!

I don't know -- the cygwin distribution of OCaml is broken somehow.

Rich.

-- 
Richard Jones
Red Hat


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

* RE: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 20:35           ` Richard Jones
@ 2009-10-04 21:14             ` David Allsopp
  2009-10-04 21:40               ` Conglun Yao
  0 siblings, 1 reply; 17+ messages in thread
From: David Allsopp @ 2009-10-04 21:14 UTC (permalink / raw)
  To: 'Richard Jones', 'Conglun Yao'; +Cc: caml-list

> Ah but wait, your META file has that patch incorporated already!
> 
> I don't know -- the cygwin distribution of OCaml is broken somehow.

What happens if you run ocaml and then enter #load "dynlink.cma";;     ??


David


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 21:14             ` David Allsopp
@ 2009-10-04 21:40               ` Conglun Yao
  2009-10-05  7:39                 ` David Allsopp
  0 siblings, 1 reply; 17+ messages in thread
From: Conglun Yao @ 2009-10-04 21:40 UTC (permalink / raw)
  To: David Allsopp, Richard Jones, caml-list

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

Thanks for all of your help.


I tried, and it works fine until the require of "json-static". It breaks
when loading "pcre.cma".

Now we can say that pcre package has some problem, but dynlink is loaded
successfully.

Test1

$ ocaml
        Objective Caml version 3.11.1

# #load "dynlink.cma";;
# let x = Dynlink.is_native;;
val x : bool = false

Test 2

$ocaml

#use "topfind";;
 #load "dynlink.cma";;
 #require "json-static";;
/home/conglun/godi/lib/ocaml/std-lib/dynlink.cma: loaded
/home/conglun/godi/lib/ocaml/std-lib/camlp4: added to search path
/home/conglun/godi/lib/ocaml/pkg-lib/pcre: added to search path
/home/conglun/godi/lib/ocaml/pkg-lib/pcre/pcre.cma: loaded
  47721 [main] ocaml 2136 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)
Segmentation fault (core dumped)

Test 3

ocamlfind ocamlmktop -package dynlink -o dtop -custom -linkall

$./dtop

#use "topfind";;
#require "dynlink";;
/home/conglun/godi/lib/ocaml/std-lib/dynlink.cma: loaded
# let x = Dynlink.is_native;;
val x : bool = false


On Sun, Oct 4, 2009 at 10:14 PM, David Allsopp <dra-news@metastack.com>wrote:

> > Ah but wait, your META file has that patch incorporated already!
> >
> > I don't know -- the cygwin distribution of OCaml is broken somehow.
>
> What happens if you run ocaml and then enter #load "dynlink.cma";;     ??
>
>
> David
>
>

[-- Attachment #2: Type: text/html, Size: 1945 bytes --]

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

* RE: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 21:40               ` Conglun Yao
@ 2009-10-05  7:39                 ` David Allsopp
  2009-10-05 10:14                   ` Conglun Yao
  0 siblings, 1 reply; 17+ messages in thread
From: David Allsopp @ 2009-10-05  7:39 UTC (permalink / raw)
  To: caml-list

> I tried, and it works fine until the require of "json-static". It breaks
when loading "pcre.cma". 
>
> Now we can say that pcre package has some problem, but dynlink is loaded
successfully.

Hmm - a few other things to check:

1. Are you definitely using Cygwin's PCRE and which version (run pcre-config
--prefix and pcre-config --version)
2. Which version of ocaml-pcre is findlib trying to load (#use "topfind";;
#list;; from within ocaml)
3. Did you install the (very out-of-date) OCaml package which comes with
Cygwin?
4. Did you install plain GODI or did you pass -w32port mingw to the first
script?

I'm using pcre-ocaml 6.0.1 / PCRE 7.9 with no problems with the MinGW port
of OCaml 3.11.1 (not via GODI, though)


David


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-05  7:39                 ` David Allsopp
@ 2009-10-05 10:14                   ` Conglun Yao
  0 siblings, 0 replies; 17+ messages in thread
From: Conglun Yao @ 2009-10-05 10:14 UTC (permalink / raw)
  To: David Allsopp; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Mon, Oct 5, 2009 at 8:39 AM, David Allsopp <dra-news@metastack.com>wrote:

>
> Hmm - a few other things to check:
>
> 1. Are you definitely using Cygwin's PCRE and which version (run
> pcre-config
> --prefix and pcre-config --version)
>
2. Which version of ocaml-pcre is findlib trying to load (#use "topfind";;
> #list;; from within ocaml)
>

I don't use pcre directly, but packages like json-static depend on it.

pcre-config --prefix /usr/local
pcre-config ---version    7.9

The ocaml-pcre is version 6.0.1.   Does it cause the problem?

Maybe I need to reinstall a 6.0.1 pcre.


> 3. Did you install the (very out-of-date) OCaml package which comes with
> Cygwin?

4. Did you install plain GODI or did you pass -w32port mingw to the first
> script?
>

No, I installed plain godi, which downloads and installs the OCaml 3.11.1


>
> I'm using pcre-ocaml 6.0.1 / PCRE 7.9 with no problems with the MinGW port
> of OCaml 3.11.1 (not via GODI, though)
>
>
> David
>
>

[-- Attachment #2: Type: text/html, Size: 1961 bytes --]

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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-04 19:53       ` Conglun Yao
  2009-10-04 20:06         ` Conglun Yao
  2009-10-04 20:33         ` Richard Jones
@ 2009-10-05 13:35         ` Gerd Stolpmann
  2009-10-05 15:17           ` Conglun Yao
  2009-10-05 17:55           ` Alain Frisch
  2 siblings, 2 replies; 17+ messages in thread
From: Gerd Stolpmann @ 2009-10-05 13:35 UTC (permalink / raw)
  To: Conglun Yao; +Cc: Richard Jones, caml-list


Am Sonntag, den 04.10.2009, 20:53 +0100 schrieb Conglun Yao:
> 
>         
>         
>         
>         In that case, try listing dynlink explicitly, like:
>         
>          ocamlfind ocamlc dynlink.cma -package json-static [etc]
> 
> $ ocamlfind ocamlc dynlink.cma -package json-static -syntax camlp4o -c
> test.ml
> 
> $ ocamlfind ocamlc -I /home/conglun/godi/lib/ocaml/pkg-lib/camlp4
> dynlink.cma -package json-static -syntax camlp4o -c t.ml
> 
> 
> Error: Error while
> linking /home/conglun/godi/lib/ocaml/std-lib/camlp4/camlp4lib.cma(Camlp4):
> Reference to undefined global `Dynlink'
>  
> 
>         
>         Anyhow, it sounds like a bug in the META files that are
>         supplied with
>         your cygwin OCaml distribution.
>         
>         
>         
> 
> I think you are right, the problem happens on the camlp4o or cygwin,
> which can't load dynlink.  But I can't find problem in the camlp4's
> META  (in the attachment)

While cygwin cannot load shared libraries from bytecode, it still can
load pure bytecode dynamically. It is reasonable that there is a
dynlink.cma for this case, and that camlp4lib.cma depends on it.

findlib has a special mode for platforms that cannot load shared
libraries dynamically. This mode seems to be broken  - it calls a script
safe_camlp4 instead of camlp4, and safe_camlp4 produces ad hoc a new
camlp4-type executable that includes the required C libraries - without
that trick you couldn't use json-static at all on these platforms:

https://godirepo.camlcity.org/svn/lib-findlib/trunk/tools/safe_camlp4

The question is now whether the error is in this script (does it have to
add dynlink.cma anyway?) or whether mkcamlp4 is broken.

Can you try to change safe_camlp4 so the line

mkcamlp4 -o $tmp_camlp4 $cp4_mods || exit

reads

mkcamlp4 -o $tmp_camlp4 dynlink.cma $cp4_mods || exit

? (I don't have a cygwin ocaml at hand.) safe_camlp4 should be in the
bin/ directory.

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-05 13:35         ` Gerd Stolpmann
@ 2009-10-05 15:17           ` Conglun Yao
  2009-10-05 17:28             ` David Allsopp
  2009-10-05 17:55           ` Alain Frisch
  1 sibling, 1 reply; 17+ messages in thread
From: Conglun Yao @ 2009-10-05 15:17 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]

Thanks for all of your help.

Unfortunately, it still does not work. It is really nightmare to use camp4
in a windows machine.  I try to reinstall plain OCaml without using GODI, if
the same error happens, I have to go back to Ubuntu.

Thanks.

Conglun

On Mon, Oct 5, 2009 at 2:35 PM, Gerd Stolpmann <gerd@gerd-stolpmann.de>wrote:

>
>
>
> While cygwin cannot load shared libraries from bytecode, it still can
> load pure bytecode dynamically. It is reasonable that there is a
> dynlink.cma for this case, and that camlp4lib.cma depends on it.
>
> findlib has a special mode for platforms that cannot load shared
> libraries dynamically. This mode seems to be broken  - it calls a script
> safe_camlp4 instead of camlp4, and safe_camlp4 produces ad hoc a new
> camlp4-type executable that includes the required C libraries - without
> that trick you couldn't use json-static at all on these platforms:
>
> https://godirepo.camlcity.org/svn/lib-findlib/trunk/tools/safe_camlp4
>
> The question is now whether the error is in this script (does it have to
> add dynlink.cma anyway?) or whether mkcamlp4 is broken.
>
> Can you try to change safe_camlp4 so the line
>
> mkcamlp4 -o $tmp_camlp4 $cp4_mods || exit
>
> reads
>
> mkcamlp4 -o $tmp_camlp4 dynlink.cma $cp4_mods || exit
>
> ? (I don't have a cygwin ocaml at hand.) safe_camlp4 should be in the
> bin/ directory.
>
> Gerd
> --
> ------------------------------------------------------------
> Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany
> gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
> Phone: +49-6151-153855                  Fax: +49-6151-997714
> ------------------------------------------------------------
>
>

[-- Attachment #2: Type: text/html, Size: 2391 bytes --]

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

* RE: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-05 15:17           ` Conglun Yao
@ 2009-10-05 17:28             ` David Allsopp
  0 siblings, 0 replies; 17+ messages in thread
From: David Allsopp @ 2009-10-05 17:28 UTC (permalink / raw)
  To: caml-list

Conglun Yao wrote:
> Thanks for all of your help. 
>
> Unfortunately, it still does not work. It is really nightmare to use camp4
in a windows machine.

In this instance, it's very much Cygwin that's causing the problem, rather
than Windows! I didn't realise that Cygwin's Dynlink only extended to pure
bytecode (it used not to have Dynlink at all).

> I try to reinstall plain OCaml without using GODI, if the same error
happens, I have to go back to Ubuntu.

You could try using the -w32port mingw flag for GODI to build the MinGW
version of OCaml - you can still use it from Cygwin's bash prompt but you
will definitely have a fully functional dynamic loading version.
Alternatively, if you want I can email you the instructions change log I use
for building MinGW & MSVC OCaml on Windows (one day I'll have the time to
put it online <sigh>).

Try GODI/MinGW first - building PCRE is not trivial and AFAIK GODI has full
build-support for ocaml-pcre on Windows.


David



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

* Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?
  2009-10-05 13:35         ` Gerd Stolpmann
  2009-10-05 15:17           ` Conglun Yao
@ 2009-10-05 17:55           ` Alain Frisch
  1 sibling, 0 replies; 17+ messages in thread
From: Alain Frisch @ 2009-10-05 17:55 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: Conglun Yao, caml-list, Richard Jones

Gerd Stolpmann wrote:
> While cygwin cannot load shared libraries from bytecode, it still can
> load pure bytecode dynamically.

Since OCaml 3.11 and the use of flexdll, all the windows ports 
(including the Cygwin port) are supposed to be able to load stub DLLs 
produced by flexlink. This has not been tested thoroughly, so feel free 
to report otherwise if you can isolate a bug related to that.

Alain



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

end of thread, other threads:[~2009-10-05 17:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-04 14:22 Dynlink and ocamlfind for camlp4 3.11? Conglun Yao
2009-10-04 14:24 ` Conglun Yao
2009-10-04 19:05 ` [Caml-list] " Richard Jones
2009-10-04 19:32   ` Conglun Yao
2009-10-04 19:37     ` Richard Jones
2009-10-04 19:53       ` Conglun Yao
2009-10-04 20:06         ` Conglun Yao
2009-10-04 20:33         ` Richard Jones
2009-10-04 20:35           ` Richard Jones
2009-10-04 21:14             ` David Allsopp
2009-10-04 21:40               ` Conglun Yao
2009-10-05  7:39                 ` David Allsopp
2009-10-05 10:14                   ` Conglun Yao
2009-10-05 13:35         ` Gerd Stolpmann
2009-10-05 15:17           ` Conglun Yao
2009-10-05 17:28             ` David Allsopp
2009-10-05 17:55           ` 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).