zoukankan      html  css  js  c++  java
  • Relocations in generic ELF (EM: 40)

    最近在搞机器上的wifi热点,需要移植一大堆东西,如hostapdwpa_suppliant、dhcp等,这些玩意又依赖其他的一大堆库的移植,比如libnl,openssl等,今天在移植编译libnl-3.4.0出现报错“Relocations in generic ELF (EM: 40)”

    详细log如下:

    void@void-ThinkPad-E450:~$ tar -xvf libnl-3.4.0.tar.gz
    void@void-ThinkPad-E450:~/libnl-3.4.0$ sudo mkdir /usr/local/arm/libnl3.4
    void@void-ThinkPad-E450:~$ cd libnl-3.4.0/
    void@void-ThinkPad-E450:~/libnl-3.4.0$ ./configure --host=arm-linux –prefix=/usr/local/arm/libnl3.4
    void@void-ThinkPad-E450:~/libnl-3.4.0$ sudo make CC=/usr/local/arm/gcc-linaro/bin/arm-linux-gnueabi-gcc
      CC       lib/lib_libnl_3_la-addr.lo
      CC       lib/lib_libnl_3_la-attr.lo
      CC       lib/lib_libnl_3_la-cache.lo
      CC       lib/lib_libnl_3_la-cache_mngr.lo
      CC       lib/lib_libnl_3_la-cache_mngt.lo
      CC       lib/lib_libnl_3_la-data.lo
      CC       lib/lib_libnl_3_la-error.lo
      CC       lib/lib_libnl_3_la-handlers.lo
      CC       lib/lib_libnl_3_la-msg.lo
      CC       lib/lib_libnl_3_la-nl.lo
      CC       lib/lib_libnl_3_la-object.lo
      CC       lib/lib_libnl_3_la-socket.lo
      CC       lib/lib_libnl_3_la-utils.lo
      CC       lib/lib_libnl_3_la-version.lo
      CC       lib/lib_libnl_3_la-hash.lo
      CC       lib/lib_libnl_3_la-hashtable.lo
      CC       lib/lib_libnl_3_la-mpls.lo
      CCLD     lib/libnl-3.la
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    /usr/bin/ld: lib/.libs/lib_libnl_3_la-addr.o: Relocations in generic ELF (EM: 40)
    lib/.libs/lib_libnl_3_la-addr.o: error adding symbols: File in wrong format
    collect2: error: ld returned 1 exit status
    make: *** [lib/libnl-3.la] Error 1

    经过查找资料,了解到应该是前后编译器不一样导致,因为在未设置交叉编译器之前我make过一次,失败之后再去配置的,所以只需要clean干净,然后统一用新的交叉编译器编译次即可

    void@void-ThinkPad-E450:~/libnl-3.4.0$ ./configure --host=arm-linux --prefix=/usr/local/arm/libnl3.4 CC=/usr/local/arm/gcc-linaro/bin/arm-linux-gnueabi-gcc
    
    
    
    void@void-ThinkPad-E450:~/libnl-3.4.0$ sudo make
    
    
    void@void-ThinkPad-E450:~/libnl-3.4.0$ sudo make install
    …........................................
    Libraries have been installed in:
       /usr/local/arm/libnl3.4/lib/libnl/cli/qdisc
    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the '-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
         during execution
       - add LIBDIR to the 'LD_RUN_PATH' environment variable
         during linking
       - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
       - have your system administrator add LIBDIR to '/etc/ld.so.conf'
    
    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
     /bin/mkdir -p '/usr/local/arm/libnl3.4/etc/libnl'
     /usr/bin/install -c -m 644 etc/pktloc etc/classid '/usr/local/arm/libnl3.4/etc/libnl'
    make[1]: Leaving directory `/home/void/libnl-3.4.0'

    如上则已经成功编译安装。

  • 相关阅读:
    Codeforces1101G (Zero XOR Subset)-less 【线性基】【贪心】
    Codeforces1101F Trucks and Cities 【滑动窗口】【区间DP】
    HDU4651 Partition 【多项式求逆】
    BZOJ2554 color 【概率DP】【期望DP】
    codeforces1101D GCD Counting 【树形DP】
    codechef EBAIT Election Bait【欧几里得算法】
    BZOJ2434 [NOI2011] 阿狸的打字机 【树链剖分】【线段树】【fail树】【AC自动机】
    codeforces1093G Multidimensional Queries 【线段树】
    BZOJ3277 串 【后缀数组】【二分答案】【主席树】
    AHOI2013 差异 【后缀数组】
  • 原文地址:https://www.cnblogs.com/tid-think/p/9105677.html
Copyright © 2011-2022 走看看