最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Ubuntu中crosstool-ng编译出错:[ERROR] configure: error: expat is missing or unusable

crosstool-ng crifan 6338浏览 0评论

【问题】

折腾:

【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc

期间,编译出错:

[INFO ]  Installing kernel headers: done in 972.34s (at 39:34)
[EXTRA]  Saving state to restart at step 'libc_start_files'...
[INFO ]  =================================================================
[INFO ]  Installing C library headers & start files
[EXTRA]    Configuring C library
[EXTRA]    Installing C library headers
[EXTRA]    Installing C library start files
[INFO ]  Installing C library headers & start files: done in 23.14s (at 40:02)
[EXTRA]  Saving state to restart at step 'cc_core_pass_2'...
[INFO ]  =================================================================
[INFO ]  Installing pass-2 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing pass-2 core C compiler: done in 297.35s (at 45:04)
[EXTRA]  Saving state to restart at step 'libc'...
[INFO ]  =================================================================
[INFO ]  Installing C library
[EXTRA]    Configuring C library
[EXTRA]    Building C library
[EXTRA]    Installing C library
[INFO ]  Installing C library: done in 286.37s (at 49:56)
[EXTRA]  Saving state to restart at step 'cc_for_build'...
[EXTRA]  Saving state to restart at step 'cc_for_host'...
[INFO ]  =================================================================
[INFO ]  Installing final compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing final compiler: done in 377.10s (at 56:25)
[EXTRA]  Saving state to restart at step 'libelf_for_target'...
[INFO ]  =================================================================
[INFO ]  Installing libelf for the target
[EXTRA]    Configuring libelf
[EXTRA]    Building libelf
[EXTRA]    Installing libelf
[INFO ]  Installing libelf for the target: done in 3.99s (at 56:42)
[EXTRA]  Saving state to restart at step 'binutils_for_target'...
[INFO ]  =================================================================
[INFO ]  Installing binutils for target
[EXTRA]    Configuring binutils for target
[EXTRA]    Building binutils' libraries (libiberty bfd) for target
[EXTRA]    Installing binutils' libraries (libiberty bfd) for target
[INFO ]  Installing binutils for target: done in 44.91s (at 57:40)
[EXTRA]  Saving state to restart at step 'debug'...
[INFO ]  =================================================================
[INFO ]  Installing dmalloc
[EXTRA]    Configuring dmalloc
[EXTRA]    Building dmalloc
[EXTRA]    Installing dmalloc
[INFO ]  Installing dmalloc: done in 6.77s (at 57:59)
[INFO ]  =================================================================
[INFO ]  Installing cross-gdb
[EXTRA]    Configuring cross-gdb
[EXTRA]    Building cross-gdb
[ERROR]    configure: error: expat is missing or unusable
[ERROR]    make[2]: *** [configure-gdb] Error 1
[ERROR]    make[1]: *** [all] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing cross-gdb'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_debug_gdb_build[scripts/build/debug/300-gdb.sh@177]
[ERROR]  >>        called from: do_debug[scripts/build/debug.sh@35]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]
          

Current command:
  'make' '-j4' '-l' 
exited with error code: 2
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    2  repeat this build command
    3  abort build

ct-ng:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-gdb-cross> 

即:

在:

Installing cross-gdb

时,出错:

configure: error: expat is missing or unusable

 

【解决过程】

1.参考:

How To: Build a Custom Toolchain Using Crosstool-ng

去搜一把:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ apt-cache search expat
expat - XML parsing C library - example application
libexpat1 - XML parsing C library - runtime library
libexpat1-dev - XML parsing C library - development kit
libneon27 - HTTP and WebDAV client library
libneon27-gnutls - HTTP and WebDAV client library (GnuTLS enabled)
libxml-parser-perl - Perl module for parsing XML files
libxml-sax-expat-perl - Perl module for a SAX2 driver for Expat (XML::Parser)
libxml-sax-perl - Perl module for using and building Perl SAX2 XML processors
lib64expat1 - XML parsing C library - runtime library (64bit)
lib64expat1-dev - XML parsing C library - development kit (64bit)
libexpat-gst - Expat bindings for GNU Smalltalk
libexpat-ocaml - OCaml expat bindings
libexpat-ocaml-dev - OCaml expat bindings
libidzebra-2.0-mod-grs-xml - IDZebra filter grs.xml (XML filter)
libnode-node-expat - fast XML parser library for Node
libnode-node-xmpp - idiomatic XMPP library for Node
libxml-rss-libxml-perl - module for creating, parsing, updating RSS files with XML::LibXML
libxml-sax-expat-incremental-perl - XML::SAX::Expat subclass for non-blocking (incremental) parsing
libxml-sax-expatxs-perl - Perl SAX 2 XS extension to Expat parser
ruby-xmlparser - Ruby interface for the expat XML parser toolkit
slang-expat - S-Lang bindings for the expat XML parser
tdom - A fast XML/DOM/XPath/XSLT extension for Tcl written in C
tdom-dev - A fast XML/DOM/XPath/XSLT extension for Tcl written in C - development files
texlive-latex-extra - TeX Live: LaTeX supplementary packages
freebsd-glue - Emulate a FreeBSD build environment
liblua5.1-expat-dev - Transitional package for lua-expat-dev
liblua5.1-expat0 - Transitional package for lua-expat
lua-expat - libexpat bindings for the Lua language
lua-expat-dev - libexpat development files for the Lua language
node-node-expat - fast XML parser library for Node
node-node-xmpp - idiomatic XMPP library for Node
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ 

2.然后再去安装那个libexpat1-dev:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ sudo apt-get install libexpat
libexpat1           libexpat1-dev       libexpat-gst        libexpat-ocaml      libexpat-ocaml-dev
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ sudo apt-get install libexpat1-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libexpat1-dev
0 upgraded, 1 newly installed, 0 to remove and 202 not upgraded.
Need to get 205 kB of archives.
After this operation, 656 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/ubuntu/ raring/main libexpat1-dev i386 2.1.0-2 [205 kB]
Fetched 205 kB in 22s (8,941 B/s) 
Selecting previously unselected package libexpat1-dev:i386.
(Reading database ... 158288 files and directories currently installed.)
Unpacking libexpat1-dev:i386 (from .../libexpat1-dev_2.1.0-2_i386.deb) ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Setting up libexpat1-dev:i386 (2.1.0-2) ...
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ 

3.然后回去继续编译,就可以了。

 

【总结】

当编译crosstool-ng出现:

[ERROR] configure: error: expat is missing or unusable

的错误时,去安装缺失的expat库:libexpat1-dev,即可:

sudo apt-get install libexpat1-dev 

转载请注明:在路上 » 【已解决】Ubuntu中crosstool-ng编译出错:[ERROR] configure: error: expat is missing or unusable

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.191 seconds, using 22.23MB memory