Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In manjaro (arch base linux distro) sdl2-config --static-libs returns empty so project cannot be built. #24

Open
siabard opened this issue Jan 21, 2022 · 1 comment

Comments

@siabard
Copy link

siabard commented Jan 21, 2022

Using OCamlSDL2 in my manjaro linux box was failed with below message.

(cd _build/default && /usr/bin/ocamlopt.opt -w @[email protected]@30..39@[email protected]@[email protected] -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.

  1. Uncomment --static-libs in sdl2-config and install with opam install ocamlsdl2
  2. 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.

@fccm
Copy link
Owner

fccm commented May 15, 2022

Hi, yes I was not sure what to put as the default, --libs or --static-libs.
(My motivation with this binding was to make mini-games and post it on itch.io ; this is why I prefer a static version.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants