tsdl icon indicating copy to clipboard operation
tsdl copied to clipboard

Using tsdl in toplevel on Windows

Open jonahbeckford opened this issue 1 year ago • 3 comments

(I'll submit a PR)

Using dune utop in an opam switch that has tsdl on Windows results in:

Fatal error: exception Dl.DL_error("dlsym: no such symbol: \"SDL_GetError\"")

That is because <opamswitch>\lib\tsdl\tsdl.cma has:

Extra C object files:
Extra C options: -L<opamswitch>/bin/../lib
Extra dynamically-loaded libraries: -ltsdl

It should be something like:

Extra C object files: SDL2.lib
Extra C options: -L<opamswitch>/bin/../lib
Extra dynamically-loaded libraries: dlltsdl.dll

jonahbeckford avatar Feb 16 '24 04:02 jonahbeckford

More context:

msys64\usr\bin\bash -lc 'PATH="$PWD/.ci/sd4/opamrun:$PATH"; opamrun exec -- pkg-config --libs sdl2'
Running: opam exec -- pkg-config --libs sdl2
-LY:/source/dksdk-coder/.ci/o/dkml/bin/../lib SDL2.lib

but myocamlbuild.ml only queries for:

  • libs-only-l
  • libs-only-L

which misses SDL2.lib

jonahbeckford avatar Feb 16 '24 04:02 jonahbeckford

Since 116ab1febf489 tsdl has now a proper stubs library on every platform, on macOS this looks like that:

> ocamlobjinfo tsdl.cma | grep 'Extra'
Extra C object files: -lSDL2
Extra C options: -L/opt/homebrew/lib
Extra dynamically-loaded libraries: -ltsdl_stubs

in ec9ddc9a15772c108ca980 I adapted the myocambuild.ml with what I think is needed from #98.

Could you perhaps test this ?

dbuenzli avatar Sep 11 '24 13:09 dbuenzli

Could you perhaps test this ?

Give me some time to get re-acquainted and a few other things, but yes I'll test this.

jonahbeckford avatar Sep 12 '24 05:09 jonahbeckford