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'

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

  • 相关阅读:
    干货—MySQL常见的面试题+索引原理分析!
    如何设计一个百万级的消息推送系统
    【金三银四跳槽季】Java工程师如何在1个月内做好面试准备?
    Nginx实现请求的负载均衡 + keepalived实现Nginx的高可用
    java函数式编程之Supplier
    SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置
    Redis创建集群报错
    阿里云服务器Tomcat无法从外部访问
    SSM框架学习之高并发秒杀业务--笔记5-- 并发优化
    在windows上部署使用Redis
  • 原文地址:https://www.cnblogs.com/tid-think/p/9105677.html
Copyright © 2011-2022 走看看