1

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))
  ))
glennsl
  • 28,186
  • 12
  • 57
  • 75

2 Answers2

1

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.

Martin DeMello
  • 11,876
  • 7
  • 49
  • 64
-2

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))
  ))
Pierre G.
  • 4,346
  • 1
  • 12
  • 25