RandomX ARM64 (aarch64) cross compile fails
#202
Closed
opened 2 years ago by jahway603
·
22 comments
No Branch/Tag Specified
arm
asyncnotedecryption
danger
dev
dev-aarch64
dev-mac
dev-old-randomx
divzaddrs
dragonx
duke
freebsd
getfilterednotes
hip39
insync
jahway603
master
mvstuff
onryo
p2p_privacy
ramhash
relaytx
rx-largepages
setbestchain
warmup
witness_cache
wolfssl
wolfssl_win
z_createrawtransaction
z_importwallet
z_signmessage
v0.11.2.z0
v0.11.2.z1
v0.11.2.z2
v0.11.2.z3
v0.11.2.z4
v0.11.2.z5
v0.11.2.z6
v0.11.2.z7
v0.11.2.z8
v0.11.2.z9
v1.0.0
v1.0.0-beta1
v1.0.0-beta2
v1.0.0-rc1
v1.0.0-rc2
v1.0.0-rc3
v1.0.0-rc4
v1.0.1
v1.0.10
v1.0.10-1
v1.0.11
v1.0.11-rc1
v1.0.12
v1.0.12-rc1
v1.0.13
v1.0.13-rc1
v1.0.13-rc2
v1.0.14
v1.0.14-rc1
v1.0.15
v1.0.15-rc1
v1.0.2
v1.0.3
v1.0.4
v1.0.5
v1.0.6
v1.0.7-1
v1.0.8
v1.0.8-1
v1.0.9
v1.1.0
v1.1.0-rc1
v1.1.1
v1.1.1-rc1
v1.1.1-rc2
v1.1.2
v1.1.2-rc1
v2.0.0
v2.0.0-rc1
v2.0.1
v3.0.0
v3.1.0
v3.1.1
v3.10.0
v3.10.1
v3.10.2
v3.2.0
v3.2.1
v3.2.1-alpha
v3.2.1-beta
v3.2.2
v3.2.3
v3.3.0
v3.3.1
v3.3.2
v3.4.0
v3.4.1
v3.5.0
v3.5.1
v3.5.2
v3.6.0
v3.6.1
v3.6.2
v3.6.3
v3.7.0
v3.7.1
v3.8.0
v3.9.0
v3.9.1
v3.9.2
v3.9.3
v3.9.4
Labels
bounty up to 500 HUSH 2001-5000 bounty
bounty between 2001 and 5000 HUSH 501-2000 bounty
bounty between 501 and 2000 HUSH arm
something doesn't work on arm beginners
for new developers bug
may or may not be a bug build
problems building documentation
not enough information feature
new feature high priority
high priority i2p
related to i2p low priority
low priority medium priority
medium priority question
something is not clear release
release label or issue related to it testing
related to testing tor
related to tor wontfix
this won't be fixed
Apply labels
Clear labels
0-500 bounty
bounty up to 500 HUSH 2001-5000 bounty
bounty between 2001 and 5000 HUSH 501-2000 bounty
bounty between 501 and 2000 HUSH arm
something doesn't work on arm beginners
for new developers bug
may or may not be a bug build
problems building documentation
not enough information feature
new feature high priority
high priority i2p
related to i2p low priority
low priority medium priority
medium priority question
something is not clear release
release label or issue related to it testing
related to testing tor
related to tor wontfix
this won't be fixed
No Label
0-500 bounty
2001-5000 bounty
501-2000 bounty
arm
beginners
bug
build
documentation
feature
high priority
i2p
low priority
medium priority
question
release
testing
tor
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
3 Participants
Assign users
Clear assignees
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This issue currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch '%!s(MISSING)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
While testing the build on the dev branch on ARM64 (aarch64), by cross compiling on x86 in Docker, I can not get it to build (as it would before randomx)... it bombs out with RandomX stuff. I added a check to the build-arm.sh script for cmake & it is installed on this container.
Excerpt from the log
@jahway603 can you send the build-arm.sh cmake code changes as a PR or just commit directly to dev branch?
As for the above error, it feels like we need a similar change to how @fekt fixed how cmake is used in Windows. It seems that the build system code I wrote for cmake works fine in a normal build, but needs extra help when doing a cross compile. The rest of the build system passes around various variables to make cross-compiles work, but I never tested cross compiles with cmake.
The above error is a link-time error, not a compile time error.
This looks relevant: https://stackoverflow.com/questions/23185341/relocations-in-generic-elf-em-40
@jahway603 I added randomx to build-arm.sh to dev branch, along with the kind of fix that @fekt did to fix windows cross-compiles, please test that. If you have uncommitted changes to build-arm.sh in your git repo, you can type "git stash" to locally save those somewhere and give you a "clean slate" to do a "git pull" on
Note Have successfully tested hush v3.9.1 & It does cross-compile successfully for ARM64 (on a Linux Intel/AMD64-based system) using the instructions linked in the OP.
new note
I was not able to compile 3.9.1 release (or current dev branch) natively on a Rasp Pi4 ARM64 because ARM does not have the
g++-multilib
library available on its architecture. Only working way to build these is via cross-compiling.@jahway603 is the current failure in compiling 3.9.2 the same as before? The build script has changed since you made this issue
I noticed the build-arm.sh doesn't have the same configuration. These instructions worked for me before the changes: https://git.hush.is/oDinZu/docs/src/branch/master/advanced/cross-compile-hush-full-node-to-aarch64-with-docker.md
This worked for me before:
HOST=aarch64-linux-gnu
The extra deps I installed were:
libboost-dev, libdb++-dev, libwolssl-dev and g++-aarch64-linux-gnu
my docker container was:
debian:bullseye
Also, duke said:
randomx requires cmake, and now the Hush build requires make and cmake. The current issues are related to the new randomx/cmake stuff not passing along the right config options
I don't think this should block 3.9.2 so I am removing it from the 3.9.2 milestone
With hushd 3.9.3 on the way - any ideas on how to get this working on ARM64 (aarch64)?
@jahway603 have you tested with the latest code? There have been some build system changes mentioning armv8 and arm64
@duke will test latest dev branch, but I believe it's still failing due to the RandomX code
@jahway603 The high level problem is likely that "the build scripts do not pass along important things to cmake of RandomX, such as cross-compile options/etc" but as to the exact problem, I am not sure
@jahway603 one way to debug might be to see if you can correctly compile/cross-compile RandomX in the src/RandomX subdir, and then when you find the correct options/etc, we can make the build scripts pass those along. Are you able to compile src/RandomX subdir ?
It bails, spams the first line below a ton and then bombs with the following (as it also did in the original issue post)
I saved all the stdout (2.1MB txt file) if you need to look at that or if I should attach it here.
This is holding back users of the HushBox and anyone else that decides they want to use hushd on a single board computer with ARM CPU. Unsure of what needs to happen here to work on this as my expertise is an ARM user.
Building on the ARM CPU requires g++-multilib & gcc-multilib to be available on ARM & these wishlist bugs have been opened with the Debian project here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033145
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033146
For now, getting this to compile in Docker on x86_64 for ARM is what needs to happen. The instructions to do this last worked on hushd 3.9.1 before the RandomX code was introducted.
@jahway603 if you want to work on this together in a pairing session, I am up for it
@jahway603 we will need a mandatory update release soon and if this is not figured out by then, no ARM devices will be able to connect to the network. If you want to work on this together, let me know
@jahway603 try the
arm
branch and let us know how it goes.Make sure it uses a fresh clone or manually delete the already built librandomx.a :
@duke tried arm branch & having the same issue originally reported, which it spams
/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: RandomX/build/librandomx.a(randomx.cpp.o): Relocations in generic ELF (EM: 62)
It's a fresh docker container with a fresh clone.
@jahway603 I think at this point the best thing to do is to create an issue on https://github.com/tevador/RandomX and explain to them that we are using RandomX in a production mainnet, everything works fine on x86, but we run into this linking error on aarch64 and ask them exactly what flags to
cmake
need to be given to make it cross-compile correctly.Created RandomX Issue #264 asking "Exactly what flags to cmake need to be given to make it cross-compile correctly for aarch64 (ARM64) architecture?"
RandomX dev's advice was helpful and worked.
Script to cross-compile hushd for ARM64 (aarch64) is here
Documentation on how to cross-compile hushd for ARM64 (aarch64) is here
Built fine on dev branch and now building master branch to release a hush 3.9.3 deb for ARM 💯
We now have a HSC-compatible hushd for ARM
hush-3.9.3-aarch64.deb
is now live in 3.9.3 release