MT7688固件编译故障修复:XML-Parser组件缺失(perl-XML-parser)(XML::parser)

松灿
2023-12-01

前言

正在编译编译mt7688的固件,正开心这呢,然而突然报错,我瞬间爆炸,然后刷的冷静下来,问题不大我能解决。首先查看打印信息明确故障原因是缺少组件XML-Parser,于是查阅资料补上这个缺口继续编译。

起始bug打印

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for perl... /home/b/Desktop/mt7688/openwrt_widora/staging_dir/host/bin/perl
checking for perl >= 5.8.1... 5.18.2
checking for XML::Parser... configure: error: XML::Parser perl module is required for intltool
make[3]: *** [/home/b/Desktop/mt7688/openwrt_widora/build_dir/host/intltool-0.40.6/.configured] Error 1
make[3]: Leaving directory `/home/b/Desktop/mt7688/openwrt_widora/feeds/packages/libs/intltool'
make[2]: *** [package/feeds/packages/intltool/host/compile] Error 2
make[2]: Leaving directory `/home/b/Desktop/mt7688/openwrt_widora'
make[1]: *** [/home/b/Desktop/mt7688/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2

设计解决思路

根据打印网上搜索得知是缺少了XML-Parser组件,因此进行补充。
部分资料显示,需要下载安装源码包:
XML-Parser-2.34.tar.gz
然而对于这个源码包的相关搜索通常指向了付费链接,这不能忍
因此我选择尝试其他思路:
https://www.douban.com/note/493624754/
这篇文章遇到了类似的问题,因此我参照了一下解决步骤。

依次执行

sudo apt-get install libxml-simple-perl

sudo apt-get install libxml-simple-perl
进行第一阶段安装
(打印见下方打印1,操作就是需要y的地方y回车其余回车)

perl -e shell –MCPAN

perl -e shell –MCPAN
进行第二阶段安装2
(非常多的打印,操作就是一路回车)
然后输入

install XML::Parser

cpan[1]>install XML::Parser
进行第三阶段安装
(详细见打印二)
然而出了点问题:
Failed during this command:
TODDR/XML-Parser-2.46.tar.gz : writemakefile NO – No ‘Makefile’ created
我寻思应该是要手动安装
输入quit离开cpan

perl Makefile.PL

进入下载的目录输入指令
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ perl Makefile.PL
出现故障,我认为是缺少Expat
因此输入指令:
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ sudo apt-get install expat
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ sudo apt-get install libexpat1-dev
重新执行perl Makefile.PL,通过了
(详细见打印三)

make

(打印太多跳过)

make test

(见相关打印四)

make install

(见相关打印五)
故障了,我认为是缺少权限
使用sudo make install
通过
通过了(部分见打印六)
完结撒花

Signing package index...
make[2]: Leaving directory `/home/b/Desktop/mt7688/openwrt_widora'
make[1]: Leaving directory `/home/b/Desktop/mt7688/openwrt_widora'
b@ubuntu:~/Desktop/mt7688/openwrt_widora$ 

相关打印

打印1

b@ubuntu:~/Desktop/mt7688/openwrt_widora$ sudo apt-get install libxml-simple-perl 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libencode-locale-perl libfile-listing-perl libfont-afm-perl
  libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libio-html-perl liblwp-mediatypes-perl
  liblwp-protocol-https-perl libnet-http-perl libwww-perl
  libwww-robotrules-perl libxml-namespacesupport-perl libxml-parser-perl
  libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl
Suggested packages:
  libdata-dump-perl libcrypt-ssleay-perl libauthen-ntlm-perl
The following NEW packages will be installed:
  libencode-locale-perl libfile-listing-perl libfont-afm-perl
  libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libio-html-perl liblwp-mediatypes-perl
  liblwp-protocol-https-perl libnet-http-perl libwww-perl
  libwww-robotrules-perl libxml-namespacesupport-perl libxml-parser-perl
  libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl
  libxml-simple-perl
0 upgraded, 25 newly installed, 0 to remove and 10 not upgraded.
Need to get 1,277 kB of archives.
After this operation, 3,991 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cn99.com/ubuntu/ trusty/main libencode-locale-perl all 1.03-1 [12.4 kB]
Get:2 http://mirrors.cn99.com/ubuntu/ trusty/main libhttp-date-perl all 6.02-1 [10.4 kB]
Get:3 http://mirrors.cn99.com/ubuntu/ trusty/main libfile-listing-perl all 6.04-1 [9,774 B]
Get:4 http://mirrors.cn99.com/ubuntu/ trusty/main libfont-afm-perl all 1.20-1 [14.3 kB]
Get:5 http://mirrors.cn99.com/ubuntu/ trusty/main libhtml-tagset-perl all 3.20-2 [13.5 kB]
Get:6 http://mirrors.cn99.com/ubuntu/ trusty/main libhtml-parser-perl amd64 3.71-1build1 [98.2 kB]
Get:7 http://mirrors.cn99.com/ubuntu/ trusty/main libio-html-perl all 1.00-1 [15.7 kB]
Get:8 http://mirrors.cn99.com/ubuntu/ trusty/main liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
Get:9 http://mirrors.cn99.com/ubuntu/ trusty/main libhttp-message-perl all 6.06-1 [78.7 kB]
Get:10 http://mirrors.cn99.com/ubuntu/ trusty/main libhtml-form-perl all 6.03-1 [23.5 kB]
Get:11 http://mirrors.cn99.com/ubuntu/ trusty/main libhtml-tree-perl all 5.03-1 [215 kB]
Get:12 http://mirrors.cn99.com/ubuntu/ trusty/main libhtml-format-perl all 2.11-1 [44.7 kB]
Get:13 http://mirrors.cn99.com/ubuntu/ trusty/main libhttp-cookies-perl all 6.00-2 [23.3 kB]
Get:14 http://mirrors.cn99.com/ubuntu/ trusty/main libhttp-daemon-perl all 6.01-1 [17.0 kB]
Get:15 http://mirrors.cn99.com/ubuntu/ trusty/main libhttp-negotiate-perl all 6.00-2 [13.4 kB]
Get:16 http://mirrors.cn99.com/ubuntu/ trusty/main libnet-http-perl all 6.06-1 [24.2 kB]
Get:17 http://mirrors.cn99.com/ubuntu/ trusty/main libwww-robotrules-perl all 6.01-1 [14.1 kB]
Get:18 http://mirrors.cn99.com/ubuntu/ trusty/main libwww-perl all 6.05-2 [146 kB]
Get:19 http://mirrors.cn99.com/ubuntu/ trusty-updates/main liblwp-protocol-https-perl all 6.04-2ubuntu0.1 [7,644 B]
Get:20 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-namespacesupport-perl all 1.11-1 [13.2 kB]
Get:21 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-parser-perl amd64 2.41-1build3 [294 kB]
Get:22 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-sax-base-perl all 1.07-1 [21.5 kB]
Get:23 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-sax-perl all 0.99+dfsg-2ubuntu1 [64.6 kB]
Get:24 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-sax-expat-perl all 0.40-2 [11.5 kB]
Get:25 http://mirrors.cn99.com/ubuntu/ trusty/main libxml-simple-perl all 2.20-1 [68.3 kB]
Fetched 1,277 kB in 3s (341 kB/s)         
Selecting previously unselected package libencode-locale-perl.
(Reading database ... 237823 files and directories currently installed.)
Preparing to unpack .../libencode-locale-perl_1.03-1_all.deb ...
Unpacking libencode-locale-perl (1.03-1) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libfile-listing-perl.
Preparing to unpack .../libfile-listing-perl_6.04-1_all.deb ...
Unpacking libfile-listing-perl (6.04-1) ...
Selecting previously unselected package libfont-afm-perl.
Preparing to unpack .../libfont-afm-perl_1.20-1_all.deb ...
Unpacking libfont-afm-perl (1.20-1) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../libhtml-tagset-perl_3.20-2_all.deb ...
Unpacking libhtml-tagset-perl (3.20-2) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../libhtml-parser-perl_3.71-1build1_amd64.deb ...
Unpacking libhtml-parser-perl (3.71-1build1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../libio-html-perl_1.00-1_all.deb ...
Unpacking libio-html-perl (1.00-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../libhttp-message-perl_6.06-1_all.deb ...
Unpacking libhttp-message-perl (6.06-1) ...
Selecting previously unselected package libhtml-form-perl.
Preparing to unpack .../libhtml-form-perl_6.03-1_all.deb ...
Unpacking libhtml-form-perl (6.03-1) ...
Selecting previously unselected package libhtml-tree-perl.
Preparing to unpack .../libhtml-tree-perl_5.03-1_all.deb ...
Unpacking libhtml-tree-perl (5.03-1) ...
Selecting previously unselected package libhtml-format-perl.
Preparing to unpack .../libhtml-format-perl_2.11-1_all.deb ...
Unpacking libhtml-format-perl (2.11-1) ...
Selecting previously unselected package libhttp-cookies-perl.
Preparing to unpack .../libhttp-cookies-perl_6.00-2_all.deb ...
Unpacking libhttp-cookies-perl (6.00-2) ...
Selecting previously unselected package libhttp-daemon-perl.
Preparing to unpack .../libhttp-daemon-perl_6.01-1_all.deb ...
Unpacking libhttp-daemon-perl (6.01-1) ...
Selecting previously unselected package libhttp-negotiate-perl.
Preparing to unpack .../libhttp-negotiate-perl_6.00-2_all.deb ...
Unpacking libhttp-negotiate-perl (6.00-2) ...
Selecting previously unselected package libnet-http-perl.
Preparing to unpack .../libnet-http-perl_6.06-1_all.deb ...
Unpacking libnet-http-perl (6.06-1) ...
Selecting previously unselected package libwww-robotrules-perl.
Preparing to unpack .../libwww-robotrules-perl_6.01-1_all.deb ...
Unpacking libwww-robotrules-perl (6.01-1) ...
Selecting previously unselected package libwww-perl.
Preparing to unpack .../libwww-perl_6.05-2_all.deb ...
Unpacking libwww-perl (6.05-2) ...
Selecting previously unselected package liblwp-protocol-https-perl.
Preparing to unpack .../liblwp-protocol-https-perl_6.04-2ubuntu0.1_all.deb ...
Unpacking liblwp-protocol-https-perl (6.04-2ubuntu0.1) ...
Selecting previously unselected package libxml-namespacesupport-perl.
Preparing to unpack .../libxml-namespacesupport-perl_1.11-1_all.deb ...
Unpacking libxml-namespacesupport-perl (1.11-1) ...
Selecting previously unselected package libxml-parser-perl.
Preparing to unpack .../libxml-parser-perl_2.41-1build3_amd64.deb ...
Unpacking libxml-parser-perl (2.41-1build3) ...
Selecting previously unselected package libxml-sax-base-perl.
Preparing to unpack .../libxml-sax-base-perl_1.07-1_all.deb ...
Unpacking libxml-sax-base-perl (1.07-1) ...
Selecting previously unselected package libxml-sax-perl.
Preparing to unpack .../libxml-sax-perl_0.99+dfsg-2ubuntu1_all.deb ...
Unpacking libxml-sax-perl (0.99+dfsg-2ubuntu1) ...
Selecting previously unselected package libxml-sax-expat-perl.
Preparing to unpack .../libxml-sax-expat-perl_0.40-2_all.deb ...
Unpacking libxml-sax-expat-perl (0.40-2) ...
Selecting previously unselected package libxml-simple-perl.
Preparing to unpack .../libxml-simple-perl_2.20-1_all.deb ...
Unpacking libxml-simple-perl (2.20-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for doc-base (0.10.5) ...
Processing 1 added doc-base file...
Setting up libencode-locale-perl (1.03-1) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libfile-listing-perl (6.04-1) ...
Setting up libfont-afm-perl (1.20-1) ...
Setting up libhtml-tagset-perl (3.20-2) ...
Setting up libhtml-parser-perl (3.71-1build1) ...
Setting up libio-html-perl (1.00-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libhttp-message-perl (6.06-1) ...
Setting up libhtml-form-perl (6.03-1) ...
Setting up libhtml-tree-perl (5.03-1) ...
Setting up libhtml-format-perl (2.11-1) ...
Setting up libhttp-cookies-perl (6.00-2) ...
Setting up libhttp-daemon-perl (6.01-1) ...
Setting up libhttp-negotiate-perl (6.00-2) ...
Setting up libnet-http-perl (6.06-1) ...
Setting up libwww-robotrules-perl (6.01-1) ...
Setting up libxml-namespacesupport-perl (1.11-1) ...
Setting up libxml-sax-base-perl (1.07-1) ...
Setting up libxml-sax-perl (0.99+dfsg-2ubuntu1) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::PurePerl with priority 10...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...

Creating config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up liblwp-protocol-https-perl (6.04-2ubuntu0.1) ...
Setting up libwww-perl (6.05-2) ...
Setting up libxml-parser-perl (2.41-1build3) ...
Setting up libxml-sax-expat-perl (0.40-2) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::Expat with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up libxml-simple-perl (2.20-1) ...

打印2

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install XML::Parser
Running install for module 'XML::Parser'
Running make for T/TO/TODDR/XML-Parser-2.46.tar.gz
Fetching with LWP:
http://mirror.lzu.edu.cn/CPAN/authors/id/T/TO/TODDR/XML-Parser-2.46.tar.gz
Fetching with LWP:
http://mirror.lzu.edu.cn/CPAN/authors/id/T/TO/TODDR/CHECKSUMS
Checksum for /home/b/.cpan/sources/authors/id/T/TO/TODDR/XML-Parser-2.46.tar.gz ok

  CPAN.pm: Building T/TO/TODDR/XML-Parser-2.46.tar.gz


Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' (or
'libexpat1-dev') package with your OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

No 'Makefile' created  TODDR/XML-Parser-2.46.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
 TODDR/XML-Parser-2.46.tar.gz                 : writemakefile NO -- No 'Makefile' created


cpan[2]>

打印3

b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing MYMETA.yml and MYMETA.json
Writing Makefile for XML::Parser
Writing MYMETA.yml and MYMETA.json
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$

打印4

b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ make test
make[1]: Entering directory `/home/b/.cpan/build/XML-Parser-2.46-Wc9hvw/Expat'
make[1]: Leaving directory `/home/b/.cpan/build/XML-Parser-2.46-Wc9hvw/Expat'
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/astress.t ........... ok     
t/cdata.t ............. ok   
t/decl.t .............. ok     
t/defaulted.t ......... ok   
t/encoding.t .......... ok   
t/external_ent.t ...... ok   
t/file.t .............. ok   
t/file_open_scalar.t .. ok   
t/finish.t ............ ok   
t/namespaces.t ........ ok     
t/parament.t .......... ok     
t/partial.t ........... ok   
t/skip.t .............. ok   
t/stream.t ............ ok   
t/styles.t ............ ok     
All tests successful.
Files=15, Tests=140,  2 wallclock secs ( 0.11 usr  0.14 sys +  0.79 cusr  0.53 csys =  1.57 CPU)
Result: PASS

打印5

b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$ make install 
make[1]: Entering directory `/home/b/.cpan/build/XML-Parser-2.46-Wc9hvw/Expat'
make[1]: Leaving directory `/home/b/.cpan/build/XML-Parser-2.46-Wc9hvw/Expat'
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/lib/perl/5.18.2/XML'
mkdir /usr/local/lib/perl: Permission denied at /usr/share/perl/5.18/ExtUtils/Install.pm line 469.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at -e line 1.
make: *** [pure_site_install] Error 13
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$

打印6

Installing /usr/local/lib/perl/5.18.2/XML/Parser/Style/Stream.pm
Installing /usr/local/lib/perl/5.18.2/XML/Parser/Style/Subs.pm
Installing /usr/local/lib/perl/5.18.2/XML/Parser/Style/Debug.pm
Installing /usr/local/lib/perl/5.18.2/XML/Parser/Style/Objects.pm
Installing /usr/local/lib/perl/5.18.2/XML/Parser/Style/Tree.pm
Installing /usr/local/man/man3/XML::Parser.3pm
Installing /usr/local/man/man3/XML::Parser::Expat.3pm
Installing /usr/local/man/man3/XML::Parser::Style::Stream.3pm
Installing /usr/local/man/man3/XML::Parser::Style::Debug.3pm
Installing /usr/local/man/man3/XML::Parser::Style::Subs.3pm
Installing /usr/local/man/man3/XML::Parser::Style::Tree.3pm
Installing /usr/local/man/man3/XML::Parser::Style::Objects.3pm
Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod
b@ubuntu:~/.cpan/build/XML-Parser-2.46-Wc9hvw$

结语

对于linux开发我最大的感触就是见招拆招,我没有获得过系统的培训,一直都是靠实际操作锻炼解决问题的思路,核心手法如下:
首先发现错误,提取关键字,
其次在在国内搜索引擎上查找,依次开启2~7个页面整理解决方案
(如果不行就换国内论坛和外网论坛,如果还不行就自己在论坛发帖子。)
接着根据解决方案处理问题,详细记录每一个步骤和细节,时刻对照方案是否有出入,根据自己的实际情况进行改良和优化
最后解决问题(到这一步没有解决不了的问题,如果解决不了那就只能放弃,这个思路行不通,换一个方案,不要浪费时间了)
这就是我的解题思路了,如果大家有什么自己的解决问题的思路请留言,谢谢(^_−)☆

 类似资料: