Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depends: Support additional cross-compilation targets in Rust #3505

Merged
merged 6 commits into from Apr 23, 2019

Conversation

@str4d
Copy link
Contributor

commented Aug 31, 2018

This will make it easier for third parties to cross-compile zcashd for other platforms. The third commit in this PR shows how to add a new target to the Rust dependency builder.

The default Rust target during cross-compilation is the canonical host, which is derived from HOST using depends/config.sub. If the canonical host differs from the required Rust target, add the necessary mapping in addition to the target itself.

Also includes fixes for cross-compiling aarch64 targets.

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Aug 31, 2018

@str4d str4d added this to Review Backlog in Arborist Team Aug 31, 2018

@str4d str4d requested review from bitcartel and Eirik0 Oct 24, 2018

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Oct 27, 2018

☔️ The latest upstream changes (presumably #3633) made this pull request unmergeable. Please resolve the merge conflicts.

@str4d str4d force-pushed the str4d:rust-targets branch from a62cf4c to fca4fbf Nov 16, 2018

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Nov 16, 2018

Rebased on master to fix merge conflict.

@str4d str4d moved this from Review Backlog to In Review in Arborist Team Nov 16, 2018

@str4d str4d moved this from In Review to Review Backlog in Arborist Team Nov 16, 2018

@Eirik0 Eirik0 moved this from Review Backlog to In Review in Arborist Team Dec 18, 2018

@mms710 mms710 moved this from In Review to Review Backlog in Arborist Team Dec 20, 2018

@mms710 mms710 moved this from Review Backlog to Current Sprint in Arborist Team Dec 20, 2018

@mms710 mms710 moved this from Current Sprint to PRs That Need Review + Their Associated Issues in Arborist Team Dec 20, 2018

@mms710 mms710 added the PR_cleanup label Dec 20, 2018

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Feb 15, 2019

☔️ The latest upstream changes (presumably #3809) made this pull request unmergeable. Please resolve the merge conflicts.

str4d added some commits Jun 24, 2018

depends: Use full path to cargo binary
The native binaries generated in the depends system are available on the path,
but system binaries are still visible. This change ensures we use cargo from
the depends system rather than whatever might be installed locally.
depends: Add rust-std hash for aarch64-unknown-linux-gnu
Usage on Debian / Ubuntu:

> $ sudo apt install g++-aarch64-linux-gnu
> $ HOST=aarch64-linux-gnu ./zcutil/build.sh

Currently fails to cross-compile due to later configuration issues in
the depends system that need to be worked around.

@str4d str4d force-pushed the str4d:rust-targets branch from fca4fbf to d2cd57c Mar 13, 2019

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Rebased on master to fix merge conflicts.

str4d added some commits Mar 13, 2019

depends: Compile bdb with --disable-atomics on aarch64
This sidesteps the problem where the atomics check tries to run a test
binary, which cannot be performed during cross compilation. We should
replace this with a better solution in future.

Part of #3710.
configure: Guess -march for libsnark OPTFLAGS instead of hard-coding
When cross-compiling, this will remove the -march flag entirely unless
the user specifies CONFIGURE_FLAGS="--with-gcc-arch=<arch>".
@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Pushed fixes for cross-compiling aarch64. Cross-compilation runs to completion for me now.

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Let's check that this hasn't broken anything...

@zkbot try

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Mar 13, 2019

⌛️ Trying commit 98cfe42 with merge 6d31bac...

zkbot added a commit that referenced this pull request Mar 13, 2019

Auto merge of #3505 - str4d:rust-targets, r=<try>
depends: Support additional cross-compilation targets in Rust

This will make it easier for third parties to cross-compile `zcashd` for other platforms. The third commit in this PR shows how to add a new target to the Rust dependency builder.

The default Rust target during cross-compilation is the canonical host, which is derived from `HOST` using `depends/config.sub`. If the canonical host differs from the required Rust target, add the necessary mapping in addition to the target itself.

Also includes fixes for cross-compiling aarch64 targets.
@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Mar 13, 2019

☀️ Test successful - pr-try
State: approved= try=True

@mdr0id mdr0id self-requested a review Mar 14, 2019

@mdr0id

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2019

I was able to compile this, but was not able to test further due to SBC limitations ATM.

@ianamunoz

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2019

So I ran this build like so:

$docker run -it --rm -v /tmp:/tmp debian:latest
root@e31e6312207f:~/zcash# apt-get update
root@e31e6312207f:~/zcash# apt-get upgrade
root@e31e6312207f:~/zcash# 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
root@e31e6312207f:~/zcash# apt-get install g++-aarch64-linux-gnu
root@e31e6312207f:~/zcash# git clone https://github.com/str4d/zcash.git
root@e31e6312207f:~/zcash# cd zcash/
root@e31e6312207f:~/zcash# git checkout -b str4d-rust-targets master
root@e31e6312207f:~/zcash# git pull https://github.com/str4d/zcash.git rust-targets
root@e31e6312207f:~/zcash# HOST=aarch64-linux-gnu ./zcutil/build.sh -j$(nproc)
root@e31e6312207f:~/zcash# mkdir /tmp/aarch64-zcash/
root@e31e6312207f:~/zcash# cp ./src/zcash-cli ./src/zcashd ./src/zcash-tx ./src/zcash-gtest ./zcutil/fetch-params.sh /tmp/aarch64-zcash/

Copied the binaries up to a Scaleway x6 core ARM. Fetched the params.
Currently syncing and appears to run normally on:

# uname -a
Linux builder 4.9.93-mainline-rev1 #1 SMP Tue Apr 10 09:54:46 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux

Will run smoke tests to see if I can flush out any bugs.

@daira

daira approved these changes Apr 7, 2019

Copy link
Contributor

left a comment

utACK. As noted at #2827 (comment) this adds files that are under the GPLv3-or-later with "Autoconf licence exception", but we can address that as part of #2827.

@daira daira referenced this pull request Apr 7, 2019

Open

Update license info #3944

@mdr0id

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2019

utACK, per comment above but otherwise appears GTM

@mdr0id

mdr0id approved these changes Apr 23, 2019

Copy link
Contributor

left a comment

utACK

@str4d str4d added this to the v2.0.5 milestone Apr 23, 2019

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2019

@zkbot r+

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Apr 23, 2019

📌 Commit 98cfe42 has been approved by str4d

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Apr 23, 2019

⌛️ Testing commit 98cfe42 with merge ab85629...

zkbot added a commit that referenced this pull request Apr 23, 2019

Auto merge of #3505 - str4d:rust-targets, r=str4d
depends: Support additional cross-compilation targets in Rust

This will make it easier for third parties to cross-compile `zcashd` for other platforms. The third commit in this PR shows how to add a new target to the Rust dependency builder.

The default Rust target during cross-compilation is the canonical host, which is derived from `HOST` using `depends/config.sub`. If the canonical host differs from the required Rust target, add the necessary mapping in addition to the target itself.

Also includes fixes for cross-compiling aarch64 targets.

@str4d str4d moved this from PRs That Need Review + Their Associated Issues to Merge Queue in Arborist Team Apr 23, 2019

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Apr 23, 2019

☀️ Test successful - pr-merge
Approved by: str4d
Pushing ab85629 to master...

@zkbot zkbot merged commit 98cfe42 into zcash:master Apr 23, 2019

1 check passed

homu Test successful
Details

Arborist Team automation moved this from Merge Queue to Released (Merged in Master) Apr 23, 2019

@str4d str4d deleted the str4d:rust-targets branch Apr 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.