I downloaded the sources for 1.0.4 and tried to compile them on my Raspberry Pi 3, which uses armv7l architecture). The first stage worked, but when I typed ./koch tools, it eventually aborted with the message:
CC: ../compiler/ast.nim
Error: execution of an external compiler program 'gcc -c -w -pthread -O3 -fno-strict-aliasing -I/home/pi/Downloads/nim-1.0.4/lib -I/home/pi/Downloads/nim-1.0.4/nimsuggest -o /home/pi/.cache/nim/nimsuggest_r/@m..@[email protected] /home/pi/.cache/nim/nimsuggest_r/@m..@[email protected]' failed with exit code: 1
during RTL pass: cse_local
/home/pi/.cache/nim/nimsuggest_r/@m..@[email protected]: In function 'divMod__hJyv3l2B2Q9cPG2G6osz9cmA':
/home/pi/.cache/nim/nimsuggest_r/@m..@[email protected]:1030:1: internal compiler error: Segmentation fault
}
^
0x76af411f ???
../sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
0x76ade717 __libc_start_main
/build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,
I downloaded the latest nightly build https://github.com/nim-lang/nightlies/releases/download/2020-01-11-devel-767592a/nim-1.1.1-linux_armv6.tar.xz which worked OK. So maybe things will work out better in the next release.
Just something in the way of a feature request: I tried to cross-compile some code for ARM, like so:
nim c --cpu=arm proc.nim
and it was trying to use the gnueabifh compiler. Cross-compiling is a bit of a mystery to me, but I think gnueabifh assumes an architecture that is incompatible with armv6 (?). So it would be nice if I could do something like
nim c --cpu=armv6 proc.nim
Or maybe you already have some flags that I can set that actually does this?
What distribution are you using? Because if it's Raspbian it's 32-bit even if the hardware supports 64-bit.
Also depending on your RAM you might need to increase your swap, see https://github.com/status-im/nim-beacon-chain#raspberry-pi
sudo vi /etc/dphys-swapfile
# Set CONF_SWAPSIZE=2048
# :wq
sudo reboot
I'm using Raspbian on a Pi3 (and Pi2). The version of nim in the repo is fairly old. I'm now just going with the simplest solution: using the nightly build that I indicated above. It works, so I'm happy.
I'm using GCC v 8.3.0 on the Pi 2 and 3. I do most of my work on an x84_64.