5

Right now, while working on my laptop (amd64), I can already compile code through SSH on a BeagleBone (armhf).

What I'm trying to do now, is being able to use any IDE to debug that code (Code::Blocks, KDevelop, or Qt Creator).

So, I thought of running gdbserver on the BeagleBone, and connecting to it, but it gives me an error of unexpected value on reply. I read about it, and it seems I need to locally build an armhf executable, for gdb to process. But I guess it also needs an armhf-oriented gdb built for amd64, so I tried installing crossbuild-essential-armhf. For that, I added the armhf architecture with dpkg --add-architecture armhf, but then I'm unable to do an apt-get update. I get a whole lot of these:

Err http://security.ubuntu.com trusty-security/main armhf Packages             
  404  Not Found [IP: 2001:67c:1562::13 80]

If I check the repos, they indeed do not have armhf anywhere.

So, what am I doing wrong? Also, is this the correct way to remote debug with a different architecture, or is there any better way to do it?

3 Answers 3

14

Ubuntu uses separate repos for armh (i.e. http://ports.ubuntu.com/). To be able to install crossbuild-essential-armhf successfully you have to follow these steps:

  1. run dpkg --add-architecture armhf

  2. specify the correct architecture for ALL your apt deb lines in /etc/apt/sources.list and /etc/apt/sources.list.d, for example:

    deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu trusty main universe
    deb [arch=armhf] http://ports.ubuntu.com/ trusty main universe
    

Note that it does not make sense to specify the arch for deb-src lines. 3. run apt-get update 4. run apt-get install crossbuild-essential-armhf

Have a look at https://wiki.debian.org/Multiarch/HOWTO

You may also want to execute these commands in a chroot (or docker container maybe) as mentioned by this guide: Getting Started with MultiArch (armel / armhf) in Ubuntu

1

There is a rich choice of Docker based cross compilers here :

https://github.com/dockcross/dockcross

0

It isn't necessary to add armhf to the build host's dpkg sources. Another approach is to use a chroot which can be populated using debootstrap or from a beagleboard.org image.

For a thorough guide on C++ cross-compilation with remote GDB symbolic debugging with VS Code see:

https://takeofftechnical.com/x-compile-cpp-bbb

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .