交叉编译Apache用于ARM APR-util的库 - Linux平台

问题描述:

的第一篇文章〜交叉编译Apache用于ARM APR-util的库 - Linux平台

我试图端口的ActiveMQ-CPP客户到ARM平台(Beaglebone/BeagleBoard的) - 因为我做我的开发在我的PC上,我需要交叉编译ActiveMQ-cpp库才能在ARM系统上运行。

我按照通过在其building instruction的步骤,不同之处予编译APR和APR-util的文库使用如下:

对于APR:

的./configure前缀=的/ usr /臂-linux-gnueabi/apr --host = arm-linux-gnueabi CC =“arm-linux-gnueabi-gcc”CXX =“arm-linux-gnueabi-g ++” 我运行make install,事情都很好。

对于APR-util的:

的./configure前缀=/USR /臂-Linux的gnueabi/APR-util的--host =臂-Linux的gnueabi -with-APR =的/ usr /臂-linux-gnueabi/APR CC = “武装-Linux的gnueabi-GCC” CXX = “武装-Linux的gnueabi-G ++” 我运行make安装并得到这个:

/home/peter/apache/Apache_apr/apr-util-1.5.1/xml/expat/.libs/libexpat.so: could not read symbols: File in wrong format 

一些搜索后,我认为”这个问题是在的libexpat格式错误作为

我的问题是(编译i386的?):如何我正确编译的ActiveMQ-CPP库甲A RM-平台?有什么方法可以修复libexpat.so吗?或跳过Apr-util?或者Apr-util的./configure中的一些选项?

后续: 以下是运行配置日志文件:

checking build system type... i686-pc-linux-gnu 
checking host system type... arm-unknown-linux-gnueabi 
checking target system type... arm-unknown-linux-gnueabi 
checking for a BSD-compatible install... /usr/bin/install -c 
checking for working mkdir -p... yes 
APR-util Version: 1.5.1 
checking for chosen layout... apr-util 
checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... yes 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether arm-linux-gnueabi-gcc accepts -g... yes 
checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed 
Applying apr-util hints file rules for arm-unknown-linux-gnueabi 
checking for APR... yes 
    setting CPP to "gcc -E" 
    adding "-pthread" to CFLAGS 
    setting CPPFLAGS to " -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE" 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -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 for ldap support... 
checking for default DBM... sdbm (default) 
checking for pg_config... no 
checking libpq-fe.h usability... no 
checking libpq-fe.h presence... no 
checking for libpq-fe.h... no 
checking postgresql/libpq-fe.h usability... no 
checking postgresql/libpq-fe.h presence... no 
checking for postgresql/libpq-fe.h... no 
checking sqlite3.h usability... no 
checking sqlite3.h presence... no 
checking for sqlite3.h... no 
checking sqlite.h usability... no 
checking sqlite.h presence... no 
checking for sqlite.h... no 
checking sybdb.h usability... no 
checking sybdb.h presence... no 
checking for sybdb.h... no 
checking freetds/sybdb.h usability... no 
checking freetds/sybdb.h presence... no 
checking for freetds/sybdb.h... no 
checking for odbc_config... no 
checking sql.h usability... no 
checking sql.h presence... no 
checking for sql.h... no 
checking odbc/sql.h usability... no 
checking odbc/sql.h presence... no 
checking for odbc/sql.h... no 
checking Expat 1.95.x... no 
checking old Debian-packaged expat... no 
checking old FreeBSD-packaged expat... no 
checking Expat 1.0/1.1... no 
    setting LDFLAGS to "-L/usr/local/lib" 
    adding "-I/usr/local/include" to CPPFLAGS 
checking Expat 1.95.x in /usr/local... no 
    nulling LDFLAGS 
    removed "-I/usr/local/include" from CPPFLAGS 
configuring package in xml/expat now 
checking build system type... i686-pc-linux-gnu 
checking host system type... arm-unknown-linux-gnueabi 
checking target system type... arm-unknown-linux-gnueabi 
checking how to print strings... printf 
checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... yes 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether arm-linux-gnueabi-gcc accepts -g... yes 
checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed 
checking for a sed that does not truncate output... /bin/sed 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for fgrep... /bin/grep -F 
checking for ld used by arm-linux-gnueabi-gcc... /usr/arm-linux-gnueabi/bin/ld 
checking if the linker (/usr/arm-linux-gnueabi/bin/ld) is GNU ld... yes 
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/arm-linux-gnueabi-nm -B 
checking the name lister (/usr/bin/arm-linux-gnueabi-nm -B) interface... BSD nm 
checking whether ln -s works... yes 
checking the maximum length of command line arguments... 1572864 
checking whether the shell understands some XSI constructs... yes 
checking whether the shell understands "+="... yes 
checking how to convert i686-pc-linux-gnu file names to arm-unknown-linux-gnueabi format... func_convert_file_noop 
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop 
checking for /usr/arm-linux-gnueabi/bin/ld option to reload object files... -r 
checking for arm-linux-gnueabi-objdump... objdump 
checking how to recognize dependent libraries... pass_all 
checking for arm-linux-gnueabi-dlltool... dlltool 
checking how to associate runtime and link libraries... printf %s\n 
checking for arm-linux-gnueabi-ar... arm-linux-gnueabi-ar 
checking for archiver @FILE support... @ 
checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip 
checking for arm-linux-gnueabi-ranlib... arm-linux-gnueabi-ranlib 
checking for gawk... no 
checking for mawk... mawk 
checking command to parse /usr/bin/arm-linux-gnueabi-nm -B output from arm-linux-gnueabi-gcc object... ok 
checking for sysroot... no 
checking for arm-linux-gnueabi-mt... no 
checking for mt... mt 
configure: WARNING: using cross tools not prefixed with host triplet 
checking if mt is a manifest tool... no 
checking how to run the C preprocessor... arm-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 for dlfcn.h... yes 
checking for objdir... .libs 
checking if arm-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no 
checking for arm-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC 
checking if arm-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes 
checking if arm-linux-gnueabi-gcc static flag -static works... yes 
checking if arm-linux-gnueabi-gcc supports -c -o file.o... yes 
checking if arm-linux-gnueabi-gcc supports -c -o file.o... (cached) yes 
checking whether the arm-linux-gnueabi-gcc linker (/usr/arm-linux-gnueabi/bin/ld) supports shared libraries... yes 
checking whether -lc should be explicitly linked in... no 
checking dynamic linker characteristics... GNU/Linux ld.so 
checking how to hardcode library paths into programs... immediate 
checking whether stripping libraries is possible... yes 
checking if libtool supports shared libraries... yes 
checking whether to build shared libraries... yes 
checking whether to build static libraries... yes 
checking for arm-linux-gnueabi-gcc... (cached) arm-linux-gnueabi-gcc 
checking whether we are using the GNU C compiler... (cached) yes 
checking whether arm-linux-gnueabi-gcc accepts -g... (cached) yes 
checking for arm-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed 
checking for a BSD-compatible install... /usr/bin/install -c 
checking for ANSI C header files... (cached) yes 
checking for an ANSI C-conforming const... yes 
checking for size_t... yes 
checking for memmove... yes 
checking for bcopy... yes 
checking check.h usability... no 
checking check.h presence... no 
checking for check.h... no 
configure: creating ./config.status 
config.status: creating Makefile 
config.status: creating expat_config.h 
config.status: expat_config.h is unchanged 
config.status: executing libtool commands 
xml/expat configured properly 
    setting APRUTIL_INCLUDES to "-I/home/jacky/apache/Apache_apr/apr-util-1.5.1/xml/expat/lib" 
    setting LDFLAGS to "-L/home/jacky/apache/Apache_apr/apr-util-1.5.1/xml/expat/lib" 
    setting APRUTIL_EXPORT_LIBS to "/home/jacky/apache/Apache_apr/apr-util-1.5.1/xml/expat/libexpat.la" 
    setting APRUTIL_LIBS to "/home/jacky/apache/Apache_apr/apr-util-1.5.1/xml/expat/libexpat.la" 
checking iconv.h usability... yes 
checking iconv.h presence... yes 
checking for iconv.h... yes 
checking for type of inbuf parameter to iconv... char ** 
checking for iconv.h... (cached) yes 
checking langinfo.h usability... yes 
checking langinfo.h presence... yes 
checking for langinfo.h... yes 
checking for nl_langinfo... yes 
checking for CODESET in langinfo.h... yes 
checking whether APR has DSO support... yes 
checking for library containing crypt... -lcrypt 
checking if system crypt() function is threadsafe... no 
checking for crypt_r... yes 
checking style of crypt_r... struct_crypt_data 
    adding "/usr/arm-linux-gnueabi/apr/lib/libapr-1.la" to APRUTIL_LIBS 
    adding "-luuid" to APRUTIL_LIBS 
    adding "-lrt" to APRUTIL_LIBS 
    adding "-lcrypt" to APRUTIL_LIBS 
    adding "-lpthread" to APRUTIL_LIBS 
    adding "-ldl" to APRUTIL_LIBS 
configure: creating ./config.status 
config.status: creating Makefile 
config.status: creating export_vars.sh 
config.status: creating build/pkg/pkginfo 
config.status: creating apr-util.pc 
config.status: creating apu-1-config 
config.status: creating include/private/apu_select_dbm.h 
config.status: creating include/apr_ldap.h 
config.status: creating include/apu.h 
config.status: creating include/apu_want.h 
config.status: creating test/Makefile 
config.status: creating include/private/apu_config.h 
config.status: executing default commands 

从我所看到的,XML /外籍配置正确。我想 - 也许我需要在gcc-arm-linux中编译expat库?我继续这样做,然后再次运行配置:

./configure --prefix =/usr/arm-linux-gnueabi/apr-util --host = arm-linux-gnueabi -with-apr =/usr/arm-linux-gnueabi/apr -with-expat =/usr/arm-linux-gnueabi/expat CC =“arm-linux-gnueabi-gcc”CXX =“arm-linux-gnueabi-g ++”

我得到了类似的结果在日志中,除了我现在有外籍1.95.x:

checking for odbc/sql.h... no 
    setting LDFLAGS to "-L/usr/arm-linux-gnueabi/expat/lib" 
    adding "-I/usr/arm-linux-gnueabi/expat/include" to CPPFLAGS 
    setting APRUTIL_INCLUDES to "-I/usr/arm-linux-gnueabi/expat/include" 
    setting APRUTIL_LDFLAGS to "-L/usr/arm-linux-gnueabi/expat/lib" 
checking Expat 1.95.x... yes 
    setting APRUTIL_EXPORT_LIBS to "-lexpat" 
    setting APRUTIL_LIBS to "-lexpat" 

运行make,发生同样的错误。

我搜索了与libexpat.so相关的错误。我注意到那些想要交叉编译的人通常会看到这个“libexpat.so”错误:centos 5.2 64bits,或至少64位的其他情况。

下面是实际导致错误的命令:

make[1]: Entering directory `/home/jacky/apache/Apache_apr/apr-util-1.5.1' 
/bin/bash /usr/arm-linux-gnueabi/apr/build-1/libtool --silent --mode=link gcc -g -O2 -pthread -DHAVE_CONFIG_H -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/home/jacky/apache/Apache_apr/apr-util-1.5.1/include -I/home/jacky/apache/Apache_apr/apr-util-1.5.1/include/private -I/usr/arm-linux-gnueabi/apr/include/apr-1 -I/usr/arm-linux-gnueabi/expat/include -version-info 5:1:5 -o libaprutil-1.la -rpath /usr/arm-linux-gnueabi/apr-util/lib buckets/apr_brigade.lo buckets/apr_buckets.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_file.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_heap.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo buckets/apr_buckets_socket.lo crypto/apr_crypto.lo crypto/apr_md4.lo crypto/apr_md5.lo crypto/apr_passwd.lo crypto/apr_sha1.lo crypto/crypt_blowfish.lo crypto/getuuid.lo crypto/uuid.lo dbd/apr_dbd.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_stub.lo ldap/apr_ldap_url.lo memcache/apr_memcache.lo misc/apr_date.lo misc/apr_queue.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_thread_pool.lo misc/apu_dso.lo misc/apu_version.lo strmatch/apr_strmatch.lo uri/apr_uri.lo xlate/xlate.lo xml/apr_xml.lo -luuid -lrt -lcrypt -lpthread -ldl -L/usr/arm-linux-gnueabi/expat/lib -lexpat /usr/arm-linux-gnueabi/apr/lib/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl 
/usr/arm-linux-gnueabi/expat/lib/libexpat.so: could not read symbols: File in wrong format 
collect2: ld returned 1 exit status 
make[1]: *** [libaprutil-1.la] Error 1 
make[1]: Leaving directory `/home/jacky/apache/Apache_apr/apr-util-1.5.1' 
make: *** [all-recursive] Error 1 

非常感谢您的帮助!

+1

您应该保存并检查'configure'程序输出的日志文件。顺便说一句,用于构建各种软件包我喜欢用'$ ./configure --target = arm-linux --host = arm-linux --build = i386-pc-linux-gnu ...' – sawdust

看来你有一些图书馆建立在不同的格式。由此你得到的错误: 文件格式错误 collect2:ld返回1退出状态 运行文件命令通过/usr/arm-linux-gnueabi/expat/lib/libexpat.so 如果它显示了一些不同格式,那么你需要重建它。 但它的奇怪,因为我认为它是一个预先建立的手臂库,它应该是在正确的格式。