OCaml Forge
SCM

Detail: [#1059] ocamlbuild do not builds examples

Bugs: Browse | Download .csv | Monitor

[#1059] ocamlbuild do not builds examples

Date:
2011-11-22 23:07
Priority:
3
State:
Closed
Submitted by:
William R (william)
Assigned to:
Nobody (None)
Hardware:
None
Resolution:
Not a bug
Severity:
normal
Version:
None
Component:
None
Operating System:
Linux
Product:
None
 
URL:
Summary:
ocamlbuild do not builds examples

Detailed description
ocamlbuild does not include (anymore ?) "gtkInit.cmo", and there is no obvious way to use it before any other module.

with tree.ml being one of lablgtk2 examples :
# ocamlbuild -pkgs lablgtk2 -tags warn_s tree.byte
Warning: tag "package" does not expect a parameter, but is used with parameter "lablgtk2"
Finished, 3 targets (0 cached) in 00:00:00.
# ./tree.byte
[lots of errors]


Followup

Message
Date: 2014-09-18 06:13
Sender: Jacques Garrigue

The new name is lablgtk2.auto-init
Date: 2011-12-31 16:19
Sender: William R

ok thanks. Maybe that could be worth saying it in the documentation :
ocamlbuild -use-ocamlfind -pkgs lablgtk2.init -tags warn_s tree.byte

lablgtk2.init is indeed useful when gtk code can be loaded from several modules, but you can never put the code "let locale = GtkMain.Main.init ()" in any of them, because there could always be another module using gtk code that could be declared before.

Regards,
William
Date: 2011-12-31 01:11
Sender: Jacques Garrigue

The standard way to try examples it just to type
lablgtk2 example.ml

If you want to build them, you need to link gtkInit.cmo, which is included in the toplevel, but not in lablgtk.cma.
The documentation explains how to do that directly calling ocamlc.
Adrien answered about how to do that with ocamlfind.
Date: 2011-12-30 12:05
Sender: Adrien Nader

Hmmm, I have gtkInit.cmo and I don't think it ever went away.

Your command lacks the "-use-ocamlfind" argument to ocamlbuild.

Generally speaking, <ith my new META file in lablgtk's git, you could link use -pkg lablgtk2.init. However, you don't _need_ GtkInit: its code is as simple as:
let locale = GtkMain.Main.init ()
As long as you call "init" before any other gtk call, you'll be fine.

Of course, if you're using module initialization to run gtk code, it won't work unless you can place this call properly. But then, you shouldn't do it because it would be quite brittle.

Attached Files:

Attachments:
tree.ml

Changes:

Field Old Value Date By
status_idOpen2014-09-18 06:13garrigue
close_dateNone2014-09-18 06:13garrigue
ResolutionNone2014-09-18 06:13garrigue
File Added149: tree.ml2011-11-22 23:07william