realworldocaml / examples

All the examples in Real World OCaml
The Unlicense
376 stars 81 forks source link

Ncurses FFI example doesn't run on OSX #21

Closed tmcgilchrist closed 10 years ago

tmcgilchrist commented 10 years ago

Compiling the ncurses ffi example on OSX produces the following error. https://github.com/realworldocaml/examples/blob/master/code/ffi/build_hello.sh https://github.com/realworldocaml/examples/blob/master/code/ffi/hello.ml

➜  ncurses  corebuild -pkg ctypes.foreign -lflags -cclib,-lncurses hello.native 
ocamlfind ocamldep -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -modules hello.ml > hello.ml.depends
ocamlfind ocamldep -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -modules ncurses.ml > ncurses.ml.depends
ocamlfind ocamlc -c -w A-4-33-40-41-42-43-34-44 -strict-sequence -g -annot -bin-annot -short-paths -thread -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -o ncurses.cmo ncurses.ml
ocamlfind ocamlc -c -w A-4-33-40-41-42-43-34-44 -strict-sequence -g -annot -bin-annot -short-paths -thread -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -o hello.cmo hello.ml
ocamlfind ocamlopt -c -w A-4-33-40-41-42-43-34-44 -strict-sequence -g -annot -bin-annot -short-paths -thread -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -o ncurses.cmx ncurses.ml
ocamlfind ocamlopt -c -w A-4-33-40-41-42-43-34-44 -strict-sequence -g -annot -bin-annot -short-paths -thread -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core -o hello.cmx hello.ml
ocamlfind ocamlopt -cclib -lncurses -linkpkg -g -thread -syntax camlp4o -package ctypes.foreign -package bin_prot.syntax -package sexplib.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax -package core ncurses.cmx hello.cmx -o hello.native
➜  ncurses  ./hello.native 
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
  Referenced from: /Users/tim/code/ocaml/ncurses/./hello.native
  Reason: image not found
[1]    85681 trace trap  ./hello.native
➜  ncurses  opam show ctypes
             package: ctypes
             version: 0.3.2
        upstream-url: https://github.com/ocamllabs/ocaml-ctypes/archive/0.3.2.tar.gz
       upstream-kind: http
   upstream-checksum: 916828430292067dfade448fd4a390f1
            homepage: https://github.com/ocamllabs/ocaml-ctypes
             license: MIT
                tags: org:ocamllabs, org:mirage
             depends: base-bytes & ocamlfind
   installed-version: ctypes.0.3.2 [system]
  available-versions: 0.1.1, 0.2.3, 0.3, 0.3.1
         description: Combinators for binding to C libraries without writing any C.