交叉编译遇到一些问题

来源:互联网 发布:淘宝客公司 编辑:程序博客网 时间:2024/05/21 21:41

1、从仓库中clone一份到本地

    git clone http://arago-project.org/git/projects/test-automation/ltp-ddt.git


2、先生成configure文件,一般使用make autotools


3、./configuer 需要有一些参数

    ./configure  --build=x86_64-linux                  --host=arm-poky-linux-gnueabi                   --target=arm-poky-linux-gnueabi                 --prefix=/opt/ltp               --exec_prefix=/opt/ltp                  --bindir=/opt/ltp/bin                   --sbindir=/opt/ltp/sbin                 --libexecdir=/opt/ltp/lib/ltp                   --datadir=/opt/ltp/share                --sysconfdir=/etc               --sharedstatedir=/com                   --localstatedir=/var            --libdir=/opt/ltp/lib                   --includedir=/opt/ltp/include                   --oldincludedir=/opt/ltp/include                --infodir=/opt/ltp/share/info                   --mandir=/opt/ltp/share/man             --disable-silent-rules                  --disable-dependency-tracking                   --with-libtool-sysroot=$SDKTARGETSYSROOT  --with-power-management-testsuite --with-realtime-testsuite   --without-tirpc   --without-numa


4、遇到的一些问题

  1)

/tmp/ccEW4rwZ.o: In function `st_audio_file_playback':
/home/ts/work/ltp-ddt/testcases/ddt/alsa_test_suite/src/testcases/st_alsa_file_playback_test.c:101: undefined reference to `st_read'
/home/ts/work/ltp-ddt/testcases/ddt/alsa_test_suite/src/testcases/st_alsa_file_playback_test.c:144: undefined reference to `st_close'
/tmp/cc17CaZZ.o: In function `st_audio_file_capture':
/home/ts/work/ltp-ddt/testcases/ddt/alsa_test_suite/src/testcases/st_alsa_capture_file_test.c:113: undefined reference to `st_write'


解决办法:  将-I $(ALSA_INCPATH)移到前面位置
#INCLUDES       = -I $(KERNEL_USR_INC) -I/home/ts/work/ltp-ddt/testcases/ddt/alsa_test_suite/src/interface/common -I ../utils/user -I $(ALSA_INCPATH)
INCLUDES        = -I $(KERNEL_USR_INC) -I/home/ts/work/ltp-ddt/testcases/ddt/alsa_test_suite/src/interface/common -I $(ALSA_INCPATH) -I/home/ts/work/ltp-ddt/testcases/ddt/utils/user/



2)

/opt/fsl-imx-wayland/3.14.52-1.1.1/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find -lc
collect2: error: ld returned 1 exit status

解决:调整 -I $(KERNEL_INC) 位置
INCLUDES        = -I src/user/parser -I src/user/interface/common  -I $(KERNEL_INC)-I ../utils/user


3)

/opt/fsl-imx-wayland/3.14.52-1.1.1/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find ../utils/user: File format not recognized
/opt/fsl-imx-wayland/3.14.52-1.1.1/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find -lc

解决办法:

将 -I $(KERNEL_USR_INC)去掉,一般为空
#INCLUDES        = -I $(KERNEL_USR_INC) -I src/interface/common -I ../utils/user
INCLUDES        = -I src/interface/common -I ../utils/user


主要原因时:在make的时候, -I $(KERNEL_USR_INC) 为空,此时编译的时候就与后面的 -I -I src/interface/common 构成,makefile识别失败,所以会报错


4)

tests_rpc_stress.c:57:29: fatal error: linux/rpmsg_rpc.h: No such file or directory
 #include "linux/rpmsg_rpc.h"


在CFLAGS添加头文件的路径
CFLAGS          += -g -Wall -O1 -fomit-frame-pointer
-I/home/ts/tisdk/build/arago-tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/linux-libc-headers/4.9-r0.arago2/sysroot-destdir/usr/include

这个原因需要下在这个库 /tisdk/

 git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk

总结:

一般这些问题都是makefile文件里有语法错误

原创粉丝点击