Arm Libtool声称它在交叉编译期间不支持共享库

Arm Libtool声称它在交叉编译期间不支持共享库,arm,cross-compiling,libtool,expat-parser,Arm,Cross Compiling,Libtool,Expat Parser,我正在尝试为运行busybox 1.13的ARM嵌入式计算机构建expat(2.0.0)XML解析库,在./configure过程中,我得到错误: checking if libtool supports shared libraries... no 我已经指定了我的gcc、g++、ar、ranlib、strip等等,所有这些都可以通过配置工具找到,而且我已经在Ubuntu 12.10上运行了最新的libtool(撰写本文时为2.4.2),那么为什么说libtool不支持共享库呢?我的配置命令

我正在尝试为运行busybox 1.13的ARM嵌入式计算机构建expat(2.0.0)XML解析库,在./configure过程中,我得到错误:

checking if libtool supports shared libraries... no
我已经指定了我的gcc、g++、ar、ranlib、strip等等,所有这些都可以通过配置工具找到,而且我已经在Ubuntu 12.10上运行了最新的libtool(撰写本文时为2.4.2),那么为什么说libtool不支持共享库呢?我的配置命令是:

./configure --host=arm --enable-shared CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ AR=arm-none-linux-gnueabi-ar RANLIB=arm-none-linux-gnueabi-ranlib STRIP=arm-none-linux-gnueabi-strip
。。。调用的完整输出为:

    configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-none
checking for arm-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
checking for arm-none-linux-gnueabi-gcc option to accept ANSI C... none needed
checking for a sed that does not truncate output... /bin/sed
checking for egrep... grep -E
checking for ld used by arm-none-linux-gnueabi-gcc... /usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld
checking if the linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
checking for /usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld option to reload object files... -r
checking for BSD-compatible nm... nm
checking whether ln -s works... yes
checking how to recognise dependent libraries... unknown
checking how to run the C preprocessor... arm-none-linux-gnueabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for arm-g++... arm-none-linux-gnueabi-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-none-linux-gnueabi-g++ accepts -g... yes
checking how to run the C++ preprocessor... arm-none-linux-gnueabi-g++ -E
checking for arm-g77... no
checking for arm-f77... no
checking for arm-xlf... no
checking for arm-frt... no
checking for arm-pgf77... no
checking for arm-fort77... no
checking for arm-fl32... no
checking for arm-af77... no
checking for arm-f90... no
checking for arm-xlf90... no
checking for arm-pgf90... no
checking for arm-epcf90... no
checking for arm-f95... no
checking for arm-fort... no
checking for arm-xlf95... no
checking for arm-ifc... no
checking for arm-efc... no
checking for arm-pgf95... no
checking for arm-lf95... no
checking for arm-gfortran... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse nm output from arm-none-linux-gnueabi-gcc object... ok
checking for objdir... .libs
checking for arm-ar... arm-none-linux-gnueabi-ar
checking for arm-ranlib... arm-none-linux-gnueabi-ranlib
checking for arm-strip... arm-none-linux-gnueabi-strip
checking if arm-none-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC
checking if arm-none-linux-gnueabi-gcc PIC flag -fPIC works... yes
checking if arm-none-linux-gnueabi-gcc static flag -static works... yes
checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
checking whether the arm-none-linux-gnueabi-gcc linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by arm-none-linux-gnueabi-g++... /usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld
checking if the linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
checking whether the arm-none-linux-gnueabi-g++ linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) supports shared libraries... no
checking for arm-none-linux-gnueabi-g++ option to produce PIC... -fPIC
checking if arm-none-linux-gnueabi-g++ PIC flag -fPIC works... yes
checking if arm-none-linux-gnueabi-g++ static flag -static works... yes
checking if arm-none-linux-gnueabi-g++ supports -c -o file.o... yes
checking whether the arm-none-linux-gnueabi-g++ linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) supports shared libraries... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for arm-gcc... (cached) arm-none-linux-gnueabi-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether arm-none-linux-gnueabi-gcc accepts -g... (cached) yes
checking for arm-none-linux-gnueabi-gcc option to accept ANSI C... (cached) none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether gcc accepts -fexceptions... yes
checking for ANSI C header files... (cached) yes
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for memmove... yes
checking for bcopy... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for off_t... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... no
checking for an ANSI C99-conforming __func__... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating expat_config.h
amarshall3@pg-oj-amarshall3:~/Sandbox/expat-2.0.0$ make
/bin/bash ./libtool --silent --mode=compile arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o lib/xmlparse.lo -c lib/xmlparse.c
/bin/bash ./libtool --silent --mode=compile arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o lib/xmltok.lo -c lib/xmltok.c
/bin/bash ./libtool --silent --mode=compile arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o lib/xmlrole.lo -c lib/xmlrole.c
/bin/bash ./libtool --silent --mode=link arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -no-undefined -version-info 6:0:5 -rpath /usr/local/lib  -o libexpat.la lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o xmlwf/xmlwf.o -c xmlwf/xmlwf.c
arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o xmlwf/xmlfile.o -c xmlwf/xmlfile.c
arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o xmlwf/codepage.o -c xmlwf/codepage.c
arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H   -o xmlwf/readfilemap.o -c xmlwf/readfilemap.c
xmlwf/readfilemap.c: In function 'filemap':
xmlwf/readfilemap.c:65: warning: implicit declaration of function 'read'
xmlwf/readfilemap.c:69: warning: implicit declaration of function 'close'
/bin/bash ./libtool --silent --mode=link arm-none-linux-gnueabi-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H    -o xmlwf/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/readfilemap.o libexpat.la
有人能给我解释一下
configure
如何决定libtool是否支持构建共享库吗?

从输出:

checking build system type... i686-pc-linux-gnu checking host system type... arm-unknown-none ... checking whether the arm-none-linux-gnueabi-gcc linker (/usr/local/arm/arm-2007q1/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes ... checking if libtool supports shared libraries... no checking whether to build shared libraries... no checking whether to build static libraries... yes 正在检查生成系统类型。。。i686 pc linux gnu 正在检查主机系统类型。。。手臂未知无 ... 正在检查arm none linux gnueabi gcc链接器(/usr/local/arm/arm-2007q1/arm none linux gnueabi/bin/ld)是否支持共享库。。。对 ... 正在检查libtool是否支持共享库。。。不 正在检查是否生成共享库。。。不 正在检查是否生成静态库。。。对
libtool可能被您的主机标志弄糊涂了:
--host=arm
,对于libtool来说,它与
--host=arm unknown none
相同。请改为尝试
--host=arm none linux
。IIRC,
arm unknown none
用于那些希望为MCU和其他嵌入式电路板做非RTOS(主回路)类型的工作的人,这些电路板没有操作系统,所有东西都静态链接到一个映像中。您的工具链是为Linux构建的:
arm none Linux

如果您使用自制软件作为软件包管理器,请注意,有些公式是从编译为32位最低公分母的瓶子中倒入的。您可以使用以下命令将libtool重新构建到本机体系结构

$brew安装--从源代码构建
libtool`

或者仅仅通过传递任何有效的标志

$brew安装--通用libtool


大多数公式都有
--universal
标志,它将生成i386和x86_64体系结构

你不使用2.0.1有什么特别的原因吗?手动构建expat也很容易,因为您需要lib/xmlparse.c、lib/xmlrole.c和lib/xmltok.c。您可以使用-DUSE_mmap。。。可能也需要从某个地方复制expat_config.h:)我坚持使用2.0.0(至少目前是这样),因为我正在从一个基于linux的嵌入式系统迁移到另一个运行在不同体系结构上的系统,我希望尽量减少对代码的更改。我正试图让交叉编译同时适用于这两种平台,这样我只需要修改两种平台的单个代码库。如果我需要为不同的平台交叉编译,
--host
的参数语法是否有文档记录?@Cuadue,有文档记录。tarball附带的
config.sub
文件是该tarball的“最终”列表(直到它与更高版本的autotools打包)。最有用的信息将来自编译器前缀(和其他binutil)的命名方式(在本例中
armnonelinuxgnueabi-
)。