Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006127OCamlOCamlbuild (the tool)public2013-08-07 21:342013-08-08 01:26
Reporterdbuenzli 
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionduplicate 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006127: -use-ocamlfind and -tag thread doesn't work.
DescriptionIt seems that when -use-ocamlfind is used the thread tag no longer works.

> ocamlbuild -classic-display -tag thread -use-ocamlfind tsdl.cma
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -a -cclib -L/usr/local/lib -cclib -lSDL2 -package ctypes -package ctypes.foreign src/tsdl_consts.cmo src/tsdl.cmo -o src/tsdl.cma
+ /Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -a -cclib -L/usr/local/lib -cclib -lSDL2 -package ctypes -package ctypes.foreign src/tsdl_consts.cmo src/tsdl.cmo -o src/tsdl.cma
ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
Command exited with code 2.

Without -use-ocamlfind (fails because packages are used):

> ocamlbuild -classic-display -tag thread tsdl.cma
Warning: tag "package" does not expect a parameter, but is used with parameter "ctypes"
Warning: tag "package" does not expect a parameter, but is used with parameter "ctypes.foreign"
/Users/dbuenzli/.opam/4.00.1/bin/ocamldep.opt -modules support/consts.ml > support/consts.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -c -annot -thread -I support -I test -I src -o support/consts.cmo support/consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -ccopt -DHAS_SDL2 -ccopt -D_THREAD_SAFE -ccopt -I/usr/local/include/SDL2 -ccopt -I/usr/X11R6/include -c support/consts_stub.c
mv consts_stub.o support/consts_stub.o
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -custom threads.cma -thread support/consts.cmo support/consts_stub.o -o support/consts.byte
support/consts.byte src/tsdl_consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamldep.opt -modules src/tsdl_consts.ml > src/tsdl_consts.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamldep.opt -modules src/tsdl.mli > src/tsdl.mli.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -c -annot -thread -I src -I test -I support -o src/tsdl.cmi src/tsdl.mli
/Users/dbuenzli/.opam/4.00.1/bin/ocamldep.opt -modules src/tsdl.ml > src/tsdl.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -c -annot -thread -I src -I test -I support -o src/tsdl_consts.cmo src/tsdl_consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -c -annot -thread -I src -I test -I support -o src/tsdl.cmo src/tsdl.ml
+ /Users/dbuenzli/.opam/4.00.1/bin/ocamlc.opt -c -annot -thread -I src -I test -I support -o src/tsdl.cmo src/tsdl.ml
File "src/tsdl.ml", line 9, characters 0-11:
Error: Unbound module Ctypes
Command exited with code 2.


TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0006058resolvedgasche 'ocamlbuild -use-ocamlfind -tag thread -package threads t.cma' fails 

-  Notes
(0010147)
dbuenzli (reporter)
2013-08-07 21:39

Actually they are build correctly with the -thread. The problem seems more to be on ocamlfind (or a wrong invocation of ocamlfind):

> ocamlbuild -classic-display -tag thread -use-ocamlfind tsdl.cma
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlopt -I /Users/dbuenzli/.opam/4.00.1/lib/ocaml/ocamlbuild unix.cmxa /Users/dbuenzli/.opam/4.00.1/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /Users/dbuenzli/.opam/4.00.1/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamldep -modules support/consts.ml > support/consts.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -c -annot -thread -I support -I test -I src -o support/consts.cmo support/consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -ccopt -DHAS_SDL2 -ccopt -D_THREAD_SAFE -ccopt -I/usr/local/include/SDL2 -ccopt -I/usr/X11R6/include -c support/consts_stub.c
mv consts_stub.o support/consts_stub.o
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -linkpkg -custom -thread support/consts.cmo support/consts_stub.o -o support/consts.byte
support/consts.byte src/tsdl_consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamldep -modules src/tsdl_consts.ml > src/tsdl_consts.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamldep -package ctypes -modules src/tsdl.mli > src/tsdl.mli.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -c -annot -thread -package ctypes -I src -I test -I support -o src/tsdl.cmi src/tsdl.mli
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamldep -package ctypes -modules src/tsdl.ml > src/tsdl.ml.depends
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -c -annot -thread -I src -I test -I support -o src/tsdl_consts.cmo src/tsdl_consts.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -c -annot -thread -package ctypes -I src -I test -I support -o src/tsdl.cmo src/tsdl.ml
/Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -a -cclib -L/usr/local/lib -cclib -lSDL2 -package ctypes -package ctypes.foreign src/tsdl_consts.cmo src/tsdl.cmo -o src/tsdl.cma
+ /Users/dbuenzli/.opam/4.00.1/bin/ocamlfind ocamlc -a -cclib -L/usr/local/lib -cclib -lSDL2 -package ctypes -package ctypes.foreign src/tsdl_consts.cmo src/tsdl.cmo -o src/tsdl.cma
ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
Command exited with code 2.
(0010149)
gasche (developer)
2013-08-08 01:26

This should be fixed since PR#6058. Thanks for the feedback anyway!

PS: the problem indeed comes from the fact that ocamlfind's "error" mechanism is not flexible enough to express the difference between linking into a final program (where -thread is needed) and linking into an archive (when -thread is not needed), while OCamlbuild did this fine-grained distinction. The solution is to dumb down OCamlbuild and pass -thread each time.

In the other bugtracker item, william proposed a workaround that may interest you before the release: -lflags -thread.

- Issue History
Date Modified Username Field Change
2013-08-07 21:34 dbuenzli New Issue
2013-08-07 21:39 dbuenzli Note Added: 0010147
2013-08-08 01:24 gasche Relationship added duplicate of 0006058
2013-08-08 01:26 gasche Note Added: 0010149
2013-08-08 01:26 gasche Status new => resolved
2013-08-08 01:26 gasche Resolution open => duplicate
2013-08-08 01:26 gasche Assigned To => gasche


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker