AnsweredAssumed Answered

Building unit_test with including linux file manually using created toolchain

Question asked by YaoLin Chang on Aug 10, 2015
Latest reply on Aug 18, 2015 by YaoLin Chang

Hi All,

    We have install toolchain, but if we include <linux/xxx.h>", the result is error.

We have add -I path in compile as below: However, it still can't find linux path.

How can I do?

 

Test (1) => add -I git/include/linux

14.28-1.0.0/test/mxc_fb_test$ arm-poky-linux-gnueabi-gcc -mfloat-abi=hard -I /home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/linux mxc_fb_test.c -o mxc_fb_testIn file included from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdio.h:33:0,

                 from mxc_fb_test.c:29:

/home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/linux/stddef.h:4:31: fatal error: uapi/linux/stddef.h: No such file or directory

#include <uapi/linux/stddef.h>

                               ^

compilation terminated.

neo@neo-P45VA:~/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/imx-test/1_3.14.28-1.0.0-r0/imx-test-3.14.28-1.0.0/test/mxc_fb_test$

 

=======================================================================================================================

Test(2)=> add -I git/include/uapi/linux

14.28-1.0.0/test/mxc_fb_test$ arm-poky-linux-gnueabi-gcc -mfloat-abi=hard -I /home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/uapi/linux -I /home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/linux mxc_fb_test.c -o mxc_fb_testIn file included from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdio.h:33:0,

                 from mxc_fb_test.c:29:

/home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory

#include <linux/compiler.h>

                            ^

compilation terminated.

=======================================================================================================================

Test(3) => add -I git/include/linux and -I git/include/uapi/linux

14.28-1.0.0/test/mxc_fb_test$ arm-poky-linux-gnueabi-gcc -mfloat-abi=hard -I /home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/uapi/linux -I /home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/linux mxc_fb_test.c -o mxc_fb_test

In file included from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdio.h:33:0,

                 from mxc_fb_test.c:29:

/home/neo/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory

#include <linux/compiler.h>

                            ^

compilation terminated.

neo@neo-P45VA:~/fsl/build/tmp/work/imx6qsabresd-poky-linux-gnueabi/imx-test/1_3.14.28-1.0.0-r0/imx-test-3.14.28-1.0.0/test/mxc_fb_test$

==================================================================

 

Thanks,

Best Regards,

Yao

Outcomes