Trying to build on ARM

#1

Hello all,

I was wondering if somebody could help me with the building of zcashd on an odroid C2 running armbian.

I couldn’t get the following dependency to be installed : “g+±multilib”.

When starting the process as described in the documentation, I’m stuck with the following:

error: toolset gcc initialization:

error: provided command 'aarch64-unknown-linux-gnu-g++' not found

error: initialized from /mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/user-config.jam:1

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/build/toolset.jam:43: in toolset.using from module toolset

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/build/project.jam:1052: in using from module project-rules

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/user-config.jam:1: in modules.load from module user-config

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/build-system.jam:249: in load-config from module build-system

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/build-system.jam:385: in load-configuration-files from module build-system

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/build-system.jam:524: in load from module build-system

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/kernel/modules.jam:295: in import from module modules

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module

/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/boost-build.jam:17: in module scope from module

funcs.mk:257: recipe for target '/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/./.stamp_built' failed

make: *** [/mnt/usbdrive/zcash/depends/work/build/aarch64-unknown-linux-gnu/boost/1_66_0-6ca30f54347/./.stamp_built] Error 1

make: Leaving directory '/mnt/usbdrive/zcash/depends'

Did anybody succeed in build zcash on an arm based system?

Post-sapling zcashd - on a Pi?
#2

There was an attempt to build it on a Pi but it didn’t work out, here’s a link to the thread that might help.

1 Like
#3

UPDATE: Radix42 has generously updated her ARM code and is now available: https://twitter.com/radix42/status/1104907304124657664?s=09

@garethtdavies @den and anyone interested should download it while it’s still available.

Donations welcome of course :wink:

2 Likes
#4

I rebased my cross-compilation branch on current master, and pushed a couple of additional commits so that aarch64 compiles. You can test it out with:

$ sudo apt install g++-aarch64-linux-gnu
$ HOST=aarch64-linux-gnu ./zcutil/build.sh
4 Likes
Anyone know what this is about
Post-sapling zcashd - on a Pi?
#5

Finally have some time to test this !

I can’t install that package on armbian running on odroid c2. Is that supposed to be run on a pc and then use the files on the arm machine?

#6

Yes; it’s a cross-compilation, so you compile on one machine and then use the result on the target.

1 Like
#7

Just got my Pine64 Rockpro board :grin: , etching microSD with Ubuntu. Next will be to get str4ds cross compile going.

7 Likes
#8

Just got it to x-compile on Ubuntu, Pi3B+ ready to go tomorrow :slight_smile:

5 Likes
#9

I’ve got the following eror message when trying to cross compile on debian :

configure: error: cannot run test program while cross compiling
See `config.log’ for more details
funcs.mk:257: recipe for target ‘/home/den/zcash/depends/work/build/aarch64-linux-gnu/bdb/6.2.23-4b0fd7f6609/build_unix/.stamp_configured’ failed
make: *** [/home/den/zcash/depends/work/build/aarch64-linux-gnu/bdb/6.2.23-4b0fd7f6609/build_unix/.stamp_configured] Error 1
make: Leaving directory ‘/home/den/zcash/depends’

Strange . … I’ll try on Ubuntu since it seems to work for others…

#10

OK … Found my mistake . . :slight_smile:

#11

Cross compiling went fine, then had another issue which was solved by upgrading armbian to sid.
zcashd was crashing probably because running out of memory on the odroid c2.
Have just added 2gb of SWAP and things seem to be more stable now… :slight_smile:

#12

Are you currently syncing? I’d be really interested to know how far you get as I think it might struggle or be incredibly slow.

#13

Its working !!! :slight_smile:

There was a missing shared object on the Pi ubuntu-server image, fixed that with this :-
sudo apt-get install libgomp1

I have this idea that giving it shitloads of swap will allow it to sync on mainnet, so gave it 8Gb & will see how that goes.

Edit: Adding a pic, just because its got a cool sticker)

7 Likes
#14

I tried syncing with swap and I can’t recall what happened (I think it crashed) but it wasn’t a great experience :laughing: However you do it though, once synced, it runs perfectly.

1 Like
#15

I am. And whiteout adding swap to the odroid C2 I reached around 160k block. But then impossible to continue more than 5 min without crashing.
It’s now been 1 hr I’ve added extra swap and it still runs OK.

3 Likes
#16

I’m running with Ubuntu 18 and will have time to start the next steps tonight.

Can you guys elaborate on the cross-compile steps?

Clone str4ds branch, compile as normal, after compile transfer to board, then start Node as normal for sync? Am I missing a step?

1 Like
#17

The github link in str4d’s post (https://github.com/zcash/zcash/pull/3505) has comments from ianamunoz, copy/pasting here -

apt-get update
apt-get upgrade
apt-get install build-essential pkg-config libc6-dev m4 g+±multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget curl bsdmainutils automake
apt-get install g+±aarch64-linux-gnu
git clone https://github.com/str4d/zcash.git
cd zcash/
git checkout -b str4d-rust-targets master
git pull https://github.com/str4d/zcash.git rust-targets
HOST=aarch64-linux-gnu ./zcutil/build.sh -j$(nproc)

The resulting binaries will be in ./src, just copy to wherever you want them (/usr/local/bin works for me).

It barfed the first time I ran it as there was a missing shared object, but once that was installed it worked just fine.

(edit: the forum is mangling the line for installing g++ so check the github post)

3 Likes
#18

Nice, thanks for the details

#19

For me, the last issue was that some libraries used during building step were of a higher version than the ones used on the odroid c2 armbian version. And upgrading armbian to testing upgraded the libraries and solves it …

#20

At block 47926 it looked like it had died & wasn’t updating the terminal, but checking debug.log showed it was still chewing blocks. A couple of minutes later it carried on, got stuck again at block 48109.

Killed the process & started it up again, the init message is ‘Activating best chain’ & that’s something I haven’t seen before. The debug show it working from block 35000. Interesting.

From what syslog says I think its struggling with memory :-

Mar 20 17:28:20 ubuntu kernel: [11894.171483] SLUB: Unable to allocate memory on node -1, gfp=0x14080c0(GFP_KERNEL|__GFP_ZERO)
Mar 20 17:28:20 ubuntu kernel: [11894.171486] cache: kmalloc-256, object size: 256, buffer size: 256, default order: 0, min order: 0
Mar 20 17:28:20 ubuntu kernel: [11894.171490] node 0: slabs: 1196, objs: 19136, free: 0
Mar 20 17:28:20 ubuntu kernel: [11894.175574] mmcqd/0: page allocation failure: order:0, mode:0x14000c0(GFP_KERNEL), nodemask=(null)
Mar 20 17:28:20 ubuntu kernel: [11894.175583] mmcqd/0 cpuset=/ mems_allowed=0
Mar 20 17:28:20 ubuntu kernel: [11894.175598] CPU: 3 PID: 182 Comm: mmcqd/0 Not tainted 4.15.0-1031-raspi2 #33-Ubuntu
Mar 20 17:28:20 ubuntu kernel: [11894.175601] Hardware name: Raspberry Pi 3 Model B Plus Rev 1.3 (DT)
Mar 20 17:28:20 ubuntu kernel: [11894.175606] Call trace:
Mar 20 17:28:20 ubuntu kernel: [11894.175621] dump_backtrace+0x0/0x200
Mar 20 17:28:20 ubuntu kernel: [11894.175626] show_stack+0x24/0x30
Mar 20 17:28:20 ubuntu kernel: [11894.175634] dump_stack+0xbc/0xf4
Mar 20 17:28:20 ubuntu kernel: [11894.175641] warn_alloc+0x108/0x190
Mar 20 17:28:20 ubuntu kernel: [11894.175646] __alloc_pages_nodemask+0xd20/0xe08
Mar 20 17:28:20 ubuntu kernel: [11894.175652] allocate_slab+0x400/0x638
Mar 20 17:28:21 ubuntu kernel: [11894.175656] new_slab+0x64/0xc0
Mar 20 17:28:21 ubuntu kernel: [11894.175660] ___slab_alloc.constprop.36+0x2dc/0x3c8
Mar 20 17:28:21 ubuntu kernel: [11894.175665] __slab_alloc.isra.29.constprop.35+0x4c/0x90
Mar 20 17:28:21 ubuntu kernel: [11894.175669] __kmalloc+0x328/0x360
Mar 20 17:28:21 ubuntu kernel: [11894.175677] bcm2835_dma_create_cb_chain+0x5c/0x258
Mar 20 17:28:21 ubuntu kernel: [11894.175682] bcm2835_dma_prep_slave_sg+0x114/0x2d0
Mar 20 17:28:21 ubuntu kernel: [11894.175688] bcm2835_sdhost_request+0x40c/0x6b0
Mar 20 17:28:21 ubuntu kernel: [11894.175694] __mmc_start_request+0x88/0x1f8
Mar 20 17:28:21 ubuntu kernel: [11894.175697] mmc_start_request+0x7c/0xa0
Mar 20 17:28:21 ubuntu kernel: [11894.175701] mmc_start_areq+0x244/0x388
Mar 20 17:28:21 ubuntu kernel: [11894.175708] mmc_blk_issue_rw_rq+0xd4/0x400
Mar 20 17:28:21 ubuntu kernel: [11894.175712] mmc_blk_issue_rq+0x27c/0x720
Mar 20 17:28:21 ubuntu kernel: [11894.175716] mmc_queue_thread+0xb8/0x150
Mar 20 17:28:21 ubuntu kernel: [11894.175721] kthread+0x134/0x138
Mar 20 17:28:21 ubuntu kernel: [11894.175725] ret_from_fork+0x10/0x1c
Mar 20 17:28:21 ubuntu kernel: [11894.175741] SLUB: Unable to allocate memory on node -1, gfp=0x14080c0(GFP_KERNEL|__GFP_ZERO)
Mar 20 17:28:21 ubuntu kernel: [11894.175746] cache: kmalloc-256, object size: 256, buffer size: 256, default order: 0, min order: 0
Mar 20 17:28:21 ubuntu kernel: [11894.175750] node 0: slabs: 1207, objs: 19312, free: 0