Running Love on Linux in 2022

General discussion about LÖVE, Lua, game development, puns, and unicorns.
PushyGeoDuck
Prole
Posts: 1
Joined: Mon Jun 06, 2022 7:05 pm

Running Love on Linux in 2022

Post by PushyGeoDuck »

This may be something already covered, but not only am I new here on the forum, but also new to Love...yes, a total Noob...

When I found Love2D, I said, "I must have this on my development box", which is a Linux machine (Mint 20.3 Una-cinnamon). I wanted to use VS Code as my IDE as well. As I started the installs, everything went great. In my terminal I ran:

sudo add-apt-repository ppa:bartbes/love-stable then sudo apt update, and finally sudo apt install love

When complete, I created a folder on my desktop and added my main.lua file. Opened VS Code, installed all the Love2D extensions and opened my new folder with the lua file. I went to run my new love file to be met with errors stating that no executable could be found. I tried updating the path in VS Code and ran many different commands, all with the same result.

I went digging through the internet trying to find something that stated how to run Love files on Linux. I got nothing...Sadly, there is little information (that I could find) out there on how to do this. I even saw on a forum, stacktrace I think, where someone just gave up and went to Windows to run Love. After some time with hope fading, I wound up falling on a YouTube video where someone was developing a game on Linux with Sublime, and I happened to catch how they executed the file. A full day of searching and here is the result:

Open a terminal
cd into the folder where your love/lua files are
type: love .
--yes there is a space between e and .
press enter

I cant say for certain on other distros, but this is how it operates on Linux Mint. Sadly, you cannot use the ctrl+l feature like in Windows in VS Code, but I've simply opened the terminal in VS Code, and when I'm ready to check my game, I just run the love . command there, which opens just fine.

For anyone that struggled with running Love2D on Linux, I hope this finds you well.

Regards,
-PGDuck
User avatar
Hugues Ross
Citizen
Posts: 85
Joined: Fri Oct 22, 2021 9:18 pm
Location: Quebec
Contact:

Re: Running Love on Linux in 2022

Post by Hugues Ross »

Hi! Fellow linux user here, I use the command-line because it fits my workflow but... have you tried just dragging the game's folder onto the Love2D shortcut? I just double-checked locally, and it should work just fine on Linux ;)
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Running Love on Linux in 2022

Post by BrotSagtMist »

The problem here is not how to run it on linux but how to run it on E/KDE/Gnome/xfce/lxde/awesome/ratpoison and so on and so on.
I bet i am the only Löve user here that uses the moksha desktop for example.
Löve works as so far to recognize .love files on double click but to execute .zip or even folders you have to do a lenghty fight with config files that are mostly different on every desktop and filemanager so there is little help out there in the internet.
Welcome to freedom and diversity.
Back then before i had this set up i used to type love and tab complete to the file path, same thing, different buttons.
So yes the struggle is real, it IS akward.
obey
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Running Love on Linux in 2022

Post by pgimeno »

It not only is the same for other distros, it's also the same for MacOS (with some prior setup, see below), Windows and FreeBSD. Maybe even Android if you're able to run it from the command line.

Here's a wiki page that specifies how to run it: Getting_Started
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Running Love on Linux in 2022

Post by GVovkiv »

PushyGeoDuck wrote: Mon Jun 06, 2022 7:41 pm This may be something already covered, but not only am I new here on the forum, but also new to Love...yes, a total Noob...

When I found Love2D, I said, "I must have this on my development box", which is a Linux machine (Mint 20.3 Una-cinnamon). I wanted to use VS Code as my IDE as well. As I started the installs, everything went great. In my terminal I ran:

sudo add-apt-repository ppa:bartbes/love-stable then sudo apt update, and finally sudo apt install love

When complete, I created a folder on my desktop and added my main.lua file. Opened VS Code, installed all the Love2D extensions and opened my new folder with the lua file. I went to run my new love file to be met with errors stating that no executable could be found. I tried updating the path in VS Code and ran many different commands, all with the same result.

I went digging through the internet trying to find something that stated how to run Love files on Linux. I got nothing...Sadly, there is little information (that I could find) out there on how to do this. I even saw on a forum, stacktrace I think, where someone just gave up and went to Windows to run Love. After some time with hope fading, I wound up falling on a YouTube video where someone was developing a game on Linux with Sublime, and I happened to catch how they executed the file. A full day of searching and here is the result:

Open a terminal
cd into the folder where your love/lua files are
type: love .
--yes there is a space between e and .
press enter

I cant say for certain on other distros, but this is how it operates on Linux Mint. Sadly, you cannot use the ctrl+l feature like in Windows in VS Code, but I've simply opened the terminal in VS Code, and when I'm ready to check my game, I just run the love . command there, which opens just fine.

For anyone that struggled with running Love2D on Linux, I hope this finds you well.

Regards,
-PGDuck
Well, you can try in VS Code:
ext install sumneko.lua -- it's dependencies for next extension, with lua syntax check, etc
ext install lwz7512.love2d-made-easy -- love documentation, syntax and most important is love launcher (https://marketplace.visualstudio.com/it ... -made-easy)
Then open shortcuts, find there "loveme.love2d" and change it to your preference

But, for some reasons, this extension can't print anything into output, so no

Code: Select all

print("banana")
for you...
User avatar
H0lyT0ast
Prole
Posts: 7
Joined: Sun Feb 03, 2019 5:44 pm

Re: Running Love on Linux in 2022

Post by H0lyT0ast »

GVovkiv wrote: Tue Jun 07, 2022 8:09 am
PushyGeoDuck wrote: Mon Jun 06, 2022 7:41 pm This may be something already covered, but not only am I new here on the forum, but also new to Love...yes, a total Noob...

When I found Love2D, I said, "I must have this on my development box", which is a Linux machine (Mint 20.3 Una-cinnamon). I wanted to use VS Code as my IDE as well. As I started the installs, everything went great. In my terminal I ran:

sudo add-apt-repository ppa:bartbes/love-stable then sudo apt update, and finally sudo apt install love

When complete, I created a folder on my desktop and added my main.lua file. Opened VS Code, installed all the Love2D extensions and opened my new folder with the lua file. I went to run my new love file to be met with errors stating that no executable could be found. I tried updating the path in VS Code and ran many different commands, all with the same result.

I went digging through the internet trying to find something that stated how to run Love files on Linux. I got nothing...Sadly, there is little information (that I could find) out there on how to do this. I even saw on a forum, stacktrace I think, where someone just gave up and went to Windows to run Love. After some time with hope fading, I wound up falling on a YouTube video where someone was developing a game on Linux with Sublime, and I happened to catch how they executed the file. A full day of searching and here is the result:

Open a terminal
cd into the folder where your love/lua files are
type: love .
--yes there is a space between e and .
press enter

I cant say for certain on other distros, but this is how it operates on Linux Mint. Sadly, you cannot use the ctrl+l feature like in Windows in VS Code, but I've simply opened the terminal in VS Code, and when I'm ready to check my game, I just run the love . command there, which opens just fine.

For anyone that struggled with running Love2D on Linux, I hope this finds you well.

Regards,
-PGDuck
Well, you can try in VS Code:
ext install sumneko.lua -- it's dependencies for next extension, with lua syntax check, etc
ext install lwz7512.love2d-made-easy -- love documentation, syntax and most important is love launcher (https://marketplace.visualstudio.com/it ... -made-easy)
Then open shortcuts, find there "loveme.love2d" and change it to your preference

But, for some reasons, this extension can't print anything into output, so no

Code: Select all

print("banana")
for you...
I'm going to put in my 2cents as a love2d fedora Linux developer. I prefer vscode over atom currently due to the autocomplete being really nice, I'm sure some other extension in Atom exists that would fill in, but vscode is nice out of the box. I include atom incase someone wants only free/libre software to make RMS happy.

under vscode I use the following package:
https://marketplace.visualstudio.com/it ... yte-love2d

under atom I use the following:
DL incase you are unfamiliar with Atom: https://atom.io/
https://github.com/rameshvarun/love-ide
or from within atom press ctrl+shift+p then type install package and you should get a menu, type in love and pick love_ide.

I cannot run love2d with the flatpack or snaps version of vscode, it needs to be a .deb or rpm file from microsofts official page : https://code.visualstudio.com/download

its my understanding, and it could be wrong but I could not get it to work, that the way flatpack/snaps is sandboxed it cannot get to /usr/bin/love (typical love2d install location). Installing the non-sandboxed version allows me access to it.

For updating the vscode extension to work with love.
open a terminal and type "which love", which tells you the path to a executable my computer spits back "/usr/bin"
so changing the extension settings for the love executable path from "C:\ProgramFiles\love" to "/usr/bin/love"
This allows me to hit "alt-L" (default keybind for pixelbyte-love2d package) this will run my code from within vscode

On the atom side of things, the extension gives me a "play" button at the top and it runs it directly.

Running from the terminal is the same as it is in the gettingstarted page. once love is install type "love" and the path to the folder containing the love game/code. so in my case love ~/Game_Projects/Love2d/MyLoveGame1


Incase anyone is looking how to compile from source advanced users only:

download the source -- github.com/love2d/love/releases/download/11.4/love-11.4-linux-src.tar.gz

install the following dependencies(might be a few more depending on your flavor of Linux but the install process is usually good about telling you its missing a dependency or it cant find c compliler or something else it might be missing. )

libsdl2-dev libgles2-mesa-dev libopenal-dev luajit libluajit-(Might be a version here)-dev libfreetype6-dev libphysfs-dev libmodplug-dev libmpg123-dev libvorbisfile3 libtheora-dev xarchiver

extract the source. cd in to the folder

./configure && make -j$(nproc) && sudo make install

resolve any errors i think i had to install vorbisfile and bison if i recall correctly.

--shamelessly stolen from reddit :D
https://www.reddit.com/r/love2d/comment ... on_debian/
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Running Love on Linux in 2022

Post by GVovkiv »

I cannot run love2d with the flatpack or snaps version of vscode, it needs to be a .deb or rpm file from microsofts official page : https://code.visualstudio.com/download
its my understanding, and it could be wrong but I could not get it to work, that the way flatpack/snaps is sandboxed it cannot get to /usr/bin/love (typical love2d install location). Installing the non-sandboxed version allows me access to it.
Then change sandboxing permisions:
Flatpak https://docs.flatpak.org/en/latest/sand ... sions.html
https://askubuntu.com/questions/1086529 ... -directory
Or GUI https://flathub.org/apps/details/com.gi ... 4.Flatseal
I don't use snap so i don't know much about them, but snaps should have same system of permisions as flatpaks:
https://snapcraft.io/docs/security-sandboxing

For updating the vscode extension to work with love.
open a terminal and type "which love", which tells you the path to a executable my computer spits back "/usr/bin"
so changing the extension settings for the love executable path from "C:\ProgramFiles\love" to "/usr/bin/love"
This allows me to hit "alt-L" (default keybind for pixelbyte-love2d package) this will run my code from within vscode
On the atom side of things, the extention gives me a "play" button at the top and it runs it directly.
Love extension that i mention also do that, and, most important, author updates it more often then https://marketplace.visualstudio.com/it ... yte-love2d
Running from the terminal is the same as it is in the gettingstarted page. once love is install type "love" and the path to the folder containing the love game/code. so in my case love ~/Game_Projects/Love2d/MyLoveGame1
or you can even alias it, if you feel very lazy:

Code: Select all

alias lovegame="love /path/to/game"
User avatar
H0lyT0ast
Prole
Posts: 7
Joined: Sun Feb 03, 2019 5:44 pm

Re: Running Love on Linux in 2022

Post by H0lyT0ast »

Then change sandboxing permisions:
Flatpak https://docs.flatpak.org/en/latest/sand ... sions.html
https://askubuntu.com/questions/1086529 ... -directory
Or GUI https://flathub.org/apps/details/com.gi ... 4.Flatseal
I don't use snap so i don't know much about them, but snaps should have same system of permisions as flatpaks:
https://snapcraft.io/docs/security-sandboxing
The small amount of research i did said flatpacks could not handle this even with permission changes, i did only look at 1 page tho so thats on me.

On the atom side of things, the extention gives me a "play" button at the top and it runs it directly.
Love extension that i mention also do that, and, most important, author updates it more often then https://marketplace.visualstudio.com/it ... yte-love2d
thanks for the suggestion king, I went with the lazy option of what was everyone else using.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Running Love on Linux in 2022

Post by milon »

Since we're putting out other suggestions, I personally use Linux Mint 20.3 XFCE, and I use Geany for developing. The one in the Mint repo is a little old, but it works great without any problems.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
dusoft
Party member
Posts: 492
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Running Love on Linux in 2022

Post by dusoft »

I use LuaLove for Sublime as recommended on the wiki: https://love2d.org/wiki/Sublime_Text

Building / running right from editor works fine.

I think this package could be easily ported to other editors, at least Atom for sure.
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests