Gcc: Error: Unrecognized Command Line Option

Gcc: Error: Unrecognized Command Line Option

I'm trying create an u-boot image file. But have i have some error.

gcc version: 7.3.0

make PATH=/opt/CodeSourcery/Sourcery_G++_Lite/arm-2011.03-41-arm-none-linux-gnueabi:$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-(or arm-none-linux-gnueabi)
make ARCH=arm xilinx_zynq_defconfig
make -j ARCH=arm UIMAGE_LOADADDR=0x8000 uImage

ERROR:

gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
gcc: error: unrecognized command line option ‘-mlittle-endian’; did you mean ‘-fconvert=little-endian’?
gcc: error: unrecognized command line option ‘-mfpu=vfp’; did you mean ‘-mcpu=’?
  CC      scripts/mod/devicetable-offsets.s

How can i fix? any idea?

4

3 Answers

Your PATH is pointing to some 2011 GCC cross compiler. You need at least GCC 6 which was released in 2016. Please, install a current release of GCC.

On Debian or Ubuntu the C compiler for the host system and the cross compilers are separate packages. You can install the cross-compilers for 32bit and 64bit ARM with:

sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install gcc-aarch64-linux-gnu

As the compilers are installed in /usr/bin it is sufficient to set the CROSS_COMPILER variable like

export CROSS_COMPILE=arm-linux-gnueabihf-

or

export CROSS_COMPILE=aarch64-linux-gnu-
2

A more deterministic way of pointing to the exact toolchain you want to use is to provide its full prefix when setting CROSS_COMPILE. This will avoid possible path-related errors, and the information on which exact toolchain was used for building will be embedded in your build script.

Full example - installing official Arm gcc toolchain and retrieving/building u-boot 20.04 for xilinx_zynq_virt (use your own u-boot and defconfig):

# gcc 9.2.0
mkdir -p /opt/arm/9
wget '
tar Jxf gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz -C /opt/arm/9

# u-boot
wget 
tar zxf v2020.04.tar.gz
cd u-boot-2020.04
make CROSS_COMPILE=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi/bin/arm-none-eabi- ARCH=arm mrproper xilinx_zynq_virt_defconfig all
ll -gG u-boot*
-rwxrwxr-x 1 5778348 Jun 19 08:08 u-boot*
-rwxrwxr-x 1  599172 Jun 19 08:08 u-boot.bin*
-rw-rw-r-- 1   14907 Jun 19 08:08 u-boot.cfg
-rw-rw-r-- 1    9181 Jun 19 08:09 u-boot.cfg.configs
-rwxrwxr-x 1  665132 Jun 19 08:09 u-boot.elf*
-rw-rw-r-- 1      70 Jun 19 08:09 u-boot-elf.lds
-rw-rw-r-- 1  599612 Jun 19 08:09 u-boot-elf.o
-rw-rw-r-- 1  599236 Jun 19 08:09 u-boot.img
-rw-rw-r-- 1    1626 Jun 19 08:08 u-boot.lds
-rw-rw-r-- 1  696711 Jun 19 08:08 u-boot.map
-rwxrwxr-x 1  599172 Jun 19 08:08 u-boot-nodtb.bin*
-rwxrwxr-x 1 1797626 Jun 19 08:08 u-boot.srec*
-rw-rw-r-- 1  184969 Jun 19 08:08 u-boot.sym

I hope this help.

0

Is the path you entered correct?. I think you should add "/bin",so it'll be this way:

export PATH=/path

…to

<your toolchain>/bin:$PATH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.