11

My proc info:

 lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               158
Model name:          Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
Stepping:            9
CPU MHz:             1036.788
CPU max MHz:         3500,0000
CPU min MHz:         800,0000
BogoMIPS:            6000.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            6144K
NUMA node0 CPU(s):   0-3

I tried:

sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi

If I go for:

arm-linux-gcc
arm-linux-gcc: command not found

How to install cross-compiler?

GAD3R
  • 63,407
  • 31
  • 131
  • 192
MikiBelavista
  • 1,473
  • 8
  • 28
  • 38
  • 7
    According to the [filelist](https://packages.ubuntu.com/bionic/amd64/gcc-arm-linux-gnueabi/filelist), the compiler executable name is `arm-linux-gnueabi-gcc` – steeldriver Apr 02 '19 at 09:36

2 Answers2

22

TLDR

you need to call arm-linux-gnueabi-gcc not arm-linux-gcc.


It looks like you've just got the wrong file name. For reference apt-file is a useful tool.

sudo apt-get install apt-file
sudo apt-file update
apt-file search -x 'gcc$' | grep 'gcc-arm-linux-gnueabi'

This searches any file ending gcc in any package with gcc-arm-linux-gnueabi in the name. The result is:

gcc-arm-linux-gnueabi: /usr/bin/arm-linux-gnueabi-gcc

So if you have installed gcc-arm-linux-gnueabi you should have a file /usr/bin/arm-linux-gnueabi-gcc.

Philip Couling
  • 17,591
  • 5
  • 42
  • 82
  • 5
    Knowing to search for `arm-linux-gnueabi` means knowing the answer already ;-). `apt-file search -x 'arm-linux.*gcc$'` would be more discoverable. – Stephen Kitt Apr 02 '19 at 09:48
  • True. It was in the OP's question under "I tried..." but as you say, if you don't know, good knowledge of regular expressions is also helpful. – Philip Couling Apr 02 '19 at 09:50
  • 1
    My point is that the OP didn’t know what command to run, so couldn’t know what to search for in package contents (as opposed to package names). – Stephen Kitt Apr 02 '19 at 09:51
  • I had no prior knowledge of any of this before attempting to find it myself. The search in my answer is constructed of the package they already installed and `gcc` at the end of the command name - a generalisation of what they were already trying (`arm-linux-gcc`) - It was the first thing I tried.. – Philip Couling Apr 02 '19 at 09:55
  • I guess I just find it surprising to use `apt-file search` to look for a package name (as you put it, “This searches all packages for a file or package containing `arm-linux-gnueabi`”) when `apt-file search` only searches package contents (which also incidentally finds package names, thanks to `/usr/share/doc//copyright`). – Stephen Kitt Apr 02 '19 at 10:56
  • `apt-file search` only matches filenames, not packages; compare for example the output of `apt-file list libevdev-dev` and the output of `apt-file search libevdev-dev`. The `Contents` files which `apt-file` uses look like `file pathpackage name[, package name[...]]`. – Stephen Kitt Apr 02 '19 at 11:12
  • Yeah I just found that, odd, I could have sworn it used to be different. I've edited for a version that works for the right reasons :-) – Philip Couling Apr 02 '19 at 11:14
  • `dpkg -L gcc-arm-linux-gnueabi` would have been more useful to the OP, I think (possibly piped to `grep '/bin/` if the list is long) – steeldriver Apr 02 '19 at 12:17
  • Can u please tell how can I install gcc x86-64 cross compiler. What is the exact name in `apt install xx` command – user786 Aug 29 '21 at 05:19
10

As steeldriver suggests, you already have installed the cross-compiler; the problem is that you’re using the wrong command to invoke it, you need to use the arm-linux-gnueabi- prefix in general. So run

arm-linux-gnueabi-gcc

or

arm-linux-gnueabi-g++

and it should work fine.

To figure this out yourself, you can use dpkg -L to list the contents of the packages you’ve installed:

dpkg -L gcc-arm-linux-gnueabi
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164