日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

【QCA】ubuntu1804 与 QSDK 编译环境适配问题

發(fā)布時間:2023/12/20 Ubuntu 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【QCA】ubuntu1804 与 QSDK 编译环境适配问题 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

文章目錄

  • 0.環(huán)境
  • 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. 總結(jié)
  • 附錄-修改后的源碼文件

0.環(huán)境

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 導(dǎo)致編譯失敗 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 : 如果不清楚這個問題可以繼續(xù)探究一下,或者調(diào)到最后修改部分。 # debug :從-j1 參數(shù)和log可以看出,在“patching file m4/silent.m4”后出現(xiàn)了該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 :根據(jù)make吐出的log,從makefile進入tools/automake文件夾下執(zhí)行程序到出現(xiàn)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 : 應(yīng)該在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相關(guān)文件不被重新編譯 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 : 凡是在內(nèi)核編譯時出現(xiàn)這種 “did you mean ...”提示你是不是需要輸入錯誤的,多半都是版本問題導(dǎo)致的。 > 大多數(shù)情況下內(nèi)核源碼中是不會出現(xiàn)這種低端錯誤,同時只是簡單make了一下,并沒有修改此處相關(guān)文件。 # find : 看一下新版的uboot源碼是否不一致,不一致再看下git log 是不是有對此的說明。 //githut uboot url: /* https://github.com/u-boot/u-boot/blob/master/lib/rsa/rsa-sign.c */ # find : qsdk中用的是201410月的源碼,查看前后兩次提交源碼,都存在這個問題 /* //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的,那么肯定是中間哪次提交修復(fù)的,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 : 得到如下相關(guān)修改代碼: /* - *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年,已經(jīng)是7年前的代碼了 # log : "/usr/bin/ocamlc.opt" 看log是用的本機環(huán)境,看一下本機環(huán)境 ocaml --version /* The OCaml toplevel, version 4.05.0 */ # find : 去github上看一下這個版本,Commits on Jun 16, 2017 > 沒找到相關(guān)的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版本問題,查看本機環(huán)境,并修改 # 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/ //這是我的環(huán)境 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. 總結(jié)

問題1:perl版本正則表達式格式中”{“格式的兼容問題

1. perl新版本中,正則表達式不兼容左大括號 2. 修改automake.in的相關(guān)源碼,可自定義添加patch在編譯時修改,也可直接修改原始壓縮包中的automake.in文件,再打包, 同時需要修改相關(guān)Makefile中md5值,避免重新編譯時導(dǎo)致MD5不符合重新下載源碼,進而復(fù)現(xiàn)該問題。

問題2:rsa源碼 與 openssl 版本兼容問題

1.kernel中已知的兼容問題,與openssl 1.1.x 沖突 2.參考github中uboot源碼,修改以支持超過1.1.x的版本命令。

問題3:ubuntu18.04 默認ocaml版本過高

1.ocaml版本過高,也是高版本格式變化導(dǎo)致的兼容問題 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 /* 待補充 */

總結(jié)

以上是生活随笔為你收集整理的【QCA】ubuntu1804 与 QSDK 编译环境适配问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。