opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

Trouble running OSVM in an Ubuntu 20/aarch64 docker (raspi)

Open LinqLover opened this issue 4 years ago • 12 comments

Sorry for the complex title. I'm not yet sure what is the error in my particular configuration.

I'm trying to write a Dockerfile to run Squeak on my raspberry pi (4b+, set up with 64 bit). I downloaded this release: squeak.cog.spur_linux64x64_202003021730 and tried to execute it without any arguments for the beginning:

root@cadc927632ce:/# ./sqcogspur64linuxht/squeak 
        not a dynamic executable
Error. Could not determine platform's libc path for VM. 
Try forcing $PLATFORMLIBDIR in ./sqcogspur64linuxht/squeak, based on LIBC_SO.
Please report what works to squeak [vm-dev] mail list.
  LIBC_SO=
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=20.04
  DISTRIB_CODENAME=focal
  DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
  NAME="Ubuntu"
  VERSION="20.04.1 LTS (Focal Fossa)"
  ID=ubuntu
  ID_LIKE=debian
  PRETTY_NAME="Ubuntu 20.04.1 LTS"
  VERSION_ID="20.04"
  VERSION_CODENAME=focal
  UBUNTU_CODENAME=focal
  UNAME=Linux cadc927632ce 5.4.79-v8+ #1373 SMP PREEMPT Mon Nov 23 13:32:41 GMT 2020 aarch64 aarch64 aarch64 GNU/Linux
  System seems to be 64 bit. You may need to (re)install the 32-bit libraries.

What does this error message want to tell me? Which libraries should I install? I already gave this [https://github.com/pharo-project/pharo-launcher/issues/112] a try, but I only get 404 errors for i386 repository - it looks as if it is not available for Ubuntu 20.

Can you help me? What libraries and packages do I need to install to get a (headful, planning to use ssh -X) running in my container?

(PS: Probably a Squeak alternative for http://get.pharo.org/ could be helpful, too. :-))

LinqLover avatar Dec 30 '20 15:12 LinqLover

I would not expect an x64 binary to run on arm

StephanEggermont avatar Dec 30 '20 15:12 StephanEggermont

Can you elaborate on that, please? I thought aarch64 would be a 64-bit system. Getting the same error with linux32x86 ...

LinqLover avatar Dec 30 '20 16:12 LinqLover

The Pi is an ARM system, not an Intel system. It runs with the ARM 64-bit instruction set, called aarch64.

The VM you have is for "intel" 64-bit, aka x64, or x86_64 or amd64 and so on.

The VN is not for your processor. you need to download the ARM variant ( “Linux (ARM)” in the Screenshot ) Bildschirmfoto 2020-12-30 um 17 57 04

Note that you probably need some libraries, too, because the VM is for the Raspberry-Pi 2 and 3 compatible ARMv6 instruction set (which is a 32-bit one) so you might need some multi-arch support in ubuntu.

krono avatar Dec 30 '20 16:12 krono

The respective names in the repo are linux64ARMv8, linux32ARMv7, and build.linux32ARMv6.

(we do not have auto-built VMs for the 64ARMv8 yet, so you might need to compile it yourself if you want to use that)

krono avatar Dec 30 '20 17:12 krono

I have tried my luck now with squeak.cog.spur_linux32ARMv6_202003021730, but I keep getting the same error message. A docker container will always use the same architecture/bitness as the host system, won't it? I am a bit confused: From my Windows Subsystem for Linux (x64), I am used to seeing some kind of "cannot execute binary file: Exec format error" messages if I run a 32-bit application so the bitness does not match. Why don't I see errors like this in my docker container? It looks as if the VM executable itself can be run.

Note that you probably need some libraries, too, because the VM is for the Raspberry-Pi 2 and 3 compatible ARMv6 instruction set (which is a 32-bit one) so you might need some multi-arch support in ubuntu.

Can you give me a pointer on how to find these libraries?

I also tried to compile linux64ARMv8 manually, but how can I cross-compile this from my Intel x64 Ubuntu system? The mvm script terminates with: "configure: error: C compiler cannot create executables" and config.log contains "cc1: error: bad value ('armv8-a') for '-march=' switch". The internet says I should use aarch64-linux-gnu-gcc or arm-linux-gnueabi-gcc (not sure which) instead of gcc, but how can I tell mvm to use this? 🤯

LinqLover avatar Dec 30 '20 17:12 LinqLover

ARM64 VM works just fine on suitable Raspberry Pi's. And indeed on a suitable phone.

Outside of simply connecting to a few docker-like containers I have no knowledge that would help with docker details, but...

On 2020-12-30, at 9:44 AM, Christoph Thiede [email protected] wrote:

I also tried to compile linux64ARMv8 manually, but how can I cross-compile this from my Intel x64 Ubuntu system?

Why on earth would you do that? why go to all the trouble of messing with cross-compiler setups (which will certainly involve you getting cross) when you can just do it on the actual machine? It takes a whole couple of minutes to compile on a Pi 4 for example.

Do the stuff to mount your git related directory tree to the Pi, run a terminal on the Pi, cd to the right build directory and go.

tim

tim Rowledge; [email protected]; http://www.rowledge.org/tim "Bo***x" said Pooh when Piglet kneed him in the groin.

OpenSmalltalk-Bot avatar Dec 30 '20 18:12 OpenSmalltalk-Bot

Thanks for the help, Tim!

Why on earth would you do that?

I didn't want to pollute my raspi with that compilation stuff ... However, now I did it (also thanks to the help by Bruce) and succeeded to compile!

Next problem:

root@96fa02af4449:/# /bin/squeak/squeak /image/Squeak6.0alpha-20135-64bit.image  -headless
mprotect(x,y,PROT_READ | PROT_EXEC): Permission denied
Segmentation fault (core dumped)

You mentioned the same problem here, but above you write that "ARM64 VM works just fine on suitable Raspberry Pi's". Could you resolve the problem in the mean time, or did you find another workaround? :-)

LinqLover avatar Dec 31 '20 00:12 LinqLover

On 2020-12-30, at 4:45 PM, Christoph Thiede [email protected] wrote:

Thanks for the help, Tim!

Why on earth would you do that?

I didn't want to pollute my raspi with that compilation stuff ... However, now I did it (also thanks to the help by Bruce) and succeeded to compile!

But all the compiler/tools stuff is already there. Remember, this is a full development workstation with more power than we fantasised about not so long ago.

Next problem:

root@96fa02af4449:/# /bin/squeak/squeak /image/Squeak6.0alpha-20135-64bit.image -headless mprotect(x,y,PROT_READ | PROT_EXEC): Permission denied Segmentation fault (core dumped)

install libevdev seems to fix it.

tim

tim Rowledge; [email protected]; http://www.rowledge.org/tim Useful random insult:- Teflon brain -- nothing sticks.

OpenSmalltalk-Bot avatar Dec 31 '20 00:12 OpenSmalltalk-Bot

But all the compiler/tools stuff is already there. Remember, this is a full development workstation with more power than we fantasised about not so long ago.

True :D

install libevdev seems to fix it.

Which one are you referring to?

root@96fa02af4449:/# apt search libevdev
Sorting... Done
Full Text Search... Done
libevdev-dev/focal-updates 1.9.0+dfsg-1ubuntu0.1 arm64
  wrapper library for evdev devices - development files

libevdev-doc/focal-updates 1.9.0+dfsg-1ubuntu0.1 all
  wrapper library for evdev devices - development docs

libevdev-tools/focal-updates 1.9.0+dfsg-1ubuntu0.1 arm64
  wrapper library for evdev devices - tools

libevdev2/focal-updates 1.9.0+dfsg-1ubuntu0.1 arm64
  wrapper library for evdev devices

LinqLover avatar Dec 31 '20 00:12 LinqLover

On 2020-12-30, at 5:00 PM, Christoph Thiede [email protected] wrote:

But all the compiler/tools stuff is already there. Remember, this is a full development workstation with more power than we fantasised about not so long ago.

True :D

install libevdev seems to fix it.

Which one are you referring to?

Sorry - libevdev-dev - which may be the most redundantly redundant library name I've redundantly seen repeated.

tim

tim Rowledge; [email protected]; http://www.rowledge.org/tim Fractured Idiom:- MERCI RIEN - Thanks for nothin'.

OpenSmalltalk-Bot avatar Dec 31 '20 01:12 OpenSmalltalk-Bot

I have tried that and built the VM again, but I keep getting the same mprotect error message :( Any other ideas?

LinqLover avatar Dec 31 '20 12:12 LinqLover

Hi all,

thanks a lot for your help. In the meantime, I have finally been able to succeed in the entire build process. Because it was a quite costly setup, I have summarized all relevant docker files and build scripts in this repository:

https://github.com/LinqLover/squeak-raspi-docker

Please feel free to add your suggestions for improvements or to share this link! :-)

Happy Squeaking, Christoph

LinqLover avatar Jan 24 '21 18:01 LinqLover