OCaml Forge

Detail: [#1062] ocamlbuild and GlGtk

Bugs: Browse | Download .csv | Monitor

[#1062] ocamlbuild and GlGtk

2011-11-23 23:36
Submitted by:
William R (william)
Assigned to:
Nobody (None)
Operating System:
ocamlbuild and GlGtk

Detailed description
When using GlGtk, ocamlbuild do not use automatically lablgtkgl... we need to use "-libs lablgtkgl" in order to compile, which should not be the case.

# more test.ml
open GlGtk
let _ =
GlGtk.area [`DEPTH_SIZE 1; `RGBA; `DOUBLEBUFFER] ~width:5 ~height:5 ()

# camlbuild -use-ocamlfind -pkgs lablgtk2,lablgl test.byte
+ /usr/bin/ocamlfind ocamlc -linkpkg -package lablgl -package lablgtk2 test.cmo -o test.byte
File "_none_", line 1, characters 0-1:
Error: Error while linking test.cmo:
Reference to undefined global `GlGtk'
Command exited with code 2.
Compilation unsuccessful after building 3 targets (2 cached) in 00:00:00.

# ocamlbuild -use-ocamlfind -pkgs lablgtk2,lablgl -libs lablgtkgl test.byte
Finished, 3 targets (2 cached) in 00:00:00.


Date: 2014-09-18 06:12
Sender: Jacques Garrigue

The current META contains lablgtk2.gl
Date: 2012-01-01 14:39
Sender: Adrien Nader

It's highly unlikely that debian or ubuntu have picked up the META change since it's only in git and not in a released tarball.

One possibility for them however is to fetch it from git, without taking anything else. It should be a simple replacement, mostly compatible with debian I think, working and tested for godi (but godi has an option to get the whole code from git anyway), and good for fedora (since fedora has been using the unmodified upstream META).

You can also replace the file yourself, the only issue would be your package manager telling you the file has been changed.

As for requiring to only use "-pkgs lablgtk2,lablGL" and pull "lablgtk2.gl" automatically, I'm quite against it. I think it could be done with some findlib tricks but that sound quite complicated. And most importantly: such things tend to pull in unexpected deps on C libraries. The META file in godi was a bit generous and linked in everything it could, meaning it would link against gtksourceview2, libglade, ... I'd prefer to avoid getting into such situations again.

And about "lablgl" vs. "lablGL", I've been using the name in godi. I don't know which one is the right one but I'd like such symlinks to go away because they tend to needlessly cause a lot of stupid incompatibilities. It's maybe because lablgl doesn't install with ocamlfind and the support had to be done in the distributions themselves, without them trying to agree on a name.
Date: 2011-12-31 16:22
Sender: William R

cool that the META is updated!
my lablgtk2 version is from ubuntu oniric ocelot. I have no idea how to check if debian or ubuntu have indeed updated with your modifications... I tried "apt-get source liblablgtk2-ocaml-dev", but no way to tell how to get from wheezy or sid.

You said you can compile with :

ocamlbuild -use-ocamlfind -pkgs lablgtk2.gl,lablGL test.native

But why not with the following ?

ocamlbuild -use-ocamlfind -pkgs lablgtk2,lablGL test.native

Could it be possible (just asking, maybe it is tricky), to only use lablgtk2 and lablGL, and dependencies such as lablgtk2.gl being automatically found?

For the lablgl/lablGL, in ubuntu there is a symbolic link from /usr/lib/ocaml/lablGL/ to /usr/lib/ocaml/lablgl/, I guess because lablGL is not conventional way to call a package.

Date: 2011-12-30 11:54
Sender: Adrien Nader

What is your lablgtk2 version? And probabl, more importantly, where is the package from?

The META file which has been in lablgtk2 until a few months ago (end of august iirc) was lacking some information. Some distributions have stepped in and provided their own META file. So depending on where and when you got lablgtk2, you probably have different files.

I've made a new file which is now only in git (get it from giteb at http://git.ocamlcore.org and it should be a drop-in replacement).

Your code compiles for me with:
" ocamlbuild -use-ocamlfind -pkgs lablgtk2.gl,lablGL test.native"

(I'm curious as to the case differen between "lablGL" and "lablgl")

Attached Files:


Field Old Value Date By
status_idOpen2014-09-18 06:12garrigue
close_dateNone2014-09-18 06:12garrigue
ResolutionNone2014-09-18 06:12garrigue