Using OCamlSDL2 in my manjaro linux box was failed with below message.
(cd _build/default && /usr/bin/ocamlopt.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -o bin/main.exe /home/siabard/.opam/4.13.1/lib/sdl2/sdl2.cmxa -I /home/siabard/.opam/4.13.1/lib/sdl2 /home/siabard/.opam/4.13.1/lib/sdl2_img/sdl2_img.cmxa -I /home/siabard/.opam/4.13.1/lib/sdl2_img lib/sdl2_tutorial.cmxa bin/.main.eobjs/native/dune__exe__Main.cmx)
/usr/bin/ld: /home/siabard/.opam/4.13.1/lib/sdl2/libsdl2_stubs.a(sdljoystick_stub.o): undefined reference to symbol 'SDL_JoystickNumAxes'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib/libSDL2.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
In my linux box's sdl2-config, --static-libs is commented.
# --static-libs)
# --libs|--static-libs)
# echo -L/usr/lib -pthread -lSDL2 -lrt -lunwind-generic -lunwind -lglib-2.0 -lgobject-2.0 -lgio-2.0 -libus-1.0 -ldbus-1 -ldl -lm -Wl,--no-undefined -pthread -lSDL2
# ;;
There are two ways tested and they all worked.
- Uncomment
--static-libs in sdl2-config and install with opam install ocamlsdl2
- Get clone of source and modify
Makefile as LIBS_ = $(shell sdl2-config --libs) and build it (opam install . in cloned source).
I don't know which way is better, but wish that this will help someone who has a same issue like me.
My /etc/lsb-release is
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=21.2.1
DISTRIB_CODENAME=Qonos
DISTRIB_DESCRIPTION="Manjaro Linux"
Thank you.
Using OCamlSDL2 in my manjaro linux box was failed with below message.
In my linux box's
sdl2-config,--static-libsis commented.There are two ways tested and they all worked.
--static-libsinsdl2-configand install withopam install ocamlsdl2MakefileasLIBS_ = $(shell sdl2-config --libs)and build it (opam install .in cloned source).I don't know which way is better, but wish that this will help someone who has a same issue like me.
My
/etc/lsb-releaseisThank you.