查看GCC版本

查看交叉编译器的GCC版本:

hedy@ubuntu:~/u-boot$  arm-poky-linux-gnueabi-gcc -v

查看本地编译器的GCC版本:

hedy@ubuntu:~/u-boot$  gcc -v
hedy@ubuntu:~/u-boot$ which arm-poky-linux-gnueabi-gcc
/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
hedy@ubuntu:~/u-boot$  arm-poky-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-poky-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/lto-wrapper
Target: arm-poky-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-5.3.0-r0/gcc-5.3.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --bindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/com --localstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/var --libdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/hedy/fsl-arm-yocto-bsp/build-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/5.3.0 --with-build-time-tools=/home/hedy/fsl-arm-yocto-bsp/build-fb/tmp/sysroots/x86_64-linux/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/home/hedy/fsl-arm-yocto-bsp/build-fb/tmp/sysroots/imx6qsabreauto --enable-poison-system-directories --with-mpfr=/home/hedy/fsl-arm-yocto-bsp/build-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-mpc=/home/hedy/fsl-arm-yocto-bsp/build-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --enable-nls --with-arch=armv7-a
Thread model: posix
gcc version 5.3.0 (GCC) 
hedy@ubuntu:~/u-boot$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.4' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4) 

gcc 在线文档

https://gcc.gnu.org/onlinedocs/
对照相应的版本去下手册,不然,有些option在低一点的版本找不到.

-ffunction-sections 、-fdata-sections

LDFLAGS_FINAL += --gc-sections
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
		     -fno-common -ffixed-r9

可以参考本文:
https://blog.youkuaiyun.com/pengfei240/article/details/55228228

<think>好的,用户想查看已安装的GCC编译器的版本信息,我需要给出具体的方法。根据提供的引用资料,首先想到的是使用gcc --version命令。引用[4]提到,使用gcc --version可以显示GCC版本信息,这应该是最直接的方法。同时,引用[5]中的脚本也使用了类似的命令来获取版本号,说明这是一个可靠的方法。 另外,用户可能需要在不同的系统环境下操作,比如Linux或者Ubuntu,但无论哪种系统,这个命令都是通用的。引用[2]中的用户提到在Ubuntu中查看gcc版本,用的也是同样的命令,所以这个方法应该适用。 可能用户还关心如何确定GCC支持的C标准版本,比如C99。这时候可以按照引用[4]的建议,使用gcc -std=c99 -E - < /dev/null来检查是否支持C99。虽然用户没有直接问这个,但可能是一个相关的问题,可以考虑在相关问题中提及。 另外,引用[3]提到查看软件是用哪个版本GCC编译的,但用户的问题更基础,只需要当前安装的版本,所以暂时不需要深入这部分内容。综合来看,最直接的回答就是使用gcc --version命令,并附上示例输出。同时,考虑到用户可能需要验证支持的标准,可以补充相关命令作为扩展信息。</think>要检查系统中已安装的GCC编译器版本,可以通过以下步骤操作: 1. **终端命令查询** 在Linux/Unix终端中执行命令: ```bash gcc --version ``` 这会直接显示当前默认GCC编译器的版本信息,例如: ``` gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. ``` 2. **验证C标准支持(如C99)** 若需检查GCC是否支持特定C标准(如C99),可执行: ```bash gcc -std=c99 -E - < /dev/null ``` 若终端无报错,则表示支持该标准[^4]。 3. **多版本共存场景** 当系统中存在多个GCC版本时(如gcc-7和gcc-12),可以通过完整路径查询: ```bash /usr/bin/gcc-7 --version # 指定版本路径查询 ``` 或使用`update-alternatives`工具管理多版本[^2]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值