cross-compile Qt for beaglebone black

@benedict.hewson
i may be missing something in his instructions. the first go around, the gui_analogclock ran on the host. but i could not get it to compile for the BBB on the host.
So i started a clean setup with his instructions, now i can’t get it to build Qt. so clearly I’m missing some thing. might try it again this weekend. i’m working with a VB Debian install that used for some BeagleV work, might need to install a clean OS and try again.

Based on responses to commands below. A different image maybe required? Which image is best for running Qt that has been cross-compiled?

debian@BeagleBone:~$ ./testcross
./testcross: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34’ not found (required by ./testcross)

debian@BeagleBone:~$ ldd --version
ldd (Debian GLIBC 2.31-13+deb11u11) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

debian@BeagleBone:~$ sudo apt list upgradeable glibc
Listing… Done

debian@BeagleBone:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

@bigguiness ,

Hey…are you still looking to handle the cross-build of armhf via cmake or another tool?

Seth

P.S. The reason I ask:

  • iat is a tool
  • dd is another tool
  • mkisofs is another tool

So, from what I gather with cmake…

  • Make the .img file a .iso file if possible (in the process right now)
  • I am currently trying with iat
  • Then, mount and do something like this (hopefully)/(answers) on the way…
sudo mkdir /mnt/iso
sudo mount -o loop /path/to/iso /mnt/iso
sudo cp -r /mnt/iso/* /path/to/rootfs/

I am using WSL2 now. Which will most likely fail miserably but heh? I can try…

This is what I am falling for now: Hopefully it works. I will have to see…

dang it…

It is way more complicated than I figured. I am sorry. I will keep trying.

Seth

@silver2row ,

Yes, I still would like to now a way to cross-compile an app for the BeagleBone.

Ideally, I would like to do the cross-compile from a Windows 11 host. But, if I could do it from a Linux host that would be great.

I actually have two applications I am interested in cross-compiling.

The fist one runs on a BeagleBone that has a real old BeagleBoard Debian image:

$ cat /etc/image
Debian GNU/Linux 7 \n \l

BeagleBoard.org Debian Image 2016-06-15
$ uname -a
Linux ***** 3.8.13-bone80 #1 SMP Wed Jun 15 17:03:55 UTC 2016 armv7l GNU/Linux

That app runs from a console (no GUI) and uses SDL1.2, a touchscreen, and some PRU stuff. It’s built using Automake not cmake.

SDL1.2 and touchscreen support seems to be a bit broken in newer images. So updating it to a newer image has been very difficult. I’m happy just using the old image.

The second app runs on a later (but still old) BeagleBoard. Debian image:

$ cat /etc/image
Debian GNU/Linux 9.13 \n \l

BeagleBoard.org Debian Image 2018-01-21
$ uname -a
Linux ***** 4.9.105-ti-r114 #1 SMP PREEMPT Fri Aug 17 11:05:53 UTC 2018 armv7l GNU/Linux

That app also runs from a console and uses Qt 5.7.1 and a touchscreen. It’s built using qmake not cmake.

I could probably update that app to use a newer image with a different version of Qt.

This app is also build on my Windows 11 host for use on Windows.

My current development/build process for the BeagleBone is:

  • Edit the source on my Windows 11 host
  • Commit changes to my git repo
  • Pull the updated repo on the appropriate BeagleBone system
  • Build the code on the BeagleBone system

This works and is not too painful with the SDL1.2 app. The build is fairly quick it’s just annoying.

But the Qt build takes quite a while on the BeagleBone. The Windows build only takes a couple minutes, but the BeageBone build takes more than an hour.

Hartley

i just tried again for a week, seems to fail for one thing or another.
tried on ubuntu 20.04, 22.04, 24.04 version with qt6.0, 6.4, 6.9
failure always happens when doing the BBB cross compile build
so it’s back on the back burner again.

Oh… qmake.

I am unfamiliar with this effort. I have been trying with cmake.

From what I understand…

  1. install the .iso if available or translate the .img to .iso
  2. Debian has an armhf .iso available which is what I have been trying
  3. mount it and then copy the mounted .iso to the path of the rootfs

I tried some ideas yesterday to no avail. iat does not work with the .img file from beagleboard.org.

Something about a signature or it not being a normal .img file.

So, I went to the Debian repos to install a base debian (armhf) .iso to test.

I am dealing with cmake discourse right now and not getting anywhere so far. I think I am close but we shall see. I will update you.

Seth

maybe some miss understanding. cmake to build qt, qtmake to build a qt application.

1 Like

Yea. I understood too late.

Sorry man,

I totally misunderstood what you needed years and years ago and still I am misunderstanding.

Sorry…okay.

I was researching some older files:

I am guessing qmake, gmake, make, cmake, and so on are somewhat similar…

So,

# gcc and g++ should be directly callable which can be done by prependeding them onto your PATH environment variable.
# The compiler should be able to infer the location of any libraries and include files which are reasonably included as part of a toolchain package.
# This means that to link against a library such as librt.a you can add it directly as a library to link against and the compiler will find it.

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "armv7hf")

# Specify the cross compiler
set(CROSS_COMPILE "/home/garfelds/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-10.2.1")

set(CMAKE_C_COMPILER   	"${CROSS_COMPILE}gcc")
set(CMAKE_CXX_COMPILER 	"${CROSS_COMPILE}g++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfloat-abi=hard" CACHE STRING "")
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -march=armv7-a -mfloat-abi=hard" CACHE STRING "")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -march=armv7-a -mfloat-abi=hard" CACHE STRING "")

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

That is a very old model of cmake building for the BBB. It might just work similarly for you in qmake. Although, I need to update my use case now (totally ruined my build environment and repo in the process of leaning to use that link I posted)…

That link: https://earthly.dev/blog/cmake-gcc-cross-compile/

It must not be good for my particular stage in development. So, I would advise against using it.

Or, maybe I just ruined what I started by default thinking things on the Internet may work.

Seth

P.S. Hartley, I hope that text in the .cmake toolchain file serves you well. I am going to test it against some other builds I have currently.

update here…

So, I am getting closer but…

  1. The cross-compiler is gnu or gcc and not g++.
  2. Where in the world is the g++ version of gnu gcc?

another update

Build it…

Seriously, Hartley, use Debian and the versioning of gnu-gcc (12.4 or before should work if you are using 12.4 or before on the BBB) to build the required packages.

There is way more to go into it outside of this chat. Maybe get on discord under #random or something and we can chat about it more. I will try to find you there one day. I am Seth_ on discord.

Enjoy…testing will ensue.

Building a cross compiler

get the source code via git.

   get gcc sources
   extract into gccsrcdir
   mkdir gccbuilddir
   cd gccbuilddir
   gccsrcdir/configure --prefix=destdir --other-opts...
   make
   make check
   make install

That is the gist of it all…

There is more to it than I can ever explain. Big project. Also, it is a computer death ray.

It will eat up memory, bandwidth, and hurt a processor(s). I have been building for three hours on a pretty fast system and I did it wrong. So, I will need to ./configure again and re-make everything. Blah…

With the right one liners and --disable-Whatever_Is_Available in the mix of one liners, you can build a pretty lean system.

Now, am I scared of it. Yes, it is a very large file project and it has taken most of my night away from me. Anyway, I am building on WSL2 and Debian GNU/Linux too.

We shall see…

Seth

P.S. If this allows me to cross-compile correctly with the right credentials and tools, good. If not, onto another idea. Dang it…

I tested it. Also: https://gcc.gnu.org/install/build.html

I am trying under the header for Building a cross compiler on the above build link.

This should help but who knows. I cannot get multilib support just yet. Probably never but I can try…

why not install g+±arm-linux-gnueabihf gcc-arm-linux-gnueabihf
maybe i’m missing something of what you need

1 Like

I can try I guess…

I am not sure where to turn or how to handle this situation just yet. So, I am playing low key.

Seth