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: Add RISC-V support #13543
depends: Add RISC-V support #13543
Conversation
@laanwj Have you been building with I've just tested a
Building with I wonder if there's a less verbose patch we could et away with to fix the zeromq build? |
Thanks for testing. Good point: yes, I have built without Qt, same as we do for ARM. Should probably mention that in the documentation, though I don't think there's any RISC-V boards at this time with a capable enough GPU and HDMI/VGA out to run even a desktop GUI (though maybe it's possible to connect one through the PCI-e slot? I don't know).
I'm sure it could be cut down to less lines if that's really worthwhile, I might personally prefer the dumb solution of simply copying the new autoconf files though. |
I can test this on a HiFiveU board next week. The problem with running a full bitcoin main net instance on a physical riscv board is going to be I/O. In the meantime, try running in Qemu as it will probably have better I/O |
Running
Good idea. I did this for the big-endian support, so it should certainly work for little-endian RISC-V. |
https://www.crowdsupply.com/microsemi/hifive-unleashed-expansion-board It runs X with a radeon graphics card and has more cores/memory/performance than the first machine I compiled bitcoin on. Bitcoin ATM vendors looking at high volume, low-cost embedded systems should probably be spending money on some evaluation systems. |
This is interesting:
Nice. I should get that one too. |
@laanwj That's very strange. It should be using the pure C++ SHA256 implementation. What SHA256 implementation does debug.log report (if you get that far)? |
It chooses the correct one:
I'll dive into what happens here. |
It looks like the beginning of input for (int j = 0; j < i; ++j) {
CHash256().Write(in + 64 * j, 64).Finalize(out1 + 32 * j);
} The function itself works correctly. I'm suspecting a miscompilation issue at the moment. It happens with I'd expect a newer toolchain will solve this, but if so it means the Ubuntu stock one (Ubuntu 7.3.0-16ubuntu3) is effectively broken that's a disappointment. |
My sync in qemu is at block 270000, and has encountered no issues. I haven't figured out yet why the |
I attempted to make a test case, and simplified the following down:
however this does not fail, so I'm now highly suspicious of inlining |
I can confirm the failure with gcc-7.3.1 on fedora on a HiFive Unleashed as well as gcc-7.3.0 on debian in qemu-user-mode emulation. Testcase at https://github.com/tmagik/riscv-sha256d-inline-fail/ |
@laanwj Debian's gcc-8 appears to fix the problem
|
@tmagic Thanks for reproducing. Happy to hear it's solved with newer gcc. It might be better to remove the note about using ubuntu's cross-toolchain packages, then, until they have gcc 8 like debian. |
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, suggested changes would be a bonus if they work.
depends/packages/zeromq.mk
Outdated
@@ -3,7 +3,7 @@ $(package)_version=4.2.3 | |||
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/ | |||
$(package)_file_name=$(package)-$($(package)_version).tar.gz | |||
$(package)_sha256_hash=8f1e2b2aade4dbfde98d82366d61baef2f62e812530160d2e6d0a5bb24e40bc0 | |||
$(package)_patches=0001-fix-build-with-older-mingw64.patch 0002-disable-pthread_set_name_np.patch | |||
$(package)_patches=0001-fix-build-with-older-mingw64.patch 0002-disable-pthread_set_name_np.patch 0003-new_configure.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we copy our files instead, since we have to keep ours up to date anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some commits to a branch that attempt to do that: https://github.com/fanquake/bitcoin/tree/riscv-depends-no-zmq-patching. It also updates the depends config.guess/sub to latest upstream.
@laanwj You can cherry pick from there if you'd like. Note that branch doesn't include re-running ./autogen.sh
like below. I'll comment about that shortly.
depends/packages/zeromq.mk
Outdated
patch -p1 < $($(package)_patch_dir)/0002-disable-pthread_set_name_np.patch | ||
patch -p1 < $($(package)_patch_dir)/0002-disable-pthread_set_name_np.patch && \ | ||
patch -p1 < $($(package)_patch_dir)/0003-new_configure.patch && \ | ||
./autogen.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it definitely necessary to re-run autogen.sh? Afaik configure just calls out to config.guess/config.sub. Unless there's some weird globbing involved, I should think that replacing those files would be enough.
I've done some more testing of this using a branch that doesn't patch zmq's config.guess/sub, and instead just copies over our local versions, which I've updated from upstream. re running
The other difference (at least in output) is:
Without
Also noticed that when I pass
All my testing has been done on Ubuntu 18.04. |
bab9f4e
to
974f0bf
Compare
Updated branch:
|
utACK 974f0bf. |
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until #12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb
Summary: This is extracted from [[bitcoin/bitcoin#13543 | PR13543]]: bitcoin/bitcoin@d7005e9 bitcoin/bitcoin@409481c The diff is large but had no merge conflict. This diff is required to avoid later merge conflicts. Partial backport of core [[bitcoin/bitcoin#13543 | PR13543]]. Test Plan: Run the Gitian builds. Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5653
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until bitcoin#12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb (cherry picked from commit 6c6a300) # Conflicts: # depends/Makefile
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until bitcoin#12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb (cherry picked from commit 6c6a300) # Conflicts: # depends/Makefile
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until bitcoin#12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb (cherry picked from commit 6c6a300) # Conflicts: # depends/Makefile
Summary: This is extracted from [[bitcoin/bitcoin#13543 | PR13543]]: bitcoin/bitcoin@d7005e9 bitcoin/bitcoin@409481c The diff is large but had no merge conflict. This diff is required to avoid later merge conflicts. Partial backport of core [[bitcoin/bitcoin#13543 | PR13543]]. Test Plan: Run the Gitian builds. Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5653
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until bitcoin#12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb (cherry picked from commit 6c6a300) # Conflicts: # depends/Makefile
974f0bf depends: Mention RISC-V known compilation issue with gcc-7.3.x (Wladimir J. van der Laan) 0d1f38c depends: update zmq config.guess/config.sub for riscv support (fanquake) 409481c depends: latest config.sub (fanquake) d7005e9 depends: latest config.guess (fanquake) 359e2e3 depends: Add RISC-V support (Wladimir J. van der Laan) Pull request description: This adds support for riscv32 and riscv64 builds to the depends system. The change consists of documentation and build system changes. The most significant change is an update of `config.sub` and `config.guess` inside zeromq patch, as the current version does not recognize the `riscv*` host tuples (there's no new version of ZeroMQ yet with newer ones). Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+. I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until bitcoin#12511 . Tree-SHA512: 358ed72ee9e4ae44e7d305c09a4ff5ce5460eeb7ed915eb25d39c8f43b61e7b347f51bf0ae5d83ddb4ce8876dea7703c926b3baa3cccb4932b3bc17160d801bb (cherry picked from commit 6c6a300) # Conflicts: # depends/Makefile
This adds support for riscv32 and riscv64 builds to the depends system.
The change consists of documentation and build system changes. The most significant change is an update of
config.sub
andconfig.guess
inside zeromq patch, as the current version does not recognize theriscv*
host tuples (there's no new version of ZeroMQ yet with newer ones).Good thing: RISC-V 64-bit toolchain packages can be installed out of the box on Ubuntu 18.04+.
I would also like to add RISC-V 64-bit executables to gitian, but this will not be possible until #12511 .