caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ctypes with -thread: inconsistent assumptions over implementation Foreign
@ 2013-11-19 22:57 Mike McClurg
  2013-11-20  8:23 ` Jeremy Yallop
  0 siblings, 1 reply; 4+ messages in thread
From: Mike McClurg @ 2013-11-19 22:57 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 3212 bytes --]

Hi list,

I'm running into a strange issue when compiling a ctypes (0.2.1) library
with the -thread option. Here is my test program:

    open Ctypes
    open PosixTypes
    open Foreign

    let time = foreign "time" (ptr time_t @-> returning time_t)

    let _ = ignore (time (from_voidp time_t null))

This is the simplest example I could find from the ctypes tutorial. When I
compile it without -threaded, it works:

$ ocamlfind ocamlopt -verbose -package ctypes,ctypes.foreign -linkpkg -o
test test.ml
Effective set of compiler predicates:
pkg_unix,pkg_bigarray,pkg_ctypes,pkg_ctypes.foreign-base,pkg_ctypes.foreign,autolink,native
+ ocamlopt.opt -verbose -o test -I /Users/mike/.opam/system/lib/ctypes
/usr/local/lib/ocaml/unix.cmxa /usr/local/lib/ocaml/bigarray.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-base.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-unthreaded.cmxa test.ml
+ clang -arch x86_64 -c -o 'test.o'
'/var/folders/56/7m5w0d2s31l99sh6jw_53_900000gn/T/camlasmeaa663.s'
+ clang -arch x86_64 -c -o
'/var/folders/56/7m5w0d2s31l99sh6jw_53_900000gn/T/camlstartup56e173.o'
'/var/folders/56/7m5w0d2s31l99sh6jw_53_900000gn/T/camlstartup78207e.s'
+ cc -Wl,-no_compact_unwind -o 'test'
'-L/Users/mike/.opam/system/lib/ctypes' '-L/usr/local/lib/ocaml'
'/var/folders/56/7m5w0d2s31l99sh6jw_53_900000gn/T/camlstartup56e173.o'
'/usr/local/lib/ocaml/std_exit.o' 'test.o'
'/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-unthreaded.a'
'/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-base.a'
'/Users/mike/.opam/system/lib/ctypes/ctypes.a'
'/usr/local/lib/ocaml/bigarray.a' '/usr/local/lib/ocaml/unix.a'
'/usr/local/lib/ocaml/stdlib.a' '-L/usr/local/Cellar/libffi/3.0.13/lib'
'-lffi' '-lctypes-foreign-base_stubs'
'-L/usr/local/Cellar/libffi/3.0.13/lib' '-lffi' '-lctypes_stubs'
'-lbigarray' '-lunix' '/usr/local/lib/ocaml/libasmrun.a'

But when I use the -thread option:

$ ocamlfind ocamlopt -verbose -package ctypes,ctypes.foreign -linkpkg
-thread -o test test.ml
Effective set of compiler predicates:
pkg_unix,pkg_threads.posix,pkg_threads,pkg_bigarray,pkg_ctypes,pkg_ctypes.foreign-base,pkg_ctypes.foreign,autolink,mt,mt_posix,native
+ ocamlopt.opt -verbose -o test -thread -I
/Users/mike/.opam/system/lib/ctypes /usr/local/lib/ocaml/unix.cmxa
/usr/local/lib/ocaml/threads/threads.cmxa
/usr/local/lib/ocaml/bigarray.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-base.cmxa
/Users/mike/.opam/system/lib/ctypes/ctypes-foreign-threaded.cmxa test.ml
+ clang -arch x86_64 -c -o 'test.o'
'/var/folders/56/7m5w0d2s31l99sh6jw_53_900000gn/T/camlasmd75109.s'
File "test.ml", line 1:
Error: Files test.cmx
       and /Users/mike/.opam/system/lib/ctypes/ctypes-foreign-threaded.cmxa
       make inconsistent assumptions over implementation Foreign

I've deleted all the cmx/cmi/o files and rerun the above command, but I
still get this error. Here I'm using ctypes 0.2.1 from opam on OSX, but
this also fails for me with a ctypes 0.2.1 rpm I built in a CentOS 6.4
environment.

Am I doing something wrong here? Or is something wrong with the way ctypes
is built and packaged?

Mike

[-- Attachment #2: Type: text/html, Size: 3853 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-20 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 22:57 [Caml-list] ctypes with -thread: inconsistent assumptions over implementation Foreign Mike McClurg
2013-11-20  8:23 ` Jeremy Yallop
2013-11-20 15:28   ` Jeremy Yallop
2013-11-20 15:55     ` Mike McClurg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).