exception Dl.DL_error:undefined symbol:SDL_GetError

时间:2017-04-14 12:59:41

标签: binding ocaml sdl-2

所以,我想使用select t.*, sum(case when time_btw > 5 then 1 else 0 end) over (partition by customer_key order by ??) as grp from t; ,这就是我所做的:

  • 我找不到Tsdl SDL 2.0.5所以我下载了apt-get
  • ./configure && make && sudo make install

  • 然后我创建了一个文件opam install tsdl(以tsdl website为例):

    main.ml
  • open Tsdl open Result let main () = match Sdl.init Sdl.Init.video with | 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 with | 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

我做错了什么或者我是否需要明确说明我的SDL2 lib或其他什么?

更新:

./main.native
Fatal error: exception Dl.DL_error("./main.native: undefined symbol: SDL_GetError")

更新2:

> ocamlobjinfo $(opam config var tsdl:lib)/tsdl.cmxa | grep Extra
Extra C object files: -L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2 -ltsdl
Extra C options:

> sdl2-config --libs
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2

更新3

> 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)

1 个答案:

答案 0 :(得分:1)

这似乎是tsdl中的一个小问题,有关详情,请参阅此处:https://github.com/dbuenzli/tsdl/issues/38

它在master中修复。正如作者所建议你可以(现在)将其作为临时修复:

opam pin add tsdl --dev

编辑:如下面的@dbuenzli所示,这是固定在0.9.4,它正在进入opam。