zapok
Posts: 6
Joined: Sat Nov 03, 2018 9:02 am

Does not start app on Raspberry Zero cross-compiled in Linux 64

Sat Nov 03, 2018 10:16 am

Hello! I cross-compiled qt application in Linux 64 (Kubuntu 18) for Rasberry (Raspbian 9.4 stretch. Kernel - 4.9.80). Application perform on Raspberry pi 3B+ successfully, but does not perform on Raspberry pi Zero W. Both raspbian startings are from same sd card.

And if I compile same application on Raspberry Pi 3B+, it perform done on Raspberry pi Zero.

Application starting is:
startx qt_app_name


Building qt on Kubuntu is:


git clone git://code.qt.io/qt/qtbase.git -b 5.7

./configure -release -optimized-qmake -no-opengl -device linux-rpi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot /home/zapok/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/zapok/raspi/qt5pi -hostprefix /home/zapok/raspi/qt5 -qpa xcb -no-pch -make libs -make tools -nomake tests -no-use-gold-linker -qt-xcb


There are thoughts why the application compiled on Kubuntu does not start on Raspberry zero, but runs on Raspberry 3B +? And how to fix it ..

Sorry for my english and some terms nonconformance ..

W. H. Heydt
Posts: 10739
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Sat Nov 03, 2018 4:14 pm

The Pi0 is an ARMv6 SoC. It cannot run the Aarch64 instruction set.

zapok
Posts: 6
Joined: Sat Nov 03, 2018 9:02 am

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Sun Nov 04, 2018 6:32 pm

W. H. Heydt wrote:
Sat Nov 03, 2018 4:14 pm
The Pi0 is an ARMv6 SoC. It cannot run the Aarch64 instruction set.
I dont understand you, what do you mean?
I'm not trying to run arch 64 app on Raspberry. I want to run an application compiled in arch 64 using a CROSScompiler on a Raspberry zero. At the same time, I can also run it on the Raspberry pi 3B/ And they have the ARMv6 architecture.

User avatar
HawaiianPi
Posts: 4530
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Sun Nov 04, 2018 7:00 pm

zapok wrote:
Sun Nov 04, 2018 6:32 pm
At the same time, I can also run it on the Raspberry pi 3B/ And they have the ARMv6 architecture.
No, the Pi3B has a 64 bit ARM Cortex-A53 ARMv8 SoC (but it's backwards compatible with ARMv7 and ARMv6)..
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

dave j
Posts: 116
Joined: Mon Mar 05, 2012 2:19 pm

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Sun Nov 04, 2018 8:21 pm

This bit in your ./configure command

Code: Select all

-device linux-rpi3-g++
looks like it's specifying compile for Pi3. You need to find what the value should be for Pi0.

The reason the code works when compiled on your Pi3 it that Raspbian is configured to compile code that is compatible with all Pi versions. You need to tell the compiler on your Kubuntu system to do the same - currently you're telling it to compile for Pi3 only.

W. H. Heydt
Posts: 10739
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Sun Nov 04, 2018 9:02 pm

zapok wrote:
Sun Nov 04, 2018 6:32 pm
W. H. Heydt wrote:
Sat Nov 03, 2018 4:14 pm
The Pi0 is an ARMv6 SoC. It cannot run the Aarch64 instruction set.
I dont understand you, what do you mean?
I'm not trying to run arch 64 app on Raspberry. I want to run an application compiled in arch 64 using a CROSScompiler on a Raspberry zero. At the same time, I can also run it on the Raspberry pi 3B/ And they have the ARMv6 architecture.
AArch64 is the ARM 64-bit instruction set for ARMv8a, used on--among other things--the BCM2837 SoC that is used on the Pi2Bv1.2, Pi3B, Pi3B+, CM3, and CM3L. The Pi0 uses the BCM2835 is a 32-bit only device, using, so far as I know, AArch32 instruction set, as it is an ARMv6 device.

The Pi0 simply doesn't have the 64-bit instruction set, so if you compile for a Pi3B, you will generate code that just won't run on a Pi0. Try compiling for an "rpi1" and see what happens. (The BCM2835 was used on the original Model B and Model A as well as the more recent B+ and A+ models as well as the Pi0, Pi0W, and CM.)

Fundamentally, it is the available instruction set on the chip that matters. Not the ARM core identifier or chip model. This is the same reason we have to keep telling people that x86 programs won't run natively on Pis.

zapok
Posts: 6
Joined: Sat Nov 03, 2018 9:02 am

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Tue Nov 06, 2018 6:43 pm

W. H. Heydt wrote:
Sun Nov 04, 2018 9:02 pm
zapok wrote:
Sun Nov 04, 2018 6:32 pm
W. H. Heydt wrote:
Sat Nov 03, 2018 4:14 pm
The Pi0 is an ARMv6 SoC. It cannot run the Aarch64 instruction set.
I dont understand you, what do you mean?
I'm not trying to run arch 64 app on Raspberry. I want to run an application compiled in arch 64 using a CROSScompiler on a Raspberry zero. At the same time, I can also run it on the Raspberry pi 3B/ And they have the ARMv6 architecture.
AArch64 is the ARM 64-bit instruction set for ARMv8a, used on--among other things--the BCM2837 SoC that is used on the Pi2Bv1.2, Pi3B, Pi3B+, CM3, and CM3L. The Pi0 uses the BCM2835 is a 32-bit only device, using, so far as I know, AArch32 instruction set, as it is an ARMv6 device.

The Pi0 simply doesn't have the 64-bit instruction set, so if you compile for a Pi3B, you will generate code that just won't run on a Pi0. Try compiling for an "rpi1" and see what happens. (The BCM2835 was used on the original Model B and Model A as well as the more recent B+ and A+ models as well as the Pi0, Pi0W, and CM.)

Fundamentally, it is the available instruction set on the chip that matters. Not the ARM core identifier or chip model. This is the same reason we have to keep telling people that x86 programs won't run natively on Pis.
Many thanks for the extended answer!

zapok
Posts: 6
Joined: Sat Nov 03, 2018 9:02 am

Re: Does not start app on Raspberry Zero cross-compiled in Linux 64

Tue Nov 06, 2018 6:47 pm

dave j wrote:
Sun Nov 04, 2018 8:21 pm
This bit in your ./configure command

Code: Select all

-device linux-rpi3-g++
looks like it's specifying compile for Pi3. You need to find what the value should be for Pi0.

The reason the code works when compiled on your Pi3 it that Raspbian is configured to compile code that is compatible with all Pi versions. You need to tell the compiler on your Kubuntu system to do the same - currently you're telling it to compile for Pi3 only.
I had replaced
linux-rpi3-g++
to
linux-rasp-pi-g++
and now all work done! Thank you!

Return to “General discussion”