Building Love2d on Ubuntu Touch

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

Building Love2d on Ubuntu Touch

Post by Wendigo »

Hi Community,
I'm currently trying to get Love2d to run on my Ubuntu Touch phone, which runs a (more or less regular) Ubuntu Linux on armhf.
By following the guide on the wiki, I was able to successfully build the engine (leaving out the automagic part).
I did the compilation inside a Libertine container where I installed the build dependencies. Running the compiled love binary there works fine:

Code: Select all

./love --version 
LOVE 11.1 (Mysterious Mysteries)
But when I try to run it on the phone directly (outside of the container) I get the following error:

Code: Select all

./love --version
/home/phablet/Downloads/development/love2d_arm/love-11.1/src/.libs/lt-love: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
I guess I need to do statical linking to keep all the dependencies together with the executable but unfortunately I don't know how to do that.
I also noticed that the files inside "src" are over 140MB in size while the AppImage in the downloads section is just 4MB. Is it possible to shrink the size of the executable for distribution on mobile devices?

Thank you very much in advance. :)
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Building Love2d on Ubuntu Touch

Post by pgimeno »

Wendigo wrote: Fri Nov 09, 2018 10:24 pm I guess I need to do statical linking to keep all the dependencies together with the executable but unfortunately I don't know how to do that.
./configure --disable-shared --enable-static

If you get errors about pthread, look here: viewtopic.php?p=220753#p220753

Wendigo wrote: Fri Nov 09, 2018 10:24 pm I also noticed that the files inside "src" are over 140MB in size while the AppImage in the downloads section is just 4MB. Is it possible to shrink the size of the executable for distribution on mobile devices?
To strip debug info: strip love
To compress the executable: upx -9 love
Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

Re: Building Love2d on Ubuntu Touch

Post by Wendigo »

Thanks for the quick reply.
I indeed ran into the pthread issue but I don't get what I have to do exactly to solve it.
I added a file called "ax_pthread.m4" to the subdirectory "platform/unix/m4" and pasted the content from the provided link.
But what I don't get is how/where to run the diff command from the code block you posted.

Code: Select all

diff -r 0d1c0ea65da0 platform/unix/configure.ac
Sorry, I don't have any experience with mercurial and the diff command.
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Building Love2d on Ubuntu Touch

Post by pgimeno »

'diff -r blahblah' is not a command you need to run, it's a patch.

Patches can be applied by hand or with the 'patch' command. In this case, I recommend to use the quick and dirty method and to apply it by hand, because 'patch' would require even more explanations.

These two lines:

Code: Select all

-       \$(vorbisfile_LIBS) \$(theora_LIBS)
+       \$(vorbisfile_LIBS) \$(theora_LIBS) -lpthread
indicate "remove the line that contains

\$(vorbisfile_LIBS) \$(theora_LIBS)

and replace it with the following line

\$(vorbisfile_LIBS) \$(theora_LIBS) -lpthread

to obtain the modified file". In a diff/patch file, the lines that start with spaces are context, the ones that start with - need to be deleted, and the ones that start with + need to be added. They always have a heading indicating the name of the original file compared and the modified file compared. Diff is line-oriented, meaning that when something like a letter changes, the whole line is deleted and the changed line with the letter modified is added.
Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

Re: Building Love2d on Ubuntu Touch

Post by Wendigo »

Thank you for the detailed explanation. I got it to compile again.
After stripping the debug symbols and compressing the binary it now has just 1.6MB, wow.

I'm sorry, but I need to bother you again. love runs fine inside the container again but outside it now complains about not having the sdl2 library:

Code: Select all

./love --version
./love: error while loading shared libraries: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
Edit:
This is what ldd shows me:

Code: Select all

	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb6ed1000)
	libSDL2-2.0.so.0 => not found
	libopenal.so.1 => not found
	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6eaf000)
	libmodplug.so.1 => not found
	libvorbisfile.so.3 => not found
	libtheoradec.so.1 => /usr/lib/arm-linux-gnueabihf/libtheoradec.so.1 (0xb6e8f000)
	libogg.so.0 => /usr/lib/arm-linux-gnueabihf/libogg.so.0 (0xb6e82000)
	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6e5e000)
	libluajit-5.1.so.2 => not found
	libmpg123.so.0 => not found
	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6d4f000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6cd7000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6caf000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6bc2000)
	/lib/ld-linux-armhf.so.3 (0xb6f5c000)
	libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0xb6b9a000)
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Building Love2d on Ubuntu Touch

Post by pgimeno »

Hmmm... Well, I have no idea what that container is, but anyway, first thing to check is whether you have the corresponding .a files. If so, maybe LÖVE doesn't attempt to add those statically even if asked to. It certainly has linked liblove statically.

Note though that some of the libraries you intend to include are LGPL-licensed, which means there are further restrictions that you need to comply with if you distribute a binary that has them statically linked. Take a look at the LGPL 2.1, especially section 6.
Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

Re: Building Love2d on Ubuntu Touch

Post by Wendigo »

Thanks again for you help, I finally got it running. :)

But it runs so slow that one can count the frames as they get displayed and the colours are somehow reversed (see screenshot on UBports).
Is it possible to set whether to use OpenGL or GLES2 or do you have any ideas about what I could do to improve it?
I'd love to have this engine running on Ubuntu Touch phones, this would make developing games for the OS a breeze.

* My thread on the UBPorts forum:
https://forums.ubports.com/topic/1970/a ... pp-scope/3
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests