## Building Love2d on Ubuntu Touch

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

### Building Love2d on Ubuntu Touch

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

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.

pgimeno
Party member
Posts: 1531
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Building Love2d on Ubuntu Touch

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

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
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

### Re: Building Love2d on Ubuntu Touch

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.

pgimeno
Party member
Posts: 1531
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Building Love2d on Ubuntu Touch

'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.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

### Re: Building Love2d on Ubuntu Touch

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)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6eaf000)
libogg.so.0 => /usr/lib/arm-linux-gnueabihf/libogg.so.0 (0xb6e82000)
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)

pgimeno
Party member
Posts: 1531
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Building Love2d on Ubuntu Touch

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.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

Wendigo
Prole
Posts: 4
Joined: Fri Nov 09, 2018 10:01 pm

### Re: Building Love2d on Ubuntu Touch

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

### Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 11 guests