• 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'

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

  • 相关阅读:
    2653 区间xor
    c++位运算
    洛谷P1233 木棍加工
    c++背包问题
    FOC基本调试方法[转]
    用于下载AD官网登录账号:User name: fuxin918@fuxin918.com Passeword: s6c0W1w8
    STC10F10XE定时器中断输出10KHz的方波程序
    学习DSP(三)安装C2833x/C2823x C/C++ 头文件和外设示例-压缩包
    学DSP(二):目标芯片28335,GO!
    学DSP(一):开始
  • 原文地址:https://www.cnblogs.com/tid-think/p/9105677.html
Copyright © 2020-2023  润新知