[yocto] Failed to cross compile kernel with Yocto toolchain

Zhenhua Luo zhenhua.luo at nxp.com
Wed Jun 29 01:52:42 PDT 2016


The /usr/lib64/ccache is added in PATH by /etc/profile.d/ccache.sh when ccache is installed on Fedora host, the issue disappears if one of the following changes is done.

1.       Remove /usr/lib64/ccache from PATH

2.       Move /usr/lib64/ccache after /usr/bin in PATH

3.       Set CCACHE_PATH equals to PATH

4.       Unset CCACHE_PATH

Another observation, before sourcing environment-setup-<core>-poky-linux, gcc can be found even if /usr/lib64/ccache is in prepend to PATH, but after sourcing the environment-setup-<core>-poky-linux script, the gcc can’t be found, this should be a bug of the environment-setup-<core>-poky-linux script. Should I open a Bugzilla ticket to track it?

$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/bjsimics/.local/bin:/home/bjsimics/bin
which gcc
/usr/lib64/ccache/gcc
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-default-libstdcxx-abi=gcc4-compatible --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
$
$ source /opt/poky/2.1+snapshot/environment-setup-ppce500mc-poky-linux
$
$ echo $PATH
/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/sbin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/sbin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-uclibc:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-musl:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/bjsimics/.local/bin:/home/bjsimics/bin
$
$ which gcc
/usr/lib64/ccache/gcc
$ gcc -v
ccache: error: Could not find compiler "gcc" in PATH
$


Best Regards,

Zhenhua

From: Khem Raj [mailto:raj.khem at gmail.com]
Sent: Tuesday, June 28, 2016 10:48 PM
To: Zhenhua Luo <zhenhua.luo at nxp.com>
Cc: yocto at yoctoproject.org
Subject: RE: [yocto] Failed to cross compile kernel with Yocto toolchain


/usr/lib64/ccache is unusual why do you have it in path and if you really need it add it after all other paths. Check your env first

On Jun 27, 2016 10:56 PM, "Zhenhua Luo" <zhenhua.luo at nxp.com<mailto:zhenhua.luo at nxp.com>> wrote:
Hello Khem,

> -----Original Message-----
> From: Khem Raj [mailto:raj.khem at gmail.com<mailto:raj.khem at gmail.com>]
> Sent: Tuesday, June 28, 2016 12:36 AM
> To: Zhenhua Luo <zhenhua.luo at nxp.com<mailto:zhenhua.luo at nxp.com>>
> Cc: yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>
> Subject: Re: [yocto] Failed to cross compile kernel with Yocto toolchain
>
> On Mon, Jun 27, 2016 at 1:16 AM, Zhenhua Luo <zhenhua.luo at nxp.com<mailto:zhenhua.luo at nxp.com>>
> wrote:
> > Hello all,
> >
> >
> >
> > I generate the Yocto toolchain by “bitbake meta-toolchain”, and use
> > this toolchain to cross-compile kernel, I met the following error. Is
> > this a bug or I missed something? My host Linux is Fedora 22.
>
> its better to start using bitbake -cpopulate_sdk <image name> to generate
> SDKs.
>
>
> >
> >
> >
> > $ source /opt/poky/2.1+snapshot/environment-setup-ppce500mc-poky-
> linux
> >
> > $ cd linux/
> >
> > $ make corenet32_smp_defconfig
> >
> >   HOSTCC  scripts/kconfig/conf.o
> >
> > ccache: error: Could not find compiler "gcc" in PATH
>
> did you see if gcc is in your path after sourcing SDK env script?
[Luo Zhenhua-B19537] gcc can't be found after sourcing the SDK env script. but the /usr/bin is in the PATH env variable.
$ source /opt/poky/2.1+snapshot/environment-setup-ppce500mc-poky-linux
$ echo $PATH
/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/sbin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/sbin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-uclibc:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-musl:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/bjsimics/.local/bin:/home/bjsimics/bin
$ echo $CCACHE_PATH
/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-uclibc:/opt/poky/2.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux-musl:
$ which gcc
/usr/lib64/ccache/gcc
$ gcc -v
ccache: error: Could not find compiler "gcc" in PATH

Best Regards,

Zhenhua

> > scripts/Makefile.host:108: recipe for target 'scripts/kconfig/conf.o'
> > failed
> >
> > make[1]: *** [scripts/kconfig/conf.o] Error 1
> >
> > Makefile:541: recipe for target 'corenet32_smp_defconfig' failed
> >
> > make: *** [corenet32_smp_defconfig] Error 2
> >
> >
> >
> >
> >
> > Best Regards,
> >
> >
> >
> > Zhenhua
> >
> >
> > --
> > _______________________________________________
> > yocto mailing list
> > yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>
> > https://lists.yoctoproject.org/listinfo/yocto
> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160629/c75d7b4e/attachment.html>


More information about the yocto mailing list