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.

6 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.

1 Like

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.

1 Like

oh yeah, I tested it in a web server before I went to sleep and it worked! now I can sleep in peace!

oh yeah, I think we also need

cp ./snap/usr/local/bin/Solar2D/Resources/webtemplate.zip Resources/

to get the html5 build working, all-tho that did not seem to work just right for me, maybe i need to run it form a web server, I will try that later, getting late here.
good night

thanks a lot, I used your method, except you did not seem to explain how to get the files form the snap file, but i figured out that you can do it using

sudo mount -t squashfs -o ro /path/to/my.snap /path/to/mountpoint

and also the location of the zip file and all seems to have changed to

/snap/usr/local/bin/Solar2D/Resources/Native/Corona/android/

and you also needed the -r parameter to cp

but otherwise it worked for me, thanks a lot!

Hi, thanks for doing that ! I am in the process of making Solar2D run on embedded linux, as Solar2D is going to be a very nice running on a Toradex imx8 or imx9 computer.

This is the exact list of ones I have, but I even installing did not create everything for the container project.

My approach with anything manky is just to start from the bottom, and make fresh. Go into ~/Corona/external and clone in the source codes, and then cross-compile the library files and add the header reference to ~/Corona/external/{boxfresh}. The codebase of Corona is really very nicely made, its just the dependencies that are trouble.

I am figuring out on Docker how to make automatic and simultaneous cross-compilers for multiple different processors, it looks really funky but I need a few days to get my head around it all.

Did you come across this little cracker???

jconfig.h is actually a file that seems to be part of the ancient compiler for this 1999 code not the actual jpeglib itself. I have been ferreting around for an hour to try to see why make tries to use it. If you actually look at the jconfig.h, it is not a C header file.

[ 4%] Built target tp
[ 4%] Built target url
[ 4%] Building CXX object CMakeFiles/Solar2D.dir/platform/shared/Rtt_BitmapUtils.cpp.o
In file included from /home/torizon/corona/platform/shared/Rtt_BitmapUtils.cpp:14:
/usr/include/jpeglib.h:29:10: fatal error: jconfig.h: No such file or directory
29 | #include “jconfig.h” /* widely used configuration options */
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/Solar2D.dir/build.make:7594: CMakeFiles/Solar2D.dir/platform/shared/Rtt_BitmapUtils.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:451: CMakeFiles/Solar2D.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
torizon@4d8dc6ef7586:~/corona/build$

No sorry no idea,but on my dev machine:

locate jconfig.h

gives me

/home/uberto/dev/corona/external/libjpeg/jconfig.h
/usr/include/x86_64-linux-gnu/jconfig.h

Btw I’m using Solar2d on Linux for Android projects, not linux games.

the jconfig.h file looks like something from the 90’s its part of the jpeg library. I am trying to see where the code reckons its needs it.

I’m using Solar2D for a feasibility into big screen interactive GUI projects, can’t wait to see how well it works with a 40 inch touch screen display.

You made me think :- :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:. I could design my Lua application on my PC and compile them up for Linux or Android to run on my single board computer. I would like to be able to do design on the same system that runs the display so I can at least finesse the final version.

1 Like

oh one more thing i had to do, I know this wont affect most people, but at the moment I tried to build an android APK, it would not do it, turns out I had to change my system language to English, I had it in Japanese

Hello fellow Linux Solar2d users!
I ran into trouble using the solar2d native.newTextField() trying to make my own textbox, I am not savvy enough to modify the solar2d code, so I did the next best thing and came up with my own textbox for Linux(the native.newTextField() works on the windows version of solar2d)

hope this can help some of you, don’t let solar2d die on Linux!

1 Like

Sorry i am new to this thread. This means that the Linux port of Solar2d is no longer avalaible/mantained? No more Linux versions of it? I ask because I basically develop in Linux and did not know what engine to use. My choices where Defold, glideros and solar2d. Thanks anyway.