How I made Solar2d works on Linux

I write down here how I managed to do since it took me a while and I see other posts here and on StackOverflow where people got stuck, which is a pity since it’s so close to be working. Also I may forgot it myself. :wink:
Also I added some considerations at the end.

First I’ve tried the snap distro: simulator works but it cannot build android apk.
I think the issue is related to download some dependencies on local .m2 repo which is not in the snap sandbox. I’m not familiar with snap so I didn’t try to fix it, but it may be just a configuration fix.

Build from sources (not that difficult):
I’m using pop-os which is based on ubuntu 22.04 LTS.
The first issue was that the zipped sources in the release pages are useless because they lacks some git submodules.
So you need to clone the whole repo and subrepo:

git clone --recursive https://github.com/coronalabs/corona

then using compiling it cmake:

cd corona
cmake .
make

if cmake is not installed:

apt install cmake

also I had to install (with apt install) a lot of dev libraries, this is my list but your may be different:

libgl1-mesa-dev
libfreetype-dev
libcurl4
libcurl4-gnutls-dev
libpcap-dev 
libssl-dev
libsdl2-dev
libjpeg-dev 

just keep launching cmake and make and install what’s missing until it completes.

At this point you should be able to launch the simulator with

./Solar2d

and run your games in the simulator.

to build android apk you also need

install Java8 (newer version won’t work because of the java module opening) I’ve used sdkman to install a recent java8 and made it default.

add a symlink to java signer in /usr/bin

sudo ln -s /yourjava8dir/bin/jarsigner  /usr/bin/jarsigner

the android template zip file (and the whole Native/Corona/android dir) is missing from the sources (at least I couldn’t find it) so I copied from the snap installation:

cp /snap/solar2d/current/usr/local/bin/Solar2D/Resources/Native/Corona/android ./Resources/Native/Corona/.

and that’s it, it works and I can build apk.

Current limitations I’ve found so far:

  1. the box2d corona lib is an older version and it’s missing some function calls.
  2. live builds checkbox is not present in the build dialog, so no live builds (so far).

I understand that the maintainer of linux version is not working on it anymore, I’m not volunteering myself but if someone helps me a bit with how corona builds are working I’m willing so spend some time trying to fix some of the above issues, they seems quite low hanging fruits.

In the meanwhile I hope this can be useful to other people as well.

5 Likes

Hello Catlikesbest@ramtop,

The issues you’ve encountered, such as the older version of the box2d library and the absence of live builds, are indeed areas that could benefit from further development. While you’ve mentioned not volunteering for maintaining the Linux version, your willingness to contribute if guided is commendable.

For those who might be interested in picking up where you left off or assisting in the maintenance and development of Solar2D for Linux, your post serves as a solid foundation. Hopefully, your efforts and this shared knowledge will encourage more collaboration within the community to enhance Solar2D’s compatibility and features on Linux platforms.

Again, thank you for your contribution, and I’m sure many users will find your instructions and insights very helpful.

If someone gives me a nudge in the right direction I can try to fix those two. I’m not sure how the snap packages are made and how livebuilds are supposed to work under the scene.
I’m pretty busy atm, but I can look at it in a few weeks.