Solved Looking for advice about running a Linux binary

Hi!

I need to install Scratch3 on a laptop running FreeBSD. I know it can run online, but I need to run it offline too.
In fact, the official Scratch3 download page does not offer any binary for Linux, but several can be found on scratux.org.

I haven't found any equivalent software on FreeBSD. If anyone knows of any, recommendations are welcome but there's a high requirement: it must be fully compatible with Scratch3, since I'll use it to create files that will be opened at work by Scratch (2 or 3, on Windows).

From what I found in the handbook and on forums, I see at least 4 options:

1) Try to run the Windows setup.exe file via wine64. I did install emulators/wine, emulators/wine-gecko and emulators/wine-mono. Unfortunately, when starting the setup.exe, it resulted in: 0009:err:module:__wine_process_init L"Z:\\usr\\home\\nico\\Downloads\\Scratch Desktop Setup 3.9.0.exe" not supported on this system. Moreover, when trying to start it from normal user, then, in addition to the main error, I got Could not find Wine Gecko. HTML rendering will be disabled.. I think I'd better give up on this option.

2) Use the linux compatibility layer. I followed the steps in the handbook and used my linux desktop to copy the missing libs (and all links). Unfortunately, once it did not complain about a missing library anymore, it started to throw several errors from something like libc6.so telling GLIBC versions 25, 26, 27, 28, 29 and 30 were not found. Unfortunately again I certainly messed up with the compatibility layer (see 3) and I cannot get these errors anymore, instead I get FATAL: kernel too old.

3) Use rpm? I did install archivers/rpm4 and ran rpm -i scratux-1.3.0.x86_64.rpm but this returned a fair bunch of big dependencies (like gtk3). Unfortunately, installing x11-toolkits/linux-c7-gtk3 didn't remove the matching requirement from the result of rpm -i scratux-1.3.0.x86_64.rpm

4) Try to "compile from source": the closest seems to follow the steps described at Scratch3 source code repo? This requires www/npm. Havent' tried this yet. No idea if there's at least a chance to get this "installation" running in FreeBSD.

I cannot count linux Appimage, as it does not seem to run (and Appimage is not ported (yet?) to FreeBSD).

Questions:
a.
Is this a bad idea to mix up rpm packages and the linux compatibility layer? Do they interact well, badly or not at all?
b. How is it possible to properly "reset" the usage of the linux compatibility layer? Simply uninstall all linux-c7* packages? Or should I also rm -rf /compat/linux/* and start afresh?
c. Any other advice as to make Scratch3 running in FreeBSD?
 
Looking at the code repo you linked, this is an electron app. IMHO, electron is a true pest, but seems to spread rapidly. So, there isn't really a "Linux binary", but probably a distribution containing a Linux version of electron.

I can't give any good advice here, but I doubt you'll have any luck with the Linuxulator. Electron is available on FreeBSD for some time now, and it *should* be possible to build a port using it -- but for the complexity that comes with that, have a look at e.g. editors/vscode. If you want to avoid a lot of stress, run it in a virtual machine.
 
I didn't realise Scratch was so restrictive.

Perhaps you can run an offline instance of the web system: https://github.com/LLK/scratch-www

As a web solution, it is written by typical web developers, so it is a mess of dependencies. Tracking them all down will be the hardest part.

If not... VirtualBox running a proprietary OS. That is what the Scratch sponsors seem to want you to be doing ;)
 
Well, I tried again from a clean new FreeBSD install to make scratux run via option 2) (linuxulator) but got the FATAL: kernel too old again. So the problem was not from the mixed attempts via the linuxulator and rpm. I guess the message simply tells the problem: kernel version from linuxulator is found as too old. (Doesn't mean there is no any other problem, but maybe at some point this may work better?).

Starting to port it seems to be a real challenge... So I gather my best attempt would be via virtualbox, so I'll try this.

Still if anyone has valuable advice about question c., it's welcome.

Thank you all for your quick answers!

Some little notes:
Perhaps you can run an offline instance of the web system: https://github.com/LLK/scratch-www
From what I understand, it's only the website without the editor.

If not... VirtualBox running a proprietary OS. That is what the Scratch sponsors seem to want you to be doing ;)
I hope a Linux will be fine!
 
but got the FATAL: kernel too old again. So the problem was not from the mixed attempts via the linuxulator and rpm. I guess the message simply tells the problem: kernel version from linuxulator is found as too old.
You can configure the kernel version reported to userspace, e.g. sysctl compat.linux.osrelease=3.2.0 helped me getting some Linux binaries to run. Of course there's no guarantee.
Starting to port it seems to be a real challenge... So I gather my best attempt would be via virtualbox, so I'll try this.
It is. I like writing my own ports for software I want to use, but wouldn't attempt to do so for an electron app :-/
 
You can configure the kernel version reported to userspace, e.g. sysctl compat.linux.osrelease=3.2.0 helped me getting some Linux binaries to run. Of course there's no guarantee.
Thank you very much! Maybe it won't work in the end, but at least, I finally got over this fatal error! So I'd explore a little bit further, as long as it's possible.

So, now, I do get these "GLIBC_2.* not found" errors again (I guess the fatal error showed up because one of the added libraries did complain about the too old kernel version).

Code:
./scratux: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /lib64/libglib-2.0.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /lib64/libgio-2.0.so.0)
./scratux: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /usr/lib/libgtk-3.so.0)
./scratux: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /lib64/libcairo.so.2)
./scratux: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /lib64/libexpat.so.1)
./scratux: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /lib64/libpixman-1.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /lib64/libsystemd.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /lib64/libsystemd.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.26' not found (required by /lib64/libsystemd.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.30' not found (required by /lib64/libsystemd.so.0)
./scratux: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /lib64/libsystemd.so.0)

If anyone has a clue about where this missing version can be found on a Linux box, because it does work on the Linux box where I copied the missing libraries from, I just don't know in which file the glibc are supposed to be (unfortunately, no glibc*.so on this Linux box).

I like writing my own ports for software I want to use, but wouldn't attempt to do so for an electron app :-/
Just for reference, if you or anyone else wants/needs to attempt such a port some day, this blog post makes things look less terrible: https://blog.c6h12o6.org/post/freebsd-electron-app/
 
I just don't know in which file the glibc are supposed to be

Inside of the libm.so.6 and libc.so.6 libraries.
Run strings /compat/linux/lib64/libm.so.6 | grep GLIBC ( also libc.so.6 ) to list the available GLIBC libraries.

If you run a web search for “libm.so.6” “libc.so.6” "GLIBC_2.30" you will find corresponding packages to download, only make sure those are for CentOS. But I would be surprised putting those libraries there will move the situation closer to a working Linux executable.
 
I had this posted, then read you wanted offline and not online, so deleted it. But I decided to post it again. Maybe it can be beneficial others.

It may be in a web browser, but the loopback address (127.0.0.1), seems to suggest that this solution should work offline.
 
If you run a web search for “libm.so.6” “libc.so.6” "GLIBC_2.30" you will find corresponding packages to download, only make sure those are for CentOS. But I would be surprised putting those libraries there will move the situation closer to a working Linux executable.
Many thanks! I could see that the available GLIBC_2 versions are outdated. I've tried to find packages to get newer libm.so.6 and libc.so.6 but couldn't find them for CentOS. I guess I could install CentOS in a VM and get the files from there. Still as this is quite unsure and as the other solutions looked promising, I gave up.

How to run Scratch 3 on FreeBSD

I had this posted, then read you wanted offline and not online, so deleted it. But I decided to post it again. Maybe it can be beneficial others.
It may be in a web browser, but the loopback address (127.0.0.1), seems to suggest that this solution should work offline.
Yes, it runs locally, so it should be OK offline too.

Things seem to have changed since your blog post, pyret, as installing and running the scratch-vm part of Scratch3 project only runs a benchmark now. But from the scratch-vm's github repo I could get to the steps to run the complete editor in a webpage.

So, I followed the steps and got the Scratch3 editor running locally in a web browser! It could open and run my current projects. Marvelous!

For information, if anyone wants to do the same, one can first # pkg install node npm openjdk8-jre (or compile the ports). java/openjdk8-jre is required to run npm install in the scratch-blocks directory. Also I had to cheat a little bit, since installing the scratch-blocks part requires python2.7, so I temporarily changed /usr/local/bin/python to point to /usr/local/bin/python2.7. Also I added the scratch-render project. Looks necessary. This was not much more. And all the npm link should actually be sudo npm link (or run as root). It takes some time to download and install everything but it works fine :D

Many thanks for your help!!
 
For information, if anyone wants to do the same, one can...

Thanks for that. It may come in handy. At the university due to this COVID stuff, I am potentially going to be running a first year development unit for the game designers (not the game programmers, they get C++ ;)) and something like this could be ideal.

Currently my colleague runs the unit and uses Construct (https://www.construct.net/en) which is annoying for two reasons. The first one is that the old editor (v2) is Windows only; and the most recent editor (v3) (deprecating the v2 client) is cloud based web-only and closed-source which I despise for development tools (I don't want my students putting effort into creating something that can be taken away from them).

I was considering Alice (https://www.alice.org/) too but would have preferred 2D to force them to focus on the logic rather than the "looks" of their assignment.
 
I wanted to add that I'd liked to try the VirtualBox solution (via a minimal debian or ubuntu), but unfortunately the laptop I'm using doesn't seem to have virtualization (there's nothing like that to be enabled in the BIOS), so I can only run 32-bits virtualized OSes in VirtualBox. It becomes difficult to find, and I'm not sure that the Scratux packages are 32 bits now, they're probably only 64 bits. I wonder if bhyve could help (I've no experience about it) but I expect to stumble upon the very same problem as for VirtualBox.

something like this could be ideal.

I guess you've checked it in the meantime. The most simple solution is to open the online editor as mentioned in my first post (provided there's an internet connection).
I don't know if you can teach what you need at university with Scratch3 (maybe yes, it is really programming after all). I use it for young pupils (between about 11 and 14 years old).

Another project that looks interesting, and claiming to be an enhancement of Scratch3, is mBlock. They also have a web-based app there. It looks more oriented towards robots programming and programming seems to be done either via blocks or python (there's a "blocks" tab and a "python" tab). But big downside: the source code of the latest release, whereas based on open source code, cannot be found... And clicking on the "developer" tab of the main official page leads to a chinese website, so, for me, impossible to investigate further.
 
Back
Top