Unable to build a program using lablgtk2 with jbuilder

229 views Asked by At

I would like to use jbuilder when compiling with lablgtk2 but I am having problems getting these error messages:

File "_none_", line 1:
Error: No implementations provided for the following modules:
         Thread referenced from /Users/hadilsabbagh/.opam/4.05.0/lib/lablgtk2/gtkThread.cmx
         Mutex referenced from /Users/hadilsabbagh/.opam/4.05.0/lib/lablgtk2/gtkThread.cmx
         Condition referenced from /Users/hadilsabbagh/.opam/4.05.0/lib/lablgtk2/gtkThread.cmx

Here is my jbuild:

(jbuild_version 1)

(executable
  ((name simple)
  (libraries (lablgtk2))
  ))
2

There are 2 answers

0
Pierre G. On BEST ANSWER

Most likely, your jbuild is missing a dependency on core (due to gtkThread.cmx) , it should work with the follwing jbuild file :

(jbuild_version 1)

(executable
  ((name simple)
  (libraries (core lablgtk2))
  ))
0
Martin DeMello On

This is due to this issue. jbuilder/dune adds the mt predicate automatically, which means that if your library supplies a threaded option it will be used, and you need to add threads as a dependency:

(jbuild_version 1)

(executable
  ((name simple)
  (libraries (threads lablgtk2))
  ))

Note that the order of libraries is significant in ocaml, threads needs to come before lablgtk2.