Skip to content

Conversation

@sedited
Copy link
Contributor

@sedited sedited commented Jul 6, 2018

Some hobbyists are used to using the desktop for interfacing with their raspberry pi. This commits adds qt to the arm-linux-gnueabihf target.

@sedited sedited changed the title Add depends 32-bit arm support for bitcoin-qt [WIP] Add depends 32-bit arm support for bitcoin-qt Jul 6, 2018
Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. Not just Raspberry Pi, also various clones via Armbian.

Fixes the 32-bit part of #13495.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the role of $(qt_packages), especially given that qt_i686_linux_packages doesn't have it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good findings. I could remove all these changes (I had them in while I was debugging things) and it still seems to run fine. Can you re-run a gitian with b86d49f ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference: what's wrong with system-zlib?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go away?

@sedited
Copy link
Contributor Author

sedited commented Jul 6, 2018

The Travis job times out with this change. Not sure how to get it to run through.

@Sjors
Copy link
Member

Sjors commented Jul 6, 2018

I restarted the Travis job, but that doesn't seem to help much.

@Sjors
Copy link
Member

Sjors commented Jul 7, 2018

I'm able to build a binary using Armbian: Sjors/armbian-bitcoin-core#1

However, when I launch QT on an Orange Pi I get:

bitcoin-qt: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIB_2.27` not found (required by bitcoin-qt)

This might be because I compiled on Bionic and the target machine uses Xenial*, with libc6 version 2.23

I'll try again with an Armbian on a Ubuntu 16.04 VM.

  • = because desktop support still doesn't work for that device with Bionic

@sedited
Copy link
Contributor Author

sedited commented Jul 7, 2018

Alternatively you could also apply #13177 and test if it also works for arm.

@Sjors
Copy link
Member

Sjors commented Jul 7, 2018

Cherry-picking that branch did the trick, nice!

@Sjors
Copy link
Member

Sjors commented Jul 7, 2018

I'm also trying a gitian build, but that gets stuck at something that seems pretty unrelated (not even the same architecture):

  CXX      crypto/crypto_libbitcoin_crypto_sse41_a-sha256_sse41.o
  CXX      crypto/crypto_libbitcoin_crypto_avx2_a-sha256_avx2.o
crypto/sha256.cpp: In function ‘std::string SHA256AutoDetect()’:
crypto/sha256.cpp:537:83: error: inconsistent operand constraints in an ‘asm’
   __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
                                                                                   ^
crypto/sha256.cpp:537:83: error: inconsistent operand constraints in an ‘asm’
   __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
                                                                                   ^
make[2]: *** [crypto/crypto_libbitcoin_crypto_base_a-sha256.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/ubuntu/build/bitcoin/distsrc-i686-pc-linux-gnu/src'

@ken2812221
Copy link
Contributor

@Sjors See #13538

@Sjors
Copy link
Member

Sjors commented Jul 7, 2018

@ken2812221 thanks. I just deleted those architectures from the gitian descriptor and tried again.

9c0a172871a27bb727ed27fcdf2f5fd3c6e6b5bc82ea6d7b5745916887a450cb  bitcoin-0.16.99-arm-linux-gnueabihf.tar.gz

Binary works on device as well.

tACK 8ef00e8, assuming Travis gives its blessing

@sedited sedited changed the title [WIP] Add depends 32-bit arm support for bitcoin-qt Add depends 32-bit arm support for bitcoin-qt Jul 9, 2018
@laanwj
Copy link
Member

laanwj commented Jul 9, 2018

my first question when seeing this is: why only 32-bit?—is this already supported for 64-bit, or does 64-bit ARM provide additional challenges?

@sedited
Copy link
Contributor Author

sedited commented Jul 9, 2018

@laanwj see my comment in #13495 on the difficulties I am having with 64bit arm.

@laanwj
Copy link
Member

laanwj commented Jul 10, 2018

@laanwj see my comment in #13495 on the difficulties I am having with 64bit arm.

Fair enough. It's fine, we can do that in a later PR.

Looks like the travis issue is simply a timeout running into the maximum time limit for jobs.

@Sjors
Copy link
Member

Sjors commented Jul 10, 2018

A particularly stubborn Travis timeout. Maybe the ccache needs to be bigger?

Or perhaps cache /home/travis/build/bitcoin/bitcoin/depends/work/build/arm-linux-gnueabihf as an exception to the general rule of not caching build stuff.

@sedited
Copy link
Contributor Author

sedited commented Jul 10, 2018

I'm not sure if your suggestion @Sjors may have unwanted side effects to the Travis jobs. It seems like the linux qt builds are disabled for this reason in the Travis build matrix. Otherwise I'll remove the Travis change from the pr and hope that enough people run it through gitian to verify?

@sedited
Copy link
Contributor Author

sedited commented Jul 10, 2018

Removed the Travis patch. To test this pull request, build it locally.

@Sjors
Copy link
Member

Sjors commented Jul 11, 2018

I restarted the Apple Darwin instance

@laanwj laanwj requested a review from theuni July 11, 2018 18:44
Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this $(host)-g++. Then below, we can copy to qtbase/mkspecs/$(host)-g++, and use sed to replace arm-linux-gnueabi- with $(host)-.

That way subarches (armv6, for example) just work as intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed patch is only intended for adding hard float support. I don't think this should be done for aarch64 as well (which seems to be the only other mkspec that matches the $(host) triplet).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but then we can reuse it for aarch64. All that would be necessary to add it (assuming everything else is working) would be:

$(package)_config_opts_aarch64_linux = -platform linux-g++ -xplatform $(host)-g++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get Invalid target platform 'arm-linux-gnueabihf-g++' when I replace it with $(host)-g++.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me:

diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index b4d7756..c09c02d 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -89,7 +89,7 @@ $(package)_config_opts_linux += -system-freetype
 $(package)_config_opts_linux += -no-feature-sessionmanager
 $(package)_config_opts_linux += -fontconfig
 $(package)_config_opts_linux += -no-opengl
-$(package)_config_opts_arm_linux  = -platform linux-g++ -xplatform $(host)
+$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform $(host)-g++
 $(package)_config_opts_i686_linux  = -xplatform linux-g++-32
 $(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
 $(package)_config_opts_mingw32  = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-"
@@ -128,6 +128,8 @@ define $(package)_preprocess_cmds
   cp -f qtbase/mkspecs/macx-clang/Info.plist.app qtbase/mkspecs/macx-clang-linux/ &&\
   cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
   cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
+  cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/$(host)-g++ && \
+  sed -i s/arm-linux-gnueabi-/$(host)-/g qtbase/mkspecs/$(host)-g++/qmake.conf && \
   patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\
   patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
   patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second chunk could result in undesired behaviour, because you end up copying the arm mkspecs over whatever the $(host)'s mkspecs are supposed to be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Using bitcoin-$(host)-g++ would guarantee that can't happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand how that would work. Can you post another patch for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the spec name doesn't need to change, all that matters is the sed. Simplified:

diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index b4d7756..22cf4f5 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -89,7 +89,7 @@ $(package)_config_opts_linux += -system-freetype
 $(package)_config_opts_linux += -no-feature-sessionmanager
 $(package)_config_opts_linux += -fontconfig
 $(package)_config_opts_linux += -no-opengl
-$(package)_config_opts_arm_linux  = -platform linux-g++ -xplatform $(host)
+$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
 $(package)_config_opts_i686_linux  = -xplatform linux-g++-32
 $(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
 $(package)_config_opts_mingw32  = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-"
@@ -128,6 +128,8 @@ define $(package)_preprocess_cmds
   cp -f qtbase/mkspecs/macx-clang/Info.plist.app qtbase/mkspecs/macx-clang-linux/ &&\
   cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
   cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
+  cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
+  sed -i s/arm-linux-gnueabi-/$(host)-/g qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
   patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\
   patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
   patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\

The effect is that we essentially have a universal linux mkspec now, it just changes the compiler names to match the HOST passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there's no point in making the distinction here, let's just get rid of it.

qt_x86_64_linux_packages can just become qt_linux_packages, then qt_i686_linux_packages and qt_arm_linux_package are no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch does not work yet for aarch64, so I think we should keep it like this until that it is fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the suggested change above will make it so that no change is needed here for aarch64.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substituting qt_x86_64_linux_packages with qt_linux_packages means that qt will be built for all Linux architectures. When I do that and remove the two lines below, a aarch64-linux-gnu depends build will also try to build qt, but will fail as I mentioned in #13495 .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ok, I forgot we purposefully limited that way.

Some hobbyists are used to using the desktop for interfacing with their
raspberry pi. This commits adds qt to the arm-linux-gnueabihf target.
@sedited
Copy link
Contributor Author

sedited commented Jul 11, 2018

Force-pushed to respond to @theuni's review.

@Fuzzbawls
Copy link
Contributor

Concept ACK

aarch64 support can be added later, after the issue with xextproto are dealt with and migration to Bionic for gitian builds is complete.

@Sjors
Copy link
Member

Sjors commented Jul 12, 2018

re-tACK 4b69984 (I retested cross-compile and running on a device, not Gitian)

@Sjors
Copy link
Member

Sjors commented Jul 13, 2018

For some reason make in /depends won't build Qt if you run it on an ARM device (armv7l-unknown-linux-gnueabihf).

Adding qt_armv7l_linux_packages:=$(qt_x86_64_linux_packages) fixes that and it builds a bunch of things, but then I get:

Project ERROR: Unknown module(s) in QT: xml
funcs.mk:242: recipe for target '/home/bitcoin/bitcoin/depends/work/build/armv7l-unknown-linux-gnueabihf/qt/5.9.6-8b61ad4d92c/qtbase/.stamp_configured' failed

If it's complicated, I'm fine with trying this fix this some other time, I'd rather get this in 0.17

@sedited
Copy link
Contributor Author

sedited commented Jul 13, 2018

I get the same xml error when I try to apply @Fuzzbawls patch for aarch64 support.

@sipa
Copy link
Member

sipa commented Jul 14, 2018

@theuni Does your "changes requested" still apply?

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 4b69984

@Sjors
Copy link
Member

Sjors commented Jul 17, 2018

Maybe add "for cross-compilation" to the commit message?

@ken2812221
Copy link
Contributor

utACK 4b69984

@laanwj laanwj merged commit 4b69984 into bitcoin:master Jul 17, 2018
laanwj added a commit that referenced this pull request Jul 17, 2018
4b69984 Add depends 32-bit arm support for bitcoin-qt (Sebastian Kung)

Pull request description:

  Some hobbyists are used to using the desktop for interfacing with their raspberry pi. This commits adds qt to the arm-linux-gnueabihf target.

Tree-SHA512: cb03387267eb8f68dfd79735c2c01c5a119c406e5578805e60b377934da42d46cb34d35e45c8843979dfb4070859c553d09ae348b468d9731523f33307132fa8
@sedited sedited deleted the Qt59arm branch July 17, 2018 20:10
@sedited sedited restored the Qt59arm branch July 17, 2018 20:10
@Sjors
Copy link
Member

Sjors commented Jul 18, 2018

Gitian builds for master are now broken: #13700

cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
sed -i s/arm-linux-gnueabi-/$(host)-/g qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS doesn't like this, see #13750

PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 27, 2020
4b69984 Add depends 32-bit arm support for bitcoin-qt (Sebastian Kung)

Pull request description:

  Some hobbyists are used to using the desktop for interfacing with their raspberry pi. This commits adds qt to the arm-linux-gnueabihf target.

Tree-SHA512: cb03387267eb8f68dfd79735c2c01c5a119c406e5578805e60b377934da42d46cb34d35e45c8843979dfb4070859c553d09ae348b468d9731523f33307132fa8
@hebasto
Copy link
Member

hebasto commented Aug 17, 2020

Please see #18536.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants