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'

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

  • 相关阅读:
    软件测试之功能测试简单介绍
    如果编程语言是女孩,你猜C语言是萝莉还是御姐?
    C++ C、C++、C#、VC、VC.net以及VC++有什么区别和联系?
    程序员如何避免陷入内卷?从以下三个方面着手
    懒惰使人进步,UNIX 和 Linux 新系统的诞生只是意外
    编程学习必备:C++ 学习的 11 本经典书籍推荐
    初入职场,菜鸟程序员如何才能成为业界大牛,给你提供思路方法。
    TIOBE 12月编程语言: Python、Java战况激烈, C语言:我自岿然不动
    C++基础知识篇:C++ 数字
    二本毕业程序员鄙视清北毕业生,嘲笑水货一抓一大把,你怎么看?
  • 原文地址:https://www.cnblogs.com/tid-think/p/9105677.html
Copyright © 2011-2022 走看看