SDK编译错误收集--持续更新

本文档汇总了使用Yocto构建SDK时遇到的各种问题,包括tar解压错误、无法访问Google源、权限问题、protobuf版本找不到、内存溢出以及脚本语法错误等,并提供了详细的解决方法,如修改repo镜像源、调整编译环境和参数、修复文件系统权限等。
摘要由CSDN通过智能技术生成

本篇博客记录一下使用Yocto编译SDK过程中遇到的问题,以及我所用的解决方法。

如果有好的建议,也请在评论区共享哦~

问题1: "tar: Exiting with failure status due to previous errors"

对压缩文件进行解压时,解压完成后你可能会遇到上面的错误提示。

原因:使用了v(verbose mode,详细信息)后,tar会提示之前压缩时出现的错误信息。通过

$tar -zxvf alcs-pkgcopied.tar.gz > /dev/null    可以看到tar输出的标准错误(stderr)信息。

解决方法:在解压时,把v去掉接可以。不会再出现错误提示。

参考链接:https://linux.cn/article-5817-1.html

 

问题2: 由于众所周知的原因,国内使用google的source不能通过repo下载。可以使用清华大学的镜像源(或其他的镜像源,ali,网易等等)

解决方法:修改repo 文件中‘https://storage.googleapis.com/git-repo-downloads/repo’ 为 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

 

问题3:没有权限创建符号链接

Exception: subprocess. CalledProcessError: Command 'cp -afl --perserve=xattr ./* /home/your/sdk/path/tmp/sysrttos-components/x86_64/libtool-native' returened non-zero exit status 1

  • cp: cannot create hard link 'xx/xx/xx/xx/tmp/sysroots-components/x86_64/libtool-native/usr/lib/libltdl.so' to '.usr/lib/libtdl.so': Operation not permitted.
  • Error:libtool-native-2.4.6-r0 do_populate_sysroot: Function failed: sstate_task_postfunc

解决方法/分析:本人尝试过进入root/模式再编译,不成功。这个问题的原因是我在编译的时候把SDK放在外挂的硬盘上。而这个硬盘使用的是NTFS文件系统,不仅与Linux标准的ext4不一样,而且所有文件的owner都是root。找到原因后解决就比较容易了:在PC本地的硬盘建立一个文件夹编译就可以了。

 

问题4: ERROR: nativesdk-protobuf-3.4.1+gitAUTOINC+b04e5cba35-r0 do_fetch: Fetcher failure: Unable to find version b04e5cba356212e4e8c66c61bbe..... in branch 3.4.x even fron upstream 

ERROR: nativesdk-protobuf-3.4.1+gitAUTOINC+b04e5cba35-r0 do_fetch: Fetcher failure for URL: 'git: //github.com/google/protobuf.git'' branch=3.4.x'. Unable to fetch URL from any source. 

解决办法:定位protobuf所在的layer,找到protobuf_3.4.x.bb文件,

URL: 'git://github.com/google/protobuf.git;branch=3.4.x' ===修改为===》URL: 'git://github.com/google/protobuf.git'

原因就是3.4.x版本的protobuf在网上已经下载不到了。下载其他版本(可能更新?3.5.x)就可以了。

 

问题5: 内存溢出,可以加大内存/减小编译的线程数/增大swap(https://blog.csdn.net/lophyxp/article/details/49908661

DEBUG: Executing shell function do_compile

NOTE: make -j 16

./x86_64-linux-libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.20.0\" -DPACKAGE_STRING=\"sqlite\ 3.20.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.20.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I../sqlite-autoconf-3200000 -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -O2 -pipe -DUSE_PREAD -DSQLITE_ENABLE_COLUMN_METADATA -fPIC -c -o sqlite3.lo ../sqlite-autoconf-3200000/sqlite3.c

gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.20.0\" -DPACKAGE_STRING=\"sqlite\ 3.20.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.20.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I../sqlite-autoconf-3200000 -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -O2 -pipe -DUSE_PREAD -DSQLITE_ENABLE_COLUMN_METADATA -fPIC -c -o sqlite3-shell.o `test -f 'shell.c' || echo '../sqlite-autoconf-3200000/'`shell.c

x86_64-linux-libtool: compile: gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.20.0\" "-DPACKAGE_STRING=\"sqlite 3.20.0\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.20.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I../sqlite-autoconf-3200000 -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -isystem/home/tyw/build/tcc8036/tmp/work/x86_64-linux/sqlite3-native/3_3.20.0-r0/recipe-sysroot-native/usr/include -O2 -pipe -DUSE_PREAD -DSQLITE_ENABLE_COLUMN_METADATA -fPIC -c ../sqlite-autoconf-3200000/sqlite3.c -fPIC -DPIC -o .libs/sqlite3.o

{standard input}: Assembler messages:

{standard input}:88914: Warning: end of file not at end of a line; newline inserted

{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive

gcc: internal compiler error: Killed (program cc1)

Please submit a full bug report, with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

make: *** [Makefile:540: sqlite3.lo] Error 1

ERROR: oe_runmake failed

WARNING: exit code 1 from a shell command.

 

 

 问题6:执行脚本时语法错误

/sdk/path/$ ./OtpImgen.sh

generating raw key files

generating /your/sdk/path/security_tools/secureboot/out/rawkey/cbcmackey2rev.bin(16bytes)

./OtpImgGen.sh: 16: ./OtpImgGen.sh: Syntax error: "(" unexpected

原因:这是由于shell版本不同导致的。可能SDK集成人员编译时用的是bash shell. 而我的sh环境是dash: (命令: ls -l /bin/*sh)

解决方法: 1. 将OtpImgGen.sh脚本里的第一行改掉: #!/bin/sh" 改成 "#!/bin/bash"

                   2. 不修改脚本,命令行直接执行$bash OtpImgGen.sh

 

问题7: ERROR: ParseError at /home/your/sdk/path/poky/meta-xxx/meta-cluster/recipes-xxx-cluster/images/xxx-cluster-image.bb:6: Could not inherit file classes/make-updatedir.bbclass

原因: 没有make-updatedir.bbclass. 需要手动创建、编写一个make-updatedir.bbclass文件。然后编译。

 

问题8:添加预编译库的软链接失败

原因:Yocto对创建预编译库的软链接版本号有一定的规则限制。为了从库的版本号追溯源码,以及升级库时的兼容性,Yocto默认规定在创建库链接的时候添加版本号。

解决:https://blog.csdn.net/CSDN1013/article/details/111085963

 

问题9:do_package: QA issue. Files/directories were installed but not shipped in any package. Release set FILES such that these items are packaged. Alternatively if they are not needed, avoid installing them or delete them within do_install.

            [installed-vs-shipped]

            ERROR: do_package: Fatal QA errors found, failing task.

                           do_package: Function failed: package

 原因:这个错误一般是因为你的bb文件不够完善。在你的bb文件do_install中,可能新建了一个目录(比如{D}/{bindir}/system, {D}表示目标文件系统的root目录,{bindir}为/usr/bin目录),但是你既没有把你的package安装到文件系统默认的目录(例如{D}/{bindir}), 也没有安装到你新建的目录中。这样,Yocto认为你的package没有安装,新建的目录也没有实际作用。Yocto会建议你删除这个system目录。

https://stackoverflow.com/questions/34067897/bitbake-not-installing-my-file-in-the-rootfs-image

https://stackoverflow.com/questions/46071039/an-example-of-using-files-pn

解决方法:两种方案。第一,你可以选择把你的packag直接install到Yocto已经定义的目录。你不需要新建目录,而是直接用默认存在的目录即可( meta/conf/bitbake.conf中可以查到默认的目录。另外你的recipes依赖的classes文件可能基于默认的目录做修改,所以还需要确认classes中是否修改了默认的目录)。 第二,假如你必须新建一个目录来存放你的package,那么需要在do_install之后,使用FILES_$PN指明安装目录和安装条件。

do_install_append{

if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d )}; then

     install -d {D}${sysconfdir}/init.d

     install -m 0755 ${WORKDIR}/qt.init.sh ${D}${sysconfdir}/init.d/{INIT_NAME}

else

    install -d {D}/${systemd_unitdir}/system

    install -d {D}/{systemconfdir}

    install -m 644 ${WORKIR}/qt.service ${D}/${systemd_unitdir}/system/qt-service

    install -m 644 ${WORKIR}/qt.path ${D}/${systemd_unitdir}/system/qt.path

fi

}

FILES_${PN} += " \

     ${datadir} \

     ${@bb.untils.contains('DISTRO_FEATURES', 'sysvinit', '${sysconfdir}', '', d)} \

     ${@bb.untils.contains('DISTRO_FEATURES', 'sysvinit', '${localstatedir}', '', d)} \

     ${@bb.untils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}', '', d)} \

     ${@bb.untils.contains('DISTRO_FEATURES', 'systemd', '${sysconf_dir}', '', d)} \

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值