文章目录

  • 0.环境
  • 1. 问题汇总
    • 问题1:perl版本与{格式兼容问题
      • debug
      • Modify
      • verify
      • 修改后的文件参考附录
    • 问题2:rsa源码 与 openssl 版本兼容问题
      • debug
      • modify
      • verify
      • 修改后的文件参考附录
    • 问题3:ubuntu18.04 默认ocaml版本过高
      • debug
      • Modify
      • verify
    • 问题4:gcc版本与spf11.0版本不兼容
      • debug
      • Modify
      • verify
  • 2. 总结
  • 附录-修改后的源码文件

0.环境

spf11.0 , u-boot-2016-10
ubuntu 18.4 , OpenSSL 1.1.1 11 ,perl-v5.26.1 , ocaml 4.05.0 ,gcc-7

1. 问题汇总

问题1:perl版本与{格式兼容问题

# cmd : make 导致编译失败
make -j10
# log:
/*
make[3]: Entering directory '/xxxxxxx/qsdk/tools/automake'
. /xxxxxxxx/qsdk/include/shell.sh; xzcat /xxxxxxxx/qsdk/dl/automake-1.15.tar.xz | tar -C /xxxxxxxxx/qsdk/build_dir/host/automake-1.15/.. -xf -Applying ./patches/000-relocatable.patch using plaintext:
patching file lib/Automake/Config.in
patching file bin/aclocal.in
patching file bin/automake.in
patching file t/wrap/aclocal.in
patching file t/wrap/automake.inApplying ./patches/200-do-not-override-silent-rules.patch using plaintext:
patching file m4/silent.m4
touch /xxxxxxxxx/qsdk/build_dir/host/automake-1.15/.preparede614279ad0d4e37445021068e4d2aebb
(cd /hxxxxxxx/qsdk/build_dir/host/automake-1.15;
...../bootstrap.sh)
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at ./bin/automake.tmp line 3938.
Makefile:50: recipe for target '/xxxxxxx/qsdk/build_dir/host/automake-1.15/.configured' failed
make[3]: *** [/xxxxxx/qsdk/build_dir/host/automake-1.15/.configured] Error 255
make[3]: Leaving directory '/xxxxxx/qsdk/tools/automake'
*/

debug

# debug : 获得error 前后log,定位到问题log:
> “Unescaped left brace in regex ...” 表明左括号的格式有问题,
# debug :检查报错文件格式是否正确,cmd & log:
//cmd:
vi ./build_dir/host/automake-1.15/bin/automake.tmp +3938
//log:
/*3 sub substitute_ac_subst_variables2 {1   my ($text) = @_;
3938   $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;1   return $text;2 }
*/
# debug : 分析头部判断语言种类为Perl,上述格式跟版本不匹配了
/*2 #!perl1 # -*- perl -*-3   # Generated from bin/automake.in; do not edit by hand.
*/
# debug : 如果不清楚这个问题可以继续探究一下,或者调到最后修改部分。
# debug :从-j1 参数和log可以看出,在“patching file m4/silent.m4”后出现了该error,先试试从这里开始往下理出来。
# cmd & lgo : 看一下bootstrap.sh这里处理上述patch的程序段,cmd & log如下:
/*
//cmd
$ vi ./build_dir/host/automake-1.15/bootstrap.sh
//log5 # Overwrite amversion.m4.4 dosubst m4/amversion.in m4/amversion.m432 # Create temporary replacement for aclocal and automake.1 for p in bin/aclocal bin/automake; do
103   dosubst $p.in $p.tmp1   $PERL -w bin/gen-perl-protos $p.tmp > $p.tmp22   mv -f $p.tmp2 $p.tmp3 done
*/
# debug :再看这里的bin/automake是个什么东西。(budild_dir/是生成的,尽量不在这里修改问题)
# debug :根据make吐出的log,从makefile进入tools/automake文件夹下执行程序到出现error都没有Leaving directory,很显然要去tools/automake/找源文件
# debug :进入该目录,首先查看Makefile,cmd & log如下:
// cmd :
vi tools/automake/Makefile
// log :
/*3 PKG_NAME:=automake2 PKG_VERSION:=1.151
12  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz1 PKG_SOURCE_URL:=@GNU/automake2 PKG_MD5SUM:=9a1ddb0e053474d9d1105cfe39b0c48d
*/
# ret : 果然是个压缩文件解压出来的文件,找到source code 压缩包名字及md5
//automake-1.15.tar.xz  md5:9a1ddb0e053474d9d1105cfe39b0c48d
# find : 应该在dl/下,实际也确实是。
> md5校验值两者是相符合的,确定是该文件。
> 打开压缩包,确认压缩包中原始automake.in脚本有格式问题

Modify

# M : 解压原始文件并修改automake.in中格式问题,并重新打包
//cmd 参考如下:
xz -d automake-1.15.tar.xz  //解压文件为tar包
tar -xvf automake-1.15.tar  //打开tar包
vi automake-1.15/bin/automake.in +3881// 修改如下:
/*
-$text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+$text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
*/
tar -cvf automake-1.15.tar automake-1.15/ //先做tar包
xz -z automake-1.15.tar                   //在压缩
cp automake-1.15.tar.xz /xxxx/qsdk/dl/    //cp到dl下替换原来的文件
# M : 替换源文件,需要修改Makefile中md5校验值,不然会因为不匹配重新下载该文件,造成修改后的文件仍然会被替换掉
vi qsdk/tools/automake/Makefile

verify

# test : 重新编译:
//删除build_dir/ , 避免build_dir/host/.../automake.tmp相关文件不被重新编译
rm -rf build_dir/
make V=s -j10
# Fix

修改后的文件参考附录

问题2:rsa源码 与 openssl 版本兼容问题

# log :
/*
/xxxxxxx/qsdk/build_dir/host/u-boot-2014.10/lib/rsa/rsa-sign.c:213:2: warning: implicit declaration of function 'EVP_MD_CTX_cleanup'; did you mean 'EVP_MD_CT
X_create'? [-Wimplicit-function-declaration]EVP_MD_CTX_cleanup(context);^~~~~~~~~~~~~~~~~~EVP_MD_CTX_create
...
/xxxxx/qsdk/build_dir/host/u-boot-2014.10/lib/rsa/rsa-sign.c:279:21: error: dereferencing pointer to incomplete type 'RSA {aka struct rsa_st}'if (BN_num_bits(key->e) > 64)^~
scripts/Makefile.host:134: recipe for target 'tools/lib/rsa/rsa-sign.o' failed
make[5]: *** [tools/lib/rsa/rsa-sign.o] Error 1
Makefile:1195: recipe for target 'tools-only' failed
make[4]: *** [tools-only] Error 2
*/

debug

# debug : 凡是在内核编译时出现这种 “did you mean ...”提示你是不是需要输入错误的,多半都是版本问题导致的。
> 大多数情况下内核源码中是不会出现这种低端错误,同时只是简单make了一下,并没有修改此处相关文件。
# find : 看一下新版的uboot源码是否不一致,不一致再看下git log 是不是有对此的说明。
//githut uboot url:
/*
https://github.com/u-boot/u-boot/blob/master/lib/rsa/rsa-sign.c
*/
# find : qsdk中用的是2014年10月的源码,查看前后两次提交源码,都存在这个问题
/*
//2014.8.9
https://github.com/u-boot/u-boot/blob/542671623129f1db947801d2756186b501c98c49/lib/rsa/rsa-sign.c
//2016.7.22
https://github.com/u-boot/u-boot/blob/2b9ec762c4fb5c0f933f5b3380ef9f5c353d0eef/lib/rsa/rsa-sign.c
*/
# find : 最新的源码是ok的,那么肯定是中间哪次提交修复的,git log :
2017.5.12 有一次提交中提到了EVP_MD_CTX_reset 的问题,
查看pathch , URL :
/*
https://github.com/u-boot/u-boot/commit/c3b4328166b03d6749b86eb0fbb21a10e4395cfd?branch=c3b4328166b03d6749b86eb0fbb21a10e4395cfd&diff=split
*/
# ret : 得到如下相关修改代码:
/*
-   *e = BN_get_word(key->e);
+  *e = BN_get_word(key_e);-  if (BN_num_bits(key->e) < 33) {
+  if (BN_num_bits(key_e) < 33) {ret = 0;goto cleanup;}
*/

modify

# M : 把该 patch 合并入qsdk源码中
# M : patch参考如下,
/*
https://github.com/u-boot/u-boot/commit/c3b4328166b03d6749b86eb0fbb21a10e4395cfd?branch=c3b4328166b03d6749b86eb0fbb21a10e4395cfd&diff=split
*/
// 修改后的文件参考如下源码:
# url:FIX openSSL , rsa-sign.c源码
/*
https://github.com/u-boot/u-boot/blob/c3b4328166b03d6749b86eb0fbb21a10e4395cfd/lib/rsa/rsa-sign.c
*/
// 修改后的文件参考附件(2016年的代码,较之最新版本还有些问题,暂时先不管)

verify

# cmd
//删除生成的各类build_dir/等
make V=s
# FIX

修改后的文件参考附录

问题3:ubuntu18.04 默认ocaml版本过高

# log : 错误log
/*
File "./main.ml", line 777, characters 22-49:
Warning 52: Code should not depend on the actual values of
this constructor's arguments. They are only for information
and may change in future versions. (See manual section 8.5)
File "./main.ml", line 956, characters 35-60:
Error: Unbound module Parmap
Makefile:656: recipe for target 'main.cmo' failed
make[7]: *** [main.cmo] Error 2
*/

debug

# debug : 看样子是版本问题,检查一下具体程序:
vi ./build_dir/host/coccinelle-coccinelle-1.0.0-rc24/main.ml
-> Copyright 2012-2014, INRIA
# debug: 最后一次修改时2014年,已经是7年前的代码了
# log : "/usr/bin/ocamlc.opt" 看log是用的本机环境,看一下本机环境
ocaml --version
/*
The OCaml toplevel, version 4.05.0
*/
#  find : 去github上看一下这个版本,Commits on Jun 16, 2017
> 没找到相关的commit 信息,不确定降级到哪一版本,源程序中只判断了版本必须>3.7
> 选择版本3.7~时间点为2014之前的某个版本,具体版本不确定,参考BD的建议:4.02.3

Modify

# cmd : 修改ocaml版本为 4.02.3
# find :opam官方配置文档:
/*
1. To configure OPAM in the current shell session, you need to run:eval `opam config env`
2. To correctly configure OPAM for subsequent use, add the followingline to your profile file (for instance ~/.profile):. /home/liam/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
3. To avoid issues related to non-system installations of `ocamlfind`add the following lines to ~/.ocamlinit (create it if necessary):let () =try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")with Not_found -> ();;
*/
# cmd : 命令汇总一下:
/*
cmd1:
eval `opam config env`
opam switch --all //查看可用版本,
opam switch create 4.02.3
cmd2: . /home/xxxxx/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
cmd3: vi ~/.ocamlinit,添加如下信息;let () =try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")with Not_found -> ();;
配置当前shell:
cmd4: eval `opam config env`
*/
# cmd : 尝试重新编译
/*
eval `opam config env`
ocaml -version // 确定下当前shell中的版本
cd qsdk/build_dir/host/coccinelle-coccinelle-1.0.0-rc241 Then simply type2  ./configure --enable-release3  make4  make install
*/
# FIX

verify

# cmd : 重新编译QSDK
# faile: 删除build_dir 后重新编译
# FIX

问题4:gcc版本与spf11.0版本不兼容

# log :
/*
In file included from /xxxxxx/qsdk/build_dir/toolchain-arm_cortex-a7_gcc-5.2.0_musl-1.1.16_eabi/gcc-5.2.0/gcc/cp/except.c:1023:0:
cfns.gperf: In function 'const char* libc_name_p(const char*, unsigned int)':
cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 'gnu_inline' attribute
cfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned int)' previously declared here
cfns.gperf: At global scope:
cfns.gperf:26:14: warning: inline function 'const char* libc_name_p(const char*, unsigned int)' used but never defined
Makefile:1065: recipe for target 'cp/except.o' failed
*/

debug

# debug : 显然是gcc版本问题,查看本机环境,并修改
# M :找到并替换编译程序
//cmd  : 找到这个x86_64-linux-gnu-g++,
whereis x86_64-linux-gnu-g++
/* //log :
ls -l -> /usr/bin/x86_64-linux-gnu-g++ -> g++-7
*/

Modify

#  cmd :修改链接 指向 gcc-5
cd /usr/bin/ //这是我的环境
sudo mv x86_64-linux-gnu-g++ x86_64-linux-gnu-g++-ori //把原始的链接换个名字,删除也行
sudo ln -s g++-5 x86_64-linux-gnu-g++  //新建link指向g++-5

verify

# cmd : 重新编译
make V=s -10
# FIX

2. 总结

问题1:perl版本正则表达式格式中”{“格式的兼容问题

1. perl新版本中,正则表达式不兼容左大括号
2. 修改automake.in的相关源码,可自定义添加patch在编译时修改,也可直接修改原始压缩包中的automake.in文件,再打包,
同时需要修改相关Makefile中md5值,避免重新编译时导致MD5不符合重新下载源码,进而复现该问题。

问题2:rsa源码 与 openssl 版本兼容问题

1.kernel中已知的兼容问题,与openssl 1.1.x 冲突
2.参考github中uboot源码,修改以支持超过1.1.x的版本命令。

问题3:ubuntu18.04 默认ocaml版本过高

1.ocaml版本过高,也是高版本格式变化导致的兼容问题
2.ocaml降级为 4.02.3

问题4:gcc版本与spf11.0版本不兼容

1.ubuntu1804默认为gcc7,这个sdk需要的是gcc5
2.修改用户link,x86_64-linux-gnu-g++ 指向为 g++-5

附录-修改后的源码文件

# file :修改后的automake-1.15.tar.xz 、Makefile
# url :
/*
待补充
*/
# file :rsa-sign.c 与 openssl 问题
# url :
/*
待补充
*/

【QCA】ubuntu1804 与 QSDK 编译环境适配问题相关推荐

  1. 斐讯k2php环境,斐讯K2T SDK编译环境

    使用系统: Ubuntu 16.06 64位 斐讯K2T采用了高通的CPU QCA9558/9563,采用的SDK为高通的QSDK. QSDK是一种在openwrt的基础上,加入了高通atheros芯 ...

  2. 斐讯k2搭建php环境,斐讯K2T SDK编译环境

    使用系统: Ubuntu 16.06 64位 斐讯K2T采用了高通的CPU QCA9558/9563,采用的SDK为高通的QSDK. QSDK是一种在openwrt的基础上,加入了高通atheros芯 ...

  3. xmake新增对WDK驱动编译环境支持

    为什么80%的码农都做不了架构师?>>>    xmake v2.2.1新版本现已支持WDK驱动编译环境,我们可以直接在系统原生cmd终端下,执行xmake进行驱动编译,甚至配合vs ...

  4. 【Android 插件化】VirtualAppEx 编译运行 ( VirtualAppEx 简介 | 配置 VirtualAppEx 编译环境 | 编译运行 VirtualAppEx 代码 )

    文章目录 一.VirtualAppEx 简介 二.配置 VirtualAppEx 编译环境 1.Android Studio 3.0 2.NDK 版本 ( Android NDK r10e ) 3.配 ...

  5. STM32 gcc编译环境搭建

    STM32 gcc编译环境搭建 标签(空格分隔): stm32 gcc Makefile 说在前面的话 gcc编译器兼容Windows.Linux和MAC,可自行去官网下载,此处提供参考链接:http ...

  6. ubuntu1804源码编译jdk8

    这里纯粹自己弄着玩,因为以前没有成功过,这里记录一下,就是让遇到问题的人可以规避问题,快速编译自己的jdk. 相信很多学java的人都看过或者了解过一本书<深入理解java虚拟机>,里面就 ...

  7. 搭建Monado Runtime和OpenXR Sample Code编译环境

    继上一篇<搭建ORB_SLAM3在Linux下的编译和运行环境>完成之后 为了完全打通 OpenXR---Runtime---SLAM 的数据通路 我们还需要搭建编译Runtime和Ope ...

  8. linux 编译opencl,OpenCL编译环境配置(VS+Nvidia)

    英伟达的显卡首先要下载安装CUDA开发包,可以参考这里的步骤:   VS2015编译环境下CUDA安装配置 安装好CUDA之后,OpenCL的配置就已经完成了80%了,剩下的工作就是把OpenCL的路 ...

  9. Linux下C/C++编译环境搭建

    搭建Linux编译环境 针对C语言和C++ 首先必须是root用户,切换root用户使用下面的命令 然后输入root用户的密码 [admin@bogon ~]$ su root 若是忘记了root用户 ...

最新文章

  1. 领歌LeangooV6.5.3:支持评论编辑,看板动态跳转
  2. “接着奏乐接着舞”,大脑也是这么想的
  3. postman接口测试实例_postman接口测试实例
  4. 服务器状态显示down,Eureka心跳健康检查机制和Spring boot admin 节点状态一直为DOWN的排查(忽略某一个节点的健康检查)...
  5. 剖析数据库中重要而又常被曲解的概念
  6. ubuntu mysql自动备份文件_Ubuntu下开展MYSQL自动备份
  7. @程序员,不要再锤产品经理了,锤这个吧!!!
  8. 都说发展存储产业一定要走IDM模式,你怎么看?
  9. iOS 的一种设计模式 类别 catagory
  10. google插件查看源码
  11. 瑞吉外卖(27)-查看购物车信息、清空购物车功能开发
  12. 如何将chrome浏览器的默认语言改成中文呢?
  13. matlab fminsearch 原理,Matlab利用fminsearch实现参数估计
  14. 1024 程序员节,带你走进程序员的世界——
  15. 温故知新(五)——三参数陷波滤波器离散化推导及MATLAB实现
  16. java web 点着点着就死掉了_Websphere(was)故障-挂死,重启,产生core.*.dmp,javacore文件-分析和解决...
  17. JS中什么是DOM和BOM
  18. 大企业的计算机设备维护,企业计算机系统维护措施
  19. PostgreSQL利用全备与WAL日志恢复数据库
  20. 便携式微型计算机和笔记本的区别,笔记本和超极本及上网本 细谈三者区别

热门文章

  1. 小苏java学习之路
  2. 稀疏向量计算技术杂谈
  3. 推荐一款显示器分屏软件——Screen+
  4. 基于python + Appium的安卓自动化
  5. 中国剩余定理(详解)
  6. APICS与AX的Master Planning(四)---Time Fence时限(时界)
  7. Linux内存管理知识总结(一)
  8. 新零售连锁系统帮助多门店解决财务管理痛点
  9. active英语怎么读音_active(active用英语怎么读?)
  10. hoj 2715 (费用流 拆点)