U-boot compilation error


#1

I Install Cross Compiler for U-Boot BL301 and Install Cross Compiler for Linux kernel.

But I have error:

davemf@ubuntu:~/project/uboot$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
HOSTCC scripts/basic/fixdep
GEN ./Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf

configuration written to .config

davemf@ubuntu:~/project/uboot$
davemf@ubuntu:~/project/uboot$ make CROSS_COMPILE=aarch64-linux-gnu-
make[1]: aarch64-linux-gnu-gcc: Command not found
/bin/sh: 1: aarch64-linux-gnu-gcc: not found
dirname: missing operand
Try ‘dirname --help’ for more information.
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
/bin/sh: 1: aarch64-linux-gnu-gcc: not found
make[3]: *** [include/autoconf.mk] Error 1
make[2]: *** [silentoldconfig] Error 1
make[1]: *** No rule to make target include/config/auto.conf', needed byinclude/config/uboot.release’. Stop.
make: *** [sub-make] Error 2
davemf@ubuntu:~/project/uboot$


#2

terry.
I try build root on nougat.

I modif

“EnableSelinux=permissive\0”\

Then I try this:

and my result:

davemf@ubuntu:~/project/khadas/nougat/uboot$ make distclean
CLEAN examples/standalone
CLEAN tools
CLEAN tools/lib tools/common
CLEAN u-boot u-boot.bin u-boot.hex u-boot.lds u-boot.map u-boot.srec System.map
CLEAN scripts/basic
CLEAN scripts/kconfig
CLEAN include/config include/generated
CLEAN .config .config.old include/autoconf.mk include/autoconf.mk.dep include/config.h

make completed successfully (6 seconds)

davemf@ubuntu:~/project/khadas/nougat/uboot$ make kvim_defconfig
HOSTCC scripts/basic/fixdep
GEN ./Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf

configuration written to .config

make completed successfully (6 seconds)

davemf@ubuntu:~/project/khadas/nougat/uboot$
davemf@ubuntu:~/project/khadas/nougat/uboot$
davemf@ubuntu:~/project/khadas/nougat/uboot$ make -j8
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
cc1: warning: unknown register name: x18 [enabled by default]
cc1: warning: unknown register name: x18 [enabled by default]
CHK include/config/uboot.release
CHK include/generated/timestamp_autogenerated.h
GEN ./Makefile
UPD include/generated/timestamp_autogenerated.h
UPD include/config/uboot.release
Using … as source for U-Boot
CHK include/generated/version_autogenerated.h
UPD include/generated/version_autogenerated.h
CC lib/asm-offsets.s
CC arch/arm/lib/asm-offsets.s
cc1: error: unknown register name: x18 [-Werror]
cc1: all warnings being treated as errors
cc1: error: unknown register name: x18 [-Werror]
make[2]: *** [lib/asm-offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs…
cc1: all warnings being treated as errors
make[2]: *** [arch/arm/lib/asm-offsets.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

make failed to build some targets (5 seconds)

May be need ?

$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-

not

$ make kvim_defconfig
$ make -j8


#3

I am sorry for that
The correct method is:
$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-


Gapps and SU on SOC?
#4

hi, Davemf:
Does your issue got resolved?


#5

No, issue does not resolved.
I have error on new ubuntu system:

davemf@ubuntu:~/project/uboot$ make CROSS_COMPILE=aarch64-linux-gnu-
make[1]: aarch64-linux-gnu-gcc: Command not found
/bin/sh: 1: aarch64-linux-gnu-gcc: not found
dirname: missing operand
Try ‘dirname --help’ for more information.
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
/bin/sh: 1: aarch64-linux-gnu-gcc: not found
make[3]: *** [include/autoconf.mk] Error 1
make[2]: *** [silentoldconfig] Error 1
make[1]: *** No rule to make target include/config/auto.conf’, needed byinclude/config/uboot.release’. Stop.
make: *** [sub-make] Error 2
davemf@ubuntu:~/project/uboot$


#6

Before that, i installed all under the instruction:

$ sudo apt-get install gcc-arm-none-eabi
$ wget http://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2
$ sudo mkdir /opt/toolchains
$ sudo tar -xjf gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2 -C /opt/toolchains

And check it:

davemf@ubuntu:~$ aarch64-linux-gnu-gcc -v
The program ‘aarch64-linux-gnu-gcc’ is currently not installed. You can install it by typing:
sudo apt-get install gcc-aarch64-linux-gnu

Why gcc-aarch64-linux-gnu does not installed?


#7

Basically, Ubuntu just got gcc pre-installed, regarding gcc-aarch64-linux-gnu-gcc should be install by manual.


#8

I installed it

$ sudo tar -xjf gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2 -C /opt/toolchains

or
will need “sudo apt-get install gcc-aarch64-linux-gnu” installing together with “sudo tar -xjf gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2 -C /opt/toolchains”?


#9

Keep in mind that different Ubuntu version will come with different gcc version:

It gcc-4 on my Ubuntu-14.04 PC:

gouwa@Server:~$ aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/4.8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1' --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/aarch64-linux-gnu/include/c++/4.8.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --disable-libsanitizer --disable-libquadmath --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-arm64-cross/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-arm64-cross --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-arm64-cross --with-arch-directory=arm64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libgcj --enable-multiarch --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include
Thread model: posix
gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 
gouwa@Server:~$

But gcc-5 on Ubuntu-16.04:

gouwa@Wesion:~$ aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/5/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --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-5-arm64-cross/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-arm64-cross --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-arm64-cross --with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libgcj --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 
gouwa@Wesion:~$

Actually, for Android, we recommend you follow the instructions to install the specify gcc-4 version.

But if you want to develop Linux Distro, you may need to install gcc-5 instead.


#10

as I wrote above, I did it. And gcc not work!


#11

/opt folder has gcc files.

May be instruction does not right?

My system said:

davemf@ubuntu:~$ aarch64-linux-gnu-gcc -vThe program ‘aarch64-linux-gnu-gcc’ is currently not installed. You can install it by typing:
sudo apt-get install gcc-aarch64-linux-gnu


#12

Actually, in your case, you can just replace CROSS_COMPILE with following instead:
’’‘
CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-
’’’


#13

Not work. It does nothing

davemf@ubuntu:~/project/uboot$ CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu- kvim_defconfig
kvim_defconfig: command not found
davemf@ubuntu:~/project/uboot$ CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-
davemf@ubuntu:~/project/uboot$

#14

You just forgot to type ‘make’ :disappointed_relieved:


#15

old error

davemf@ubuntu:~/project/uboot$ make CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-
make[1]: /opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-gcc: Command not found
/bin/sh: 1: /opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-gcc: not found
dirname: missing operand
Try ‘dirname --help’ for more information.
GEN ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
GEN include/autoconf.mk
/bin/sh: 1: /opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu-gcc: not found
make[3]: *** [include/autoconf.mk] Error 1
make[2]: *** [silentoldconfig] Error 1
make[1]: *** No rule to make target include/config/auto.conf', needed byinclude/config/uboot.release’. Stop.
make: *** [sub-make] Error 2
davemf@ubuntu:~/project/uboot$


#16

I think you need CHECK AGAIN for your host environment first:

  1. you even haven’t got ‘make’ installed yet:
  1. check you did got the cross toolchain installed in right way:

Actually, thus problems you met not a complex ones, you can got them resolved if you check the error prompt messages carefully


#17

Hi, davemf:
Do you get the problems resolved?

If yes, please follow the Problem Solved Button to mark it as solved


#18

@davemf

Below instructions tested on Ubuntu 16.04 LTS

Prepare build host

$ sudo apt-get update
$ sudo apt-get install git lzop build-essential gcc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386

Install Tool chains

$ wget http://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2
$ sudo mkdir /opt/toolchains
$ sudo tar -xjf gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.bz2 -C /opt/toolchains

Setup Cross_compile Env

$ export ARCH=arm64
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ export PATH=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/:$PATH

Build u-boot for armlogic

$ cd ~/project/khadas/ubuntu/u-boot
$ make kvim_defconfig
$ make -j8 CROSS_COMPILE=aarch64-linux-gnu-

I hope it solve your problems.

-Arun


#19

I do get following error:

In file included from uart.c:23:0:
/usr/lib/gcc/arm-none-eabi/4.9.3/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory

include_next <stdint.h>

                      ^

compilation terminated.
Makefile:86: recipe for target ‘/media/gytis/raid2tb/gytis/development/git-files/khadas/android-7/uboot/build/scp_task/uart.o’ failed
make[2]: *** [/media/gytis/raid2tb/gytis/development/git-files/khadas/android-7/uboot/build/scp_task/uart.o] Error 1
/media/gytis/raid2tb/gytis/development/git-files/khadas/android-7/uboot/Makefile:896: recipe for target ‘/media/gytis/raid2tb/gytis/development/git-files/khadas/android-7/uboot/build/scp_task/bl301.bin’ failed
make[1]: *** [/media/gytis/raid2tb/gytis/development/git-files/khadas/android-7/uboot/build/scp_task/bl301.bin] Error 2
Makefile:147: recipe for target ‘sub-make’ failed
make: *** [sub-make] Error 2

Found how to fix it:
sudo apt-get install libnewlib-arm-none-eabi


Build Ubuntu 16.04.2 (or 17.04) w/ Mate and Linux-4.9
#20

thanks You !
I also had this stdin.h error but this sudo apt-get install libnewlib-arm-none-eabi effectively allowed me to succeed in compiling the khadas u-boot on my 16.10 xubuntu machine!