[Vm-dev] Small problem compiling stackspur vm on phone

tim Rowledge tim at rowledge.org
Thu Dec 31 23:52:32 UTC 2020

For reasons I've been trying to compile a vm to run on an ubuntu container running on a samsung galaxy 7phone. I know, right? Who'd want an Android phone? Nasty tacky OS.

Anyway, the cog vm compiles and happily starts with '-h' ... but any attempt to open on an image crashes with a very unhelpful
Illegal Instruction
and no crash file or any other help. I'll get around to trying a debug version some day.

In the meantime the stack VM was a bit interesting to compile. It hits a fatal link error because sqUnixMain wants to refer to sendTrace from the interp.c file. It lists a very strange error

opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:1561:(.text+0x2744): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `sendTrace' defined in COMMON section in vm/vm.a(gcc3x-interp.o)
/root/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:1561: warning: One possible cause of this error is that the symbol is being referenced in the indicated code as if it had a larger alignment than was declared where it was defined.
collect2: error: ld returned 1 exit status

The google results for 'relocation truncated to fit' are ... interesting. If, that is, you want to know inner arcane details of C compilation. Which I don't, anymore.

A successful work-around is to comment out the lines 
#if (STACKVM || NewspeakVM) && !COGVM
  else if (!strcmp(argv[0], VMOPTION("sendtrace"))) { extern sqInt sendTrace; sendTrace = 1; return 1; }
in sqUnix.c

Oh - the phone runs that VM and manages about  85 MBC/s & 5MSend/s which suggest roughly Pi 3 performance, so it should be ok once Cog runs.

Happy new year all - let's hope 20/20 vision is an improvement.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
The gains I make don't make me a hero; all the work I do is just to get back to Zero

More information about the Vm-dev mailing list