Skip to content
← Back to Community
Unable to use SDL2 mixer in repl.it
Profile icon
ryanpcmcquen

I'm trying to make my game engine available in Repl.it, but it seems that even though sdl2-mixer installs successfully, it is not in the right path to be recognized when compiling:

 ([ $(which sdl-config) ] && make && ./basque) || install-pkg libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev clang -Wall -Wextra -std=c99 source/basque.c '-Wl,-rpath,$ORIGIN' `$(which sdl2-config) --cflags --libs` -l SDL2_image -l SDL2_mixer -l SDL2_ttf -o basque In file included from source/basque.c:1: In file included from source/initialization.h:1: In file included from source/mechanics.h:1: In file included from source/map.h:1: source/types.h:3:10: fatal error: 'SDL2/SDL_mixer.h' file not found #include <SDL2/SDL_mixer.h> ^~~~~~~~~~~~~~~~~~ 1 error generated. Makefile:34: recipe for target 'basque' failed make: *** [basque] Error 1 -----> Updating apt caches Ign:1 https://storage.googleapis.com/download.dartlang.org/linux/debian stable InRelease Hit:2 https://storage.googleapis.com/download.dartlang.org/linux/debian stable Release Hit:3 https://deb.nodesource.com/node_10.x bionic InRelease Hit:4 https://download.mono-project.com/repo/ubuntu stable-bionic InRelease Hit:5 http://ppa.launchpad.net/avsm/ppa/ubuntu bionic InRelease Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease Ign:9 https://dl.bintray.com/nxadm/rakudo-pkg-debs bionic InRelease Hit:10 http://archive.ubuntu.com/ubuntu bionic InRelease Hit:11 https://dist.crystal-lang.org/apt crystal InRelease Get:12 https://dl.bintray.com/nxadm/rakudo-pkg-debs bionic Release [1,840 B] Hit:13 http://ppa.launchpad.net/bartbes/love-stable/ubuntu bionic InRelease Hit:14 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:15 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Hit:16 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease Hit:7 https://packagecloud.io/cs50/repo/ubuntu trusty InRelease Hit:17 http://ppa.launchpad.net/kelleyk/emacs/ubuntu bionic InRelease Hit:18 http://ppa.launchpad.net/longsleep/golang-backports/ubuntu bionic InRelease rm: cannot remove '/var/cache/apt/archives/partial/*.deb': Permission denied Fetched 1,840 B in 2s (784 B/s) Reading package lists... -----> Fetching .debs for libsdl2-dev Reading package lists... Building dependency tree... 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 247 not upgraded. Need to get 683 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsdl2-dev amd64 2.0.8+dfsg1-1ubuntu1.18.04.4 [683 kB] Fetched 683 kB in 1s (856 kB/s) Download complete and in download only mode W: --force-yes is deprecated, use one of the options starting with --allow instead. -----> Fetching .debs for libsdl2-image-dev Reading package lists... Building dependency tree... The following NEW packages will be installed: libsdl2-image-dev 0 upgraded, 1 newly installed, 0 to remove and 247 not upgraded. Need to get 68.6 kB of archives. After this operation, 245 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl2-image-dev amd64 2.0.3+dfsg1-1 [68.6 kB] Fetched 68.6 kB in 1s (134 kB/s) Download complete and in download only mode W: --force-yes is deprecated, use one of the options starting with --allow instead. -----> Fetching .debs for libsdl2-mixer-dev Reading package lists... Building dependency tree... The following additional packages will be installed: fluidr3mono-gm-soundfont libsdl2-mixer-2.0-0 The following NEW packages will be installed: fluidr3mono-gm-soundfont libsdl2-mixer-2.0-0 libsdl2-mixer-dev 0 upgraded, 3 newly installed, 0 to remove and 247 not upgraded. Need to get 18.9 MB of archives. After this operation, 24.1 MB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 fluidr3mono-gm-soundfont all 2.315-4 [18.7 MB] Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl2-mixer-2.0-0 amd64 2.0.2+dfsg1-2 [58.4 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl2-mixer-dev amd64 2.0.2+dfsg1-2 [73.6 kB] Fetched 18.9 MB in 2s (10.8 MB/s) Download complete and in download only mode W: --force-yes is deprecated, use one of the options starting with --allow instead. -----> Fetching .debs for libsdl2-ttf-dev Reading package lists... Building dependency tree... The following additional packages will be installed: libsdl2-ttf-2.0-0 The following NEW packages will be installed: libsdl2-ttf-2.0-0 libsdl2-ttf-dev 0 upgraded, 2 newly installed, 0 to remove and 247 not upgraded. Need to get 34.5 kB of archives. After this operation, 143 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl2-ttf-2.0-0 amd64 2.0.14+dfsg1-2 [14.8 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsdl2-ttf-dev amd64 2.0.14+dfsg1-2 [19.7 kB] Fetched 34.5 kB in 1s (65.9 kB/s) Download complete and in download only mode W: --force-yes is deprecated, use one of the options starting with --allow instead. -----> Installing fluidr3mono-gm-soundfont_2.315-4_all.deb -----> Installing libsdl2-dev_2.0.8+dfsg1-1ubuntu1.18.04.4_amd64.deb -----> Installing libsdl2-image-dev_2.0.3+dfsg1-1_amd64.deb -----> Installing libsdl2-mixer-2.0-0_2.0.2+dfsg1-2_amd64.deb -----> Installing libsdl2-mixer-dev_2.0.2+dfsg1-2_amd64.deb -----> Installing libsdl2-ttf-2.0-0_2.0.14+dfsg1-2_amd64.deb -----> Installing libsdl2-ttf-dev_2.0.14+dfsg1-2_amd64.deb -----> Rewrite package-config files 
~/basque$ make clang -Wall -Wextra -std=c99 source/basque.c '-Wl,-rpath,$ORIGIN' `$(which sdl2-config) --cflags --libs` -l SDL2_image -l SDL2_mixer -l SDL2_ttf -o basque In file included from source/basque.c:1: In file included from source/initialization.h:1: In file included from source/mechanics.h:1: In file included from source/map.h:1: source/types.h:3:10: fatal error: 'SDL2/SDL_mixer.h' file not found #include <SDL2/SDL_mixer.h> ^~~~~~~~~~~~~~~~~~ 1 error generated. Makefile:34: recipe for target 'basque' failed make: *** [basque] Error 1 ~/basque$

https://repl.it/@ryanpcmcquen/basque#.replit

Voters
Profile icon
ryanpcmcquen
Comments
hotnewtop
Profile icon
chenoule

@qcm, Hello, I looked at your two codes, and I tried to get inspired to make SDL work on one of my projects, but I just can't make SDL and SDL_image work, it gives me errors in the operation of the different functions. If ever it would be possible, could you create a template with only SDL for C?
Because I saw your example on C++ with opengl, but it is not the language in which we must make our project.

PS: Sorry about my english level.
And I'm a beginner in coding so I don't understand all the subtleties of what you've done in your codes, that's why I came here to ask for a little more information.

Profile icon
ryanpcmcquen
Profile icon
chenoule

@ryanpcmcquen Thank you for your quick response,
I am aware that your project is in C, I also look at some of your code to see how it all works. But it's still a bit complex for me to understand all the code you put in your project.
What I want to do is to import the SDL librairy in my C project, and to be able to use it in my main.c, I'm really a beginner in this field, so I don't know how bash and other commands work.
So all I would want is a project templet that has SDL integration and where I can just explode it into a main.c file

Profile icon
ryanpcmcquen
Profile icon
chenoule

@ryanpcmcquen Thx u <3
I will try this tomorrow, good evening to you !

Profile icon
chenoule

@ryanpcmcquen Hello, I tested the template you gave me, I did some testing on it, but nothing conclusive. I don't know much about bash or makefile, I'm really just a student who wants to use SDL to make a little board game, so I don't know much about other kind of language outside C. Is it possible to download SDL and SDL in folder and put it directly in a project to make it work with just include "folder/SDL.h" for example?
Then if you want I link you the template you gave me, because replit asks me that to launch the project it is necessary to setup the .replit but I do not know how it works either, so if ever a change can make the template work, I put you here the links of the template that I fork from github :
https://replit.com/@chenoule/SDL2template#.replit

Profile icon
chenoule

@ryanpcmcquen Also one thing, I don't know why but your projet didn't work anymore. Something some wrong with SDL_mixer directory replit can't find it.

Profile icon
ryanpcmcquen

@chenoule
What OS are you on? Basque has instructions for installing SDL2.

Profile icon
ryanpcmcquen

@chenoule
That's a repl.it issue, I would try it locally or on GitPod.

Profile icon
chenoule

@ryanpcmcquen Precisely, I code on replit that why I'm in trouble. If it was on VS or something else it would be much easier. That why i try to ask you for help :s

Profile icon
ryanpcmcquen

@chenoule
repl.it has a bug with mixer, is there a reason you cannot use something else? GitPod runs in the browser.

Profile icon
chenoule

@ryanpcmcquen The main reason is because my team mate is also on that IDE, but if i can make it work on something else IDE that can runs in the browser, i didn't say no to that.

Profile icon
chenoule

@ryanpcmcquen I'll try to get used to the IDE, and I'll see with the template you gave me and make it work thx for your help

Profile icon
ryanpcmcquen

@chenoule I got this working again here with audio and Nix, just in case you are curious, you can look at the Basque project:
https://github.com/ryanpcmcquen/basque

Profile icon
qcm

were you able to get this working? If not, i have a working LibSDL2 demo here -> https://replit.com/@qcm/repl-libsdl2-template , there is a script to check if libaries are installed , can use this as a reeference. I do not have the compile args for linking libraries correct however - work to do here

Profile icon
ryanpcmcquen

@qcm, yes, I got inspired by your example and just got it working:
https://replit.com/github/ryanpcmcquen/basque

Profile icon
ryanpcmcquen