apt-get install g ++-arm-linux-gnueabihf时如何选择gcc版本

时间:2019-03-13 06:24:15

标签: linux ubuntu gcc g++ cross-compiling

我想在Linux上为嵌入式板设置交叉编译环境。我的Linux主机是ubuntu12.04 32bit。

我已经将gcc和g ++更新到4.8,但是当我apt-get install g ++-arm-linux-gnueabihf时,它总是自动获得4.6版本,无法满足我的目标程序的要求。

root@alcht:~# gcc --version
gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
Copyright (C) 2013 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.

root@alcht:~# g++ --version
g++ (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
Copyright (C) 2013 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.

 root@alcht:~# apt-get install g++-arm-linux-gnueabihf
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following extra packages will be installed:
  binutils-arm-linux-gnueabihf cpp-4.6-arm-linux-gnueabihf cpp-arm-linux-gnueabihf g++-4.6-arm-linux-gnueabihf
  gcc-4.6-arm-linux-gnueabihf gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross
  libgcc1-armhf-cross libgomp1-armhf-cross libstdc++6-4.6-dev-armhf-cross libstdc++6-armhf-cross
  linux-libc-dev-armhf-cross
Suggested packages:
  binutils-doc gcc-4.6-locales cpp-doc g++-4.6-multilib-arm-linux-gnueabihf gcc-4.6-doc
  libstdc++6-4.6-dbg-armhf-cross gcc-4.6-multilib-arm-linux-gnueabihf libmudflap0-4.6-dev-armhf-cross
  libgcc1-dbg-armhf-cross libgomp1-dbg-armhf-cross libquadmath-dbg-armhf-cross libmudflap0-dbg-armhf-cross
  binutils-gold autoconf automake1.9 libtool flex bison gdb-arm-linux-gnueabihf gcc-doc
The following NEW packages will be installed:
  binutils-arm-linux-gnueabihf cpp-4.6-arm-linux-gnueabihf cpp-arm-linux-gnueabihf g++-4.6-arm-linux-gnueabihf
  g++-arm-linux-gnueabihf gcc-4.6-arm-linux-gnueabihf gcc-arm-linux-gnueabihf libc6-armhf-cross
  libc6-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross libstdc++6-4.6-dev-armhf-cross
  libstdc++6-armhf-cross linux-libc-dev-armhf-cross

在apt-get install g ++-arm-linux-gnueabihf时如何选择gcc版本?

如果我直接获得g ++ 4.8,则无法找到该包:

root@alcht:~# apt-get install gcc-4.8-arm-linux-gnueabihf
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-4.8-arm-linux-gnueabihf
E: Couldn't find any package by regex 'gcc-4.8-arm-linux-gnueabihf'

我应该更新源列表吗?还是我的gcc依赖项有问题?

0 个答案:

没有答案