- gcc: error: нераспознанный параметр командной строки
- 2 ответа
- Problem in cross compiling linux kernel 4.4.2 for ARM in ubuntu
- gcc: error: unrecognized command line option
- 3 Answers 3
- Linux – gcc: error: unrecognized command line option
- Best Solution
- Related Solutions
- gcc: error: unrecognized command line option
- Solution 2
gcc: error: нераспознанный параметр командной строки
Я пытаюсь создать файл образа u-boot. Но есть ли у меня какая-то ошибка.
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
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
Как я могу это исправить? любая идея?
2 ответа
Более детерминированный способ указать точную цепочку инструментов, которую вы хотите использовать, — указать полный префикс при установке CROSS_COMPILE . Это позволит избежать возможных ошибок, связанных с путями, и информация о том, какая именно цепочка инструментов использовалась для сборки, будет встроена в ваш скрипт сборки.
Полный пример — установка официального набора инструментов Arm gcc и получение / сборка u-boot 20.04 для xilinx_zynq_virt (используйте свой собственный u-boot и defconfig):
# gcc 9.2.0 mkdir -p /opt/arm/9 wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz?revision=64186c5d-b471-4c97-a8f5-b1b300d6594a&la=en&hash=5E9204DA5AF0B055B5B0F50C53E185FAA10FF625' tar Jxf gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz -C /opt/arm/9 # u-boot wget https://github.com/u-boot/u-boot/archive/v2020.04.tar.gz 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
Я надеюсь, что это поможет.
Ваш PATH указывает на какой-то кросс-компилятор GCC 2011 года. Вам нужен как минимум GCC 6, выпущенный в 2016 году. Пожалуйста, установите текущую версию GCC.
В Debian или Ubuntu компилятор C для хост-системы и кросс-компилятор являются отдельными пакетами. Вы можете установить кросс-компилятор для 32-битной и 64-битной ARM с:
sudo apt-get install gcc-arm-linux-gnueabihf sudo apt-get install gcc-aarch64-linux-gnu
Поскольку компиляторы установлены в / usr / bin, достаточно установить переменную CROSS_COMPILER, например
export CROSS_COMPILE=arm-linux-gnueabihf-
export CROSS_COMPILE=aarch64-linux-gnu-
Problem in cross compiling linux kernel 4.4.2 for ARM in ubuntu
You can install the arm toolchain in your own directory. Then set up a set of definitions like:
MY_ARM_BASE=$/dev/toolchain/arm-2008q3 C_INCLUDE_PATH=$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include:$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed LIBRARY_PATH=$/arm-none-linux-gnueabi/libc/lib:$/arm-none-linux-gnueabi/libc/usr/lib CPLUS_INCLUDE_PATH=$/arm-none-linux-gnueabi/include/c++/4.3.2 #OBJC_INCLUDE_PATH COMPILER_PATH=$/bin #LD_RUN_PATH #GPROF_PATH ####### CC=$/gccMY_ARM_BASE=$/dev/toolchain/arm-2008q3 C_INCLUDE_PATH=$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include:$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed LIBRARY_PATH=$/arm-none-linux-gnueabi/libc/lib:$/arm-none-linux-gnueabi/libc/usr/lib CPLUS_INCLUDE_PATH=$/arm-none-linux-gnueabi/include/c++/4.3.2 #OBJC_INCLUDE_PATH COMPILER_PATH=$/bin #LD_RUN_PATH #GPROF_PATH #######MY_ARM_BASE=$/dev/toolchain/arm-2008q3 C_INCLUDE_PATH=$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include:$/lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed LIBRARY_PATH=$/arm-none-linux-gnueabi/libc/lib:$/arm-none-linux-gnueabi/libc/usr/lib CPLUS_INCLUDE_PATH=$/arm-none-linux-gnueabi/include/c++/4.3.2 #OBJC_INCLUDE_PATH COMPILER_PATH=$/bin #LD_RUN_PATH #GPROF_PATH ####### CC=$/gcc CXX=$/g++ RANLIB=$/ranlib STRIP=$/strip export C_INCLUDE_PATH LIBRARY_PATH CPLUS_INCLUDE_PATH COMPILER_PATH export CC CXX RANLIB STRIP CC=$/gcc CXX=$/g++ RANLIB=$/ranlib STRIP=$/strip export C_INCLUDE_PATH LIBRARY_PATH CPLUS_INCLUDE_PATH COMPILER_PATH export CC CXX RANLIB STRIP CXX=$/g++ RANLIB=$/ranlib STRIP=$/strip export C_INCLUDE_PATH LIBRARY_PATH CPLUS_INCLUDE_PATH COMPILER_PATH export CC CXX RANLIB STRIP
Note, the example is not for a kernel compile, just some webserver I was compiling for ARM, and I did not even set all the possible variables.
gcc: error: unrecognized command line option
I’m not a uboot expert but it looks like you are not correctly cross compiling but instead end up using the native toolchain. Probably haven’t set CROSS_COMPILE env var.
3 Answers 3
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-
export CROSS_COMPILE=aarch64-linux-gnu-
Thanks. i did install gcc-8,2 but i need change gcc path, i guess. Do u know how can i change gcc path ?
The host GCC and the GCC cross compiler are separate packages. For Ubuntu I have added a description above.
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 'https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz?revision=64186c5d-b471-4c97-a8f5-b1b300d6594a&la=en&hash=5E9204DA5AF0B055B5B0F50C53E185FAA10FF625' tar Jxf gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz -C /opt/arm/9 # u-boot wget https://github.com/u-boot/u-boot/archive/v2020.04.tar.gz 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
Linux – 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
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
Best Solution
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 compiler are separate packages. You can install the cross-compiler 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-
export CROSS_COMPILE=aarch64-linux-gnu-
Related Solutions
Linux – How to exclude a directory in find . command
If -prune doesn’t work for you, this will:
find -name "*.js" -not -path "./directory/*"
Caveat: requires traversing all of the unwanted directories.
Why doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)
Because Floating Point Math is not Associative. The way you group the operands in floating point multiplication has an effect on the numerical accuracy of the answer.
As a result, most compilers are very conservative about reordering floating point calculations unless they can be sure that the answer will stay the same, or unless you tell them you don’t care about numerical accuracy. For example: the -fassociative-math option of gcc which allows gcc to reassociate floating point operations, or even the -ffast-math option which allows even more aggressive tradeoffs of accuracy against speed.
Related Question
gcc: error: unrecognized command line option
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 'https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz?revision=64186c5d-b471-4c97-a8f5-b1b300d6594a&la=en&hash=5E9204DA5AF0B055B5B0F50C53E185FAA10FF625' tar Jxf gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz -C /opt/arm/9 # u-boot wget https://github.com/u-boot/u-boot/archive/v2020.04.tar.gz 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
Solution 2
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 compiler are separate packages. You can install the cross-compiler 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-
export CROSS_COMPILE=aarch64-linux-gnu-