binding - exception Dl.DL_error : undefined symbol: SDL_GetError -
so, wanted use tsdl
, here's did :
- i couldn't find
sdl 2.0.5
apt-get
downloaded it,./configure && make && sudo make install
opam install tsdl
then created file
main.ml
(given example on tsdl website) :open tsdl open result let main () = match sdl.init sdl.init.video | error (`msg e) -> sdl.log "init error: %s" e; exit 1 | ok () -> match sdl.create_window ~w:640 ~h:480 "sdl opengl" sdl.window.opengl | error (`msg e) -> sdl.log "create window error: %s" e; exit 1 | ok w -> sdl.delay 3000l; sdl.destroy_window w; sdl.quit (); exit 0 let () = main ()
ocamlfind ocamlopt -package tsdl -linkpkg -o main.native main.ml
it works , comes problem :
./main.native fatal error: exception dl.dl_error("./main.native: undefined symbol: sdl_geterror")
did wrong or need tell explicitly sdl2 lib or else ?
update :
> ocamlobjinfo $(opam config var tsdl:lib)/tsdl.cmxa | grep c object files: -l/usr/local/lib -wl,-rpath,/usr/local/lib -wl,--enable-new-dtags -lsdl2 -ltsdl c options: > sdl2-config --libs -l/usr/local/lib -wl,-rpath,/usr/local/lib -wl,--enable-new-dtags -lsdl2
update 2 :
> ldd ./main.native linux-vdso.so.1 => (0x00007fff1f4c1000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f4aff55e000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4aff255000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4aff050000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4afec87000) /lib64/ld-linux-x86-64.so.2 (0x000055dc05e17000)
update 3
lhooq@lhooq ~/tsdl $ ocamlfind ocamlopt -cclib -lsdl2 -package tsdl -linkpkg -o min.native min.ml -verbose effective set of compiler predicates: pkg_result,pkg_unix,pkg_bigarray,pkg_str,pkg_bytes,pkg_ctypes,pkg_ctypes.foreign.base,pkg_ctypes.foreign.unthreaded,pkg_ctypes.foreign,pkg_tsdl,autolink,native + ocamlopt.opt -o min.native -verbose -i /home/lhooq/.opam/4.04.0/lib/result -i /home/lhooq/.opam/4.04.0/lib/bytes -i /home/lhooq/.opam/4.04.0/lib/ctypes -i /home/lhooq/.opam/4.04.0/lib/tsdl /home/lhooq/.opam/4.04.0/lib/result/result.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/unix.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/bigarray.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/str.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-base.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-unthreaded.cmxa /home/lhooq/.opam/4.04.0/lib/tsdl/tsdl.cmxa -cclib -lsdl2 min.ml + -o 'min.o' '/tmp/camlasm9ab424.s' + -o '/tmp/camlstartupe796c9.o' '/tmp/camlstartup4a1081.s' + gcc -o 'min.native' '-l/home/lhooq/.opam/4.04.0/lib/result' '-l/home/lhooq/.opam/4.04.0/lib/bytes' '-l/home/lhooq/.opam/4.04.0/lib/ctypes' '-l/home/lhooq/.opam/4.04.0/lib/tsdl' '-l/home/lhooq/.opam/4.04.0/lib/ocaml' '/tmp/camlstartupe796c9.o' '/home/lhooq/.opam/4.04.0/lib/ocaml/std_exit.o' 'min.o' '/home/lhooq/.opam/4.04.0/lib/tsdl/tsdl.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-unthreaded.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-base.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/str.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/bigarray.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/unix.a' '/home/lhooq/.opam/4.04.0/lib/result/result.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/stdlib.a' '-l/usr/local/lib' '-wl,-rpath,/usr/local/lib' '-wl,--enable-new-dtags' '-lsdl2' '-ltsdl' '-wl,--no-as-needed' '-lffi' '-lctypes-foreign-base_stubs' '-wl,--no-as-needed' '-lffi' '-lctypes_stubs' '-wl,--no-as-needed' '-lcamlstr' '-lbigarray' '-lunix' '-lsdl2' '/home/lhooq/.opam/4.04.0/lib/ocaml/libasmrun.a' -lm -ldl lhooq@lhooq ~/tsdl $ ocamlfind ocamlopt -package tsdl -linkpkg -o min.native min.ml -verbose effective set of compiler predicates: pkg_result,pkg_unix,pkg_bigarray,pkg_str,pkg_bytes,pkg_ctypes,pkg_ctypes.foreign.base,pkg_ctypes.foreign.unthreaded,pkg_ctypes.foreign,pkg_tsdl,autolink,native + ocamlopt.opt -o min.native -verbose -i /home/lhooq/.opam/4.04.0/lib/result -i /home/lhooq/.opam/4.04.0/lib/bytes -i /home/lhooq/.opam/4.04.0/lib/ctypes -i /home/lhooq/.opam/4.04.0/lib/tsdl /home/lhooq/.opam/4.04.0/lib/result/result.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/unix.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/bigarray.cmxa /home/lhooq/.opam/4.04.0/lib/ocaml/str.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-base.cmxa /home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-unthreaded.cmxa /home/lhooq/.opam/4.04.0/lib/tsdl/tsdl.cmxa min.ml + -o 'min.o' '/tmp/camlasm201bd8.s' + -o '/tmp/camlstartup7113e2.o' '/tmp/camlstartup4724f2.s' + gcc -o 'min.native' '-l/home/lhooq/.opam/4.04.0/lib/result' '-l/home/lhooq/.opam/4.04.0/lib/bytes' '-l/home/lhooq/.opam/4.04.0/lib/ctypes' '-l/home/lhooq/.opam/4.04.0/lib/tsdl' '-l/home/lhooq/.opam/4.04.0/lib/ocaml' '/tmp/camlstartup7113e2.o' '/home/lhooq/.opam/4.04.0/lib/ocaml/std_exit.o' 'min.o' '/home/lhooq/.opam/4.04.0/lib/tsdl/tsdl.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-unthreaded.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes-foreign-base.a' '/home/lhooq/.opam/4.04.0/lib/ctypes/ctypes.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/str.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/bigarray.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/unix.a' '/home/lhooq/.opam/4.04.0/lib/result/result.a' '/home/lhooq/.opam/4.04.0/lib/ocaml/stdlib.a' '-l/usr/local/lib' '-wl,-rpath,/usr/local/lib' '-wl,--enable-new-dtags' '-lsdl2' '-ltsdl' '-wl,--no-as-needed' '-lffi' '-lctypes-foreign-base_stubs' '-wl,--no-as-needed' '-lffi' '-lctypes_stubs' '-wl,--no-as-needed' '-lcamlstr' '-lbigarray' '-lunix' '/home/lhooq/.opam/4.04.0/lib/ocaml/libasmrun.a' -lm -ldl
this appears minor issue in tsdl, see more information: https://github.com/dbuenzli/tsdl/issues/38
it fixed in master. author suggests can (for now) temporary fix:
opam pin add tsdl --dev
edit: indicated @dbuenzli below fixed in 0.9.4 on way opam.
Comments
Post a Comment