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

Cannot compile SDL on Raspberry Pi #135

Open
project-owner opened this issue May 1, 2022 · 1 comment
Open

Cannot compile SDL on Raspberry Pi #135

project-owner opened this issue May 1, 2022 · 1 comment

Comments

@project-owner
Copy link

Hi, I'm trying to compile SDL on Raspberry Pi OS using the script simple2d.sh:

./simple2d.sh install --sdl

it fails with messages:

checking for FT2... yes
checking for SDL... no
checking for sdl2-config... no
checking for SDL - version >= 2.0.8... no
*** The sdl2-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL2_CONFIG environment variable to the
*** full path to sdl2-config.
configure: error: *** SDL version 2.0.8 not found!

==> Compiling

make: *** No targets specified and no makefile found.  Stop.

==> Installing

make: *** No rule to make target 'install'.  Stop.

==> Checking for SDL2... no
==> Checking for SDL2_image... no
==> Checking for SDL2_mixer... no
==> Checking for SDL2_ttf... no
Error: SDL libraries did not install correctly

Is it possible to fix that?
Thanks!

@Dolphindalt
Copy link
Contributor

Dolphindalt commented Aug 14, 2022

I also happen to be trying to compile SDL using the simple2d.sh script on a raspberry pi and have encountered the same error. I have determined that the installation is failing because SDL fails to compile during the installation process due to a compile error.

/tmp/SDL2-2.0.10/src/video/SDL_egl.c: In function 'SDL_EGL_LoadLibrary':
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:26: warning: implicit declaration of function 'access'; did you mean 'Success'? [-Wimplicit-function-declaration]
  268 |     SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
      |                          ^~~~~~
      |                          Success
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:53: error: 'F_OK' undeclared (first use in this function)
  268 |     SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
      |                                                     ^~~~
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:53: note: each undeclared identifier is reported only
once for each function it appears in
make: *** [Makefile:530: build/SDL_egl.lo] Error 1

==> Installing

/bin/bash build-scripts/updaterev.sh
  CC     build/SDL_egl.lo
/tmp/SDL2-2.0.10/src/video/SDL_egl.c: In function 'SDL_EGL_LoadLibrary':
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:26: warning: implicit declaration of function 'access'; did you mean 'Success'? [-Wimplicit-function-declaration]
  268 |     SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
      |                          ^~~~~~
      |                          Success
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:53: error: 'F_OK' undeclared (first use in this function)
  268 |     SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
      |                                                     ^~~~
/tmp/SDL2-2.0.10/src/video/SDL_egl.c:268:53: note: each undeclared identifier is reported only
once for each function it appears in
make: *** [Makefile:530: build/SDL_egl.lo] Error 1

There is a bug tracking thread where others are having a similar issue when trying to compile SDL for the raspberry pi.

This issue on Github claims to have fixed the issue by including unistd.h in SDL_egl.c, because unistd.h includes the definitions of access and F_OK.

Perhaps the simplest way to resolve this is to compile a more recent version of SDL that includes the patches made from both of the previous links. Any SDL release after November of 2021 should suffice.

I used the most recent version 2.0.22 by changing one line in the simple2d.sh script:

sdl_fname="SDL2-2.0.22"
sdl_url="${libsdl_url}/release/${sdl_fname}.tar.gz"

This change compiled SDL successfully without the previous error.

SDL_Mixer also does not compile with the error.

music.c:43:10: fatal error: native_midi/native_midi.h: No such file or directory
   43 | #include "native_midi/native_midi.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:149: build/music.lo] Error 1

I changed to a more recent SDL_Mixer version to solve this one as there was no documentation of others having this issue. The simple2d.sh script pulls all SDL releases from https://www.libsdl.org, but new releases for SDL_Mixer are no longer posted there, so I pulled from the Github repository instead.

If libsdl.org is no longer including the most recent releases, perhaps it is time to use the Github releases for the script.

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