Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

how to use the cross-compiler in Bullseye

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
jgnoss
Posts: 3
Joined: 2021-09-05 13:32

how to use the cross-compiler in Bullseye

#1 Post by jgnoss »

I'm a bit confused with the packages for the arm cross compiler in bullseye or maybe I screwed something up while installing.

If I remember right, in buster I installed the crossbuild-essential-armhf , binutils-arm-linux-gnueabihf and I was good to go.

giving the right prefix to autotools or whatsoever took the right toolchain and produced wanted binaries.
also I could verify with
arm-linux-<TAB> which of the toolchains I had installed

bullseye does have some more packages addressing cross-compiling and I try to figure out how I have to use them
I've got

Code: Select all


 ii  gcc                                           4:10.2.1-1                      amd64        GNU C compiler
ii  gcc-10                                        10.2.1-6                        amd64        GNU C compiler
ii  gcc-10-arm-linux-gnueabihf                    10.2.1-6cross1                  amd64        GNU C compiler (cross compiler for armhf architecture)
ii  gcc-10-arm-linux-gnueabihf-base:amd64         10.2.1-6cross1                  amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-base:amd64                             10.2.1-6                        amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-cross-base                             10.2.1-6cross1                  all          GCC, the GNU Compiler Collection (library base package)
ii  gcc-10-multilib                               10.2.1-6                        amd64        GNU C compiler (multilib support)
ii  gcc-9-arm-linux-gnueabihf                     9.3.0-22cross1                  amd64        GNU C compiler (cross compiler for armhf architecture)
ii  gcc-9-arm-linux-gnueabihf-base:amd64          9.3.0-22cross1                  amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-9-base:amd64                              9.3.0-22                        amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-9-cross-base 
but I struggle to use them in the way I'm used to do

Which packages should be installed and what's the right way to use them?

thanks Ju

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: how to use the cross-compiler in Bullseye

#2 Post by Aki »

Hello,

Welcome to the forum. This is a really interesting question, indeed. Can you give an example of source code you are trying to cross compile ?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

jgnoss
Posts: 3
Joined: 2021-09-05 13:32

Re: how to use the cross-compiler in Bullseye

#3 Post by jgnoss »

Sorry for late answer

Code: Select all

mav-dev:~/tmp/test$ ls -l /usr/bin/arm-linux-gnueabi*
-rwxr-xr-x 1 root root    31968 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-addr2line
-rwxr-xr-x 1 root root    64648 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-ar
-rwxr-xr-x 1 root root  1089528 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-as
-rwxr-xr-x 1 root root    31424 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-c++filt
-rwxr-xr-x 1 root root  1367024 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-cpp-10
-rwxr-xr-x 1 root root  1248280 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-cpp-9
-rwxr-xr-x 1 root root  2551752 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-dwp
-rwxr-xr-x 1 root root    39904 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-elfedit
-rwxr-xr-x 1 root root  1362928 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcc-10
-rwxr-xr-x 1 root root  1248280 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcc-9
-rwxr-xr-x 1 root root    31216 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcc-ar-10
-rwxr-xr-x 1 root root    31216 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcc-ar-9
-rwxr-xr-x 1 root root    31216 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcc-nm-10
-rwxr-xr-x 1 root root    31216 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcc-nm-9
-rwxr-xr-x 1 root root    31216 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcc-ranlib-10
-rwxr-xr-x 1 root root    31216 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcc-ranlib-9
-rwxr-xr-x 1 root root   700528 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcov-10
-rwxr-xr-x 1 root root   659544 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcov-9
-rwxr-xr-x 1 root root   557064 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcov-dump-10
-rwxr-xr-x 1 root root   524240 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcov-dump-9
-rwxr-xr-x 1 root root   581704 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-gcov-tool-10
-rwxr-xr-x 1 root root   548912 Mar  3  2021 /usr/bin/arm-linux-gnueabihf-gcov-tool-9
-rwxr-xr-x 1 root root    98712 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-gprof
lrwxrwxrwx 1 root root       26 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-ld -> arm-linux-gnueabihf-ld.bfd
-rwxr-xr-x 1 root root   763344 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-ld.bfd
-rwxr-xr-x 1 root root  5088320 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-ld.gold
-rwxr-xr-x 1 root root 21936408 Jan 10  2021 /usr/bin/arm-linux-gnueabihf-lto-dump-10
-rwxr-xr-x 1 root root    49192 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-nm
-rwxr-xr-x 1 root root   187960 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-objcopy
-rwxr-xr-x 1 root root   427968 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-objdump
lrwxrwxrwx 1 root root       34 Aug 25 15:27 /usr/bin/arm-linux-gnueabihf-pkg-config -> /usr/share/pkg-config-crosswrapper
-rwxr-xr-x 1 root root    64680 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-ranlib
-rwxr-xr-x 1 root root   671304 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-readelf
-rwxr-xr-x 1 root root    35808 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-size
-rwxr-xr-x 1 root root    35984 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-strings
-rwxr-xr-x 1 root root   187960 Feb 20  2021 /usr/bin/arm-linux-gnueabihf-strip
Source code hw.c

Code: Select all

#include <stdio.h>

int main(int argc, char **argv) {
	printf("Hello world!\n");
}
mav-dev:~/tmp/test$ arm-linux-gnueabihf-gcc-10 -o hw hw.c

generated executable runs on target.

Source code hw.cxx

Code: Select all

#include <iostream>
#include <bits/gthr-default.h>
using namespace std;

int main() {
	cout << "Hello World !" << endl;
	return 0;
}

mav-dev:~/tmp/test$ arm-linux-gnueabihf-cpp-10 -o hwcc  hw.cxx
arm-linux-gnueabihf-cpp-10: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
compilation terminated.


jgnoss
Posts: 3
Joined: 2021-09-05 13:32

Re: how to use the cross-compiler in Bullseye

#4 Post by jgnoss »

OK, my last post was a stupid attempt, without having my brain switched on.

I had to install g++-10-arm-linux-gnueabihf in order to make the machine compiling c++ code

which worked well, after doing so

the part I have no idea about how to do it right is the -10 suffix
all I remember is that autotools or eclipse is asking for a prefix

I need to dig a bit deeper into that and figure out how to put that suffix on without having to edit all the config-files by hand or creating a bunch of symlinks

Post Reply