i.MX7 yocto cross-compiler issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX7 yocto cross-compiler issue

2,462 Views
waynelou
Contributor I

Hi all,

I have downloaded i.MX7 dual Linux4.1.15 yocto BSP by following method.

$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1-krogoth -m imx-4.1.15-2.0.0.xml
$ repo sync

I can use bitbake to build out gui image and boot the board.

$ DISTRO=fsl-imx-x11 MACHINE=imx7dsabresd source fsl-setup-release.sh -b build-x11

$ bitbake fsl-image-gui

But now when I add some external package bb file in source directory and try to build out into rootfs. I am facing below error:

ERROR: uim-git-r1+gitrAUTOINC+c73894456d do_compile: oe_runmake failed
ERROR: uim-git-r1+gitrAUTOINC+c73894456d do_compile: Function failed: do_compile (log file is located at /home/wayne/L4.1.15/fsl-yocto-L4.1.15_2.0.0-ga/fsl-arm-yocto-bsp/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/uim/git-r1+gitrAUTOINC+c73894456d/temp/log.do_compile.4786)
ERROR: Logfile of failure stored in: /home/wayne/L4.1.15/fsl-yocto-L4.1.15_2.0.0-ga/fsl-arm-yocto-bsp/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/uim/git-r1+gitrAUTOINC+c73894456d/temp/log.do_compile.4786
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4 CC=arm-poky-linux-gnueabi-gcc
| CC uim.o
| uim.c:18:19: fatal error: stdio.h: No such file or directory
| compilation terminated.
| make: *** [uim.o] Error 1
| ERROR: oe_runmake failed
| ERROR: Function failed: do_compile (log file is located at /home/wayne/L4.1.15/fsl-yocto-L4.1.15_2.0.0-ga/fsl-arm-yocto-bsp/build-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/uim/git-r1+gitrAUTOINC+c73894456d/temp/log.do_compile.4786)
ERROR: Task 1175 (/home/wayne/L4.1.15/fsl-yocto-L4.1.15_2.0.0-ga/fsl-arm-yocto-bsp/sources/poky/meta/recipes-connectivity/uim/uim_git.bb, do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4590 tasks of which 4589 didn't need to be rerun and 1 failed.
No currently running tasks (4209 of 7281)

It seems that toolchain arm-poky-linux-gnueabi lack some C library. Could anyone provide some help.

Thanks very much.

BR,

Wayne

Labels (2)
0 Kudos
3 Replies

1,180 Views
Yuri
NXP Employee
NXP Employee

Hello,

  Also, the following approach may be interesting.

https://community.nxp.com/docs/DOC-328199 

Regards,

Yuri.

0 Kudos

1,180 Views
daweichen
Contributor III

You may need to modify the Makefile  of your software package or modify your .bb file to pass whatever settings required to the Makefile.  I assume your .bb recipe provides instructions to compile a software package. 

When you use Yocto .bb to build a software package, the "CC" variable value is automatically defined  by Yocto and --sysroot is set to the BSP's rootfs.

I often had to change Makefiles  to not let  "CC" orverriden.

e.g.

Yocto defines CC = "arm-poky-linux-gnueabi-gcc  <and some CPU specific options>"

Makefile (example)

CC = -g -O2    <--- this assignment statement overrides the default defined by Yocto and may also switch the compiler to a different or a non-existent compiler.

A potential fix is "CC ?= -g -O2"   <--- this statement will initialize CC only when CC has not been assigned.

Anyway, this is just a probably cause.  You may want want to read documents on Yocto and openembedded.

Sometimes I like to bypass the Yocto bitbake and .bb recipe file.

I would just use the toolchain directly.

Here are the general steps for creating the toolchain.

1. After you have created a BSP image for your target with a bitbake command, execute the following command to prepare for installation of a SDK

 "bitbake <bsp-image-name> -c populate_sdk"

e.g. "bitbake core-image-base -c populate_sdk"

2. After the command is finished, deploy the sdk. 

   a. Go to  ../<BSP>/<build dir>/tmp/deploy/sdk

   b. sudo ./<whatever the name of the .sh script file>

   c. Use the default installation location.

 

3. Start a new shell session and go to /opt/<whatever the name>/

   find the "environmentXYZ.sh"

4. Execute the .sh with the "source" command"

5. At this point the shell session should have all necessary environment variables for the cross-compiler toolchain.

6. In the same shell session run the target Makefile.  Note:  You may still need modify the Makefile to eliminate any potential override.

Note: you can look at the environmentXYZ.sh file to see what environment variables have been added to the shell session.

You'll see how "CC" is defined and etc...

good luck!

0 Kudos

1,180 Views
waynelou
Contributor I

Hi Dawei,

Thanks for your help.

I have solved the issue by sourcing the environmentXXX.sh.

BR,

Wayne

0 Kudos