## Running Love 11.1 on Raspberry Pi NO X11

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Running Love 11.1 on Raspberry Pi NO X11

Hello, hopefully someone here can help me to get this working.
I've spent the last 3 days trying to get Love2d 11.1 working on an original Raspberry Pi B without X11 using SDL compiles with OpenGL ES.
Here is what I have tried so far:

WORKED:
Installed Raspbian Stretch (full), installed dependencies and compiled Love2D 11.1 from scratch as well as LuaJIT and enabled the experimental OpenGL drivers, works fine, but super slow, from the desktop within the X11 environment. However, I can't have X11 in the final product. I can use this to write and test my graphics program now, on a faster multicore Raspberry pi 3, but eventually this needs to run on a bare minimum Linux, without X11 on the Raspberry Pi, likely to run on a Raspberry pi Zero. This is the reason I'm trying to use the original raspberry pi, as I know the processor on the original is just a slower version of what is used on the Pi Zero.

WHAT DID NOT WORK:
PiLove, as is, with Love2D 10.0 (10.2?). I used the 0.4 image in the downloads section and not only didn't it work as shown on the front page, it gave errors when using raspi-config to change the default password...so I'd like to stay away from this if I can. I was hoping I could install it and compile Love2D 11.1 on a system that "should" have SDL2 working, but I'm wary of using this non verified build now and the 10 version didn't work anyway. It seems whoever made this isn't updating it either as the last build was in 2016.

I tried installing Raspbian stretch lite and then compiling SDL2 and Love2d from scratch using various instructions I've found here and on the Raspberry Pi site. No go. Most often I get some sort of SDL file not present or no video found error.

I tried installing Retropie and compiling Love2d 11.1 on that, doesn't work.

I tried using the precompiled SDL packages from Retropie on a base Raspbian Stretch Lite with compiled Love2D 11.1, doesn't work.

I compiled Simple2D on the Pi and then compiled Love2D 11.1, doesn't work, throws an error about a file not found SDL 2.0.0....something, and for that matter building the simple triangle.c example on the Simple2D site soft locks the pi and displays nothing.

I tried using portions of the PiLove shell script on his git page, to compile both SDL2 and Love2D, no go.

I guess I should have more specific information about "each" failure but at this point I'm must hoping someone has done this and has a concise list of steps to follow to get this working. The main issue is, I don't know what SDL settings/versions are correct and what Love2D configurations are correct to get the two working individually or with each other. We could say that I should read the SDL docs and source code, but using Love2D is at least, in part, motivated by not wanting to do that, and I honestly don't know what to look for and each "error" in a compile takes, potentially hours to find when compiling on the Pi. I realized Raspberry Pi isn't officially supported but any help would be greatly appreciated.

I'd also like to note that none of the instructions for compiling Love2D reference, compiling, or as I now know, installing from dependency, LuaJIT, which I've had to do each time now using the Linux source download for Love2D. I thought Love2D had a built in precompiled LuaJIT version and/or the Raspberry Pi should? I even had to do this on the "full" Raspbian install.
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Running Love 11.1 on Raspberry Pi NO X11

There aren't really instructions because it should mostly just work. It certainly did when I tried it last. The basics are simple: make sure you have the right dependencies, then compile as usual. Note that for the raspberry pi you want to have a version of sdl2 (the more recent the better, but it shouldn't really matter), and make sure it's compiled with raspberry pi support. And the trick for that is making sure it can find the videocore libraries (in /opt/vc, if you have them installed).
Redbeer wrote: Wed Apr 25, 2018 2:07 pm I'd also like to note that none of the instructions for compiling Love2D reference, compiling, or as I now know, installing from dependency, LuaJIT, which I've had to do each time now using the Linux source download for Love2D. I thought Love2D had a built in precompiled LuaJIT version and/or the Raspberry Pi should? I even had to do this on the "full" Raspbian install.
Due to the slightly broken sentence I'm not quite sure what you mean, but yes you will need LuaJIT and no the love source doesn't contain it. On debian you can just install luajit from the repos, I'd hope raspbian has binaries too.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

bartbes wrote: Wed Apr 25, 2018 5:05 pm There aren't really instructions because it should mostly just work. It certainly did when I tried it last. The basics are simple: make sure you have the right dependencies, then compile as usual. Note that for the raspberry pi you want to have a version of sdl2 (the more recent the better, but it shouldn't really matter), and make sure it's compiled with raspberry pi support. And the trick for that is making sure it can find the videocore libraries (in /opt/vc, if you have them installed).

I'd hope raspbian has binaries too.
What I meant was, none of the instructions on this forum or anywhere else reference having to install LuaJIT as a dependency, whereas there is a laundry list of many other dependencies. Because I'm not familiar with what binaries exist in Raspbian, or what Love2D requires, I wasted time compiling LuaJIT from source, multiple times, until I stumbled upon a shell script or some text somewhere on a forum that listed LuaJIT as a dependency and more importantly what file, specifically, to install from the repositories.
sdl2 (the more recent the better, but it shouldn't really matter), and make sure it's compiled with raspberry pi support. And the trick for that is making sure it can find the videocore libraries (in /opt/vc, if you have them installed).
This sounds like the advice I've read everywhere. It's not "compiling" that I have had that many issues with, it's getting it to RUN. I've installed every dependency I could find and I've changed whatever options have been listed by others to change, and none of that has worked. "Make sure it's compiled with videocore libraries", can you elaborate on what that means and how to do it? My suspicion is that my SDL compilation with OpenGLES is the major issue as I had no problem compiling Love2D in the X11 environment. Is there some definitive instructions on how to change the configurations correctly for SDL and get it working without X11, and then how do I get Love2D to recognize what SDL/video rendering to use?

Note: I've been compiling SDL 2.0.5, but I've also tried various methods with 2.0.4, but the error I got most recently using the Simple2D shell script threw the 2.0.0 error when trying to run ./src/love.
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Running Love 11.1 on Raspberry Pi NO X11

Redbeer wrote: Wed Apr 25, 2018 6:45 pm What I meant was, none of the instructions on this forum or anywhere else reference having to install LuaJIT as a dependency
Building LÖVE does.
Redbeer wrote: Wed Apr 25, 2018 6:45 pm My suspicion is that my SDL compilation with OpenGLES is the major issue as I had no problem compiling Love2D in the X11 environment.
Unfortunately the SDL2 configure script is quite keen on automatically detecting what you have available, and thus won't tell you when you don't have something you'd expect. You can check if your libSDL2.so links against one of the videocore libraries with the ldd command, it should list a couple of files in /opt/vc. Alternatively, you can look at the configure output when you're compiling from source, as it will mention what modules it has selected (if I remember correctly it's called 'rpi').
Redbeer wrote: Wed Apr 25, 2018 6:45 pm Is there some definitive instructions on how to change the configurations correctly for SDL and get it working without X11, and then how do I get Love2D to recognize what SDL/video rendering to use?
If you have an SDL2 build that knows about the videocore libraries, love should just work if you launch it from a tty. I presume it can also work when launching from X11, but I've never tried, and it might be more involved.

I also don't know what the effect is of enabling OpenGL emulation in raspi-config, as that didn't exist back when I tried this last, but you might also try turning it off to see if that helps. Lastly, you can also tell love to prefer OpenGL ES over (regular) OpenGL using the LOVE_GRAPHICS_USE_OPENGLES environment variable, any non-empty value that doesn't start with 0 works.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

Thanks for the link, yes I see LuaJIT now, the problem seems to be that viewing that page in Chrome on my machine, the text for those long dependencies pushes off the side of the page when you scrunch the browser to half size or smaller, rather than pushing down to the next line. So I didn't read that when I was looking there, and just ended up using what was shown on the forum with copy/paste. I should have read more carefully but I have the browser half width most of the time with a text editor and a Putty console with SSH open next to it.

I decided to be a bit more focused and just trying to get SDL2 running.
So, I meticulously went through and followed the instructions here:
https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/
Changing the version numbers to correspond to the latest version of SDL2 (2.0.8) as well as SDL_Image 2.0.3 AND using the second set of ../configure options (for Raspberry pi 2, even though I'm on Rpi B) and changing the host to armv61, as opposed to armv71. Not sure if that was the trick, but it seems to have worked.
Everything compiles without error and installs without error, I noticed some specific "raspberry pi" things installed along the way, but then when I ran the code, at first, I got this error:
Unable to create window Could not create GLES window surface

So I went into raspi-config and enabled the full OpenGL driver with KMS, rebooted, and the program ran on the next try. (I had done this before and it hadn't worked).
This is counter to the PiLove image as that had no options for OpenGL drivers, at all, but apparently that covers OpenGLES now too.
I think I have a working SDL2 install, theoretically at least, I don't know about input or sound or anything else yet.
I installed SDL2_Image, but there are many other libraries available for video, fonts, etc.

Before I compile Love2D 11.1, could you or someone else tell me if there are any other SDL separate libraries that I need to compile to get the full functionality of Love2D? List of things here:

https://www.libsdl.org/projects/

Hopefully someone can answer as the Love2D compile takes hours on that single core machine and I don't want to do that and then find out I needed to do something else first.

When I'm done and have all this working I'll write something up and post it so hopefully people don't make the same mistakes I do in the future while trying to piece the puzzle together from many sources and use instructions that are somewhat out of date.

Thanks for the help so far.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

Ok to prepare I've started to install dependencies. I get this error:

Building dependency tree
Package libturbojpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libturbojpeg0

E: Package 'libturbojpeg' has no installation candidate

The build docs give a line to "fix a bug" in Ubuntu (which I'm obviously not using directly although they are all based on Debian), but that line doesn't work anyway and says file not found.
Can I use libturbojpeg0 as suggested or is there somewhere else to get libturbojpeg?
pgimeno
Party member
Posts: 2597
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

Just in case it helps, in Debian, when I ask information about libturbojpeg0 I get this among other headers:

Replaces: libturbojpeg
Conflicts: libjpeg-turbo8, libturbojpeg

This suggest that libturbojpeg0 is a new version, and that some package depends on the old one.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

Yes, doing ./configure libturbojpeg is not mentioned. The Love2D Makefile also does not reference libturbojpeg or libturbojpeg0, which leads me to think this is a dependency for another dependency, which I hope/assume has been updated to use libturbojpeg0. I'm going to make Love2D and see how it goes.
The ./configure found SDL without error, so I assume I have all the SDL things necessary to make use of the Love2D features.

Success or failure is only a few hours away, at least I don't have to interact with it while it runs.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

It works! Thanks for the help, it certainly got me to focus on the right thing (SDL2). I'll put up some instructions detailing the few small things that likely made this work vs. the first time I tried it.
Redbeer
Prole
Posts: 8
Joined: Wed Apr 25, 2018 1:33 pm

### Re: Running Love 11.1 on Raspberry Pi NO X11

Sorry to necro my own thread a bit, but I wanted to conclude this post with the best method I've found, currently, as of the date of this post, on Love2D 11.1, to get up and running on a Raspberry Pi. This should work for any model through 3B+, including original and Zero W, which have an older Broadcom chip with armv61 architecture vs. the newer armv71. These instructions apply to compiling and running from the source and without X11 or any sort of GUI (no Pixel or LXDE). The main difference is, it's much easier to setup Love2D and compile from source with X11 installed, but it will run with the experimental OpenGL drivers and won't function properly from the command line. Running without X11 or a Linux GUI means that SDL has to be compiled with OpenGLES which will NOT use the OpenGL driver(s) that you enable in raspi-config (I made this mistake at one point).

The main issues I ran into were with getting SDL running (currently version 2.0.8 as of this post). After some experimenting, as well as some more tangential internet searches, I determined the following:
1) You must get SDL up and running first, and the instructions here: https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/ I had very mixed results with. Got it working once, then not another time on different hardware. The issue seems to be in the config line: -host=armv7l-raspberry-linux-gnueabihf modding that flag to v61 seemed to work once, but I'm thinking it didn't work as I had to use the fuill OpenGL drivers to get it working, and omitting it entirely as is given in the first set of instructions for ./configure didn't work at all.
2) There is a far better and more comprehensive set of instructions for getting it running: https://choccyhobnob.com/raspberry-pi/s ... pberry-pi/ This link didn't show up for me initially on a Google search, but it seems to have moved up in rankings a bit for me when searching for: raspberry pi sdl2. The main difference seems to be that it uses this: --host=arm-raspberry-linux-gnueabihf generic tag in the config rather than the arm instruction specific one. The current set of instructions on that site works great, and installing other libraries worked great as well. One note, the SDL2_Image install calls for version 2.0.2 but changing the number to 2.0.3 and doing exactly the same procedures still worked and is testable with the c++ test source given on: https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/
4) It doesn't state it on the Love2D wiki, but doing an install using sudo make install seems to work such that I can just type love at the main command prompt, rather than navigating to the folder where Love2D was compiled, to get the "no game" screen.

Summary:
1) Use the instructions here exactly as shown to install SDL2 from command line on Raspbian Stretch Lite (no X11 or gui):
https://choccyhobnob.com/raspberry-pi/s ... pberry-pi/
Change version numbers for whatever SDL or extensions you are trying to install.
2) Compile the sdl2_test.cpp file shown here: https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/ and run it BEFORE trying to get Love2D to compile. If you need to remove line numbers from the code I used this link: http://remove-line-numbers.ruurtjan.com/ Copy the code, paste it onto site, press enter at the end of your code. Once line numbers disappear, copy and paste into whatever editor you need to save the file from, I used nano from the command line via SSH from my PC.
3) Follow the directions exactly on the Love2D wiki, while changing version numbers for whatever Love2D version is the most recent. Link here: http://www.love2d.org/wiki/Building_L%C3%96VE Make sure you copy ALL the dependencies, they push off the edge of the page even on widescreen. Make sure you change libturbojpeg to libturbojpeg0 in the dependencies. Just to make sure the full set of correct dependencies, as of the date of this post, should be

Code: Select all

 sudo apt-get install build-essential autotools-dev automake libtool pkg-config libdevil-dev libfreetype6-dev libluajit-5.1-dev libphysfs-dev libsdl2-dev libopenal-dev libogg-dev libvorbis-dev libflac-dev libflac++-dev libmodplug-dev libmpg123-dev libmng-dev libturbojpeg0 libtheora-dev

4) Finally to install Love2D system wide, make sure you do sudo make install in the very last step, however, I would test that Love is working by navigating to the folder you used to clone love (probably /love), then doing ./src/love to make sure it's running before installing.

That should get you the latest version, at the time of this writing 11.1, running from the command line on a no GUI linux install.
It's worth noting that I tried adding x11 and Pixel AFTER getting BOTH SDL2 and Love2D working, and while SDL2 continued to work, Love2D no longer would and gave an error about not being able to find Mesa, even with the OpenGL drivers enabled, even from the command line without X11 running.
I hope this helps others in the future.

### Who is online

Users browsing this forum: No registered users and 10 guests