编译加密++时为ARMHF链接错误 [英] Linking error when compiling Crypto++ for ARMHF

查看:942
本文介绍了编译加密++时为ARMHF链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译++库为armhf架构上运行的加密。我按照此回答提供的方法。我调整了 setenv-embed.sh 来配合我的系统配置。运行的输出。 ./setenv-embed.sh

  CPP:在/ usr / bin中/ ARM-Linux的gnueabihf-CPP
CXX:在/ usr / bin中/ ARM-Linux的gnueabihf-G ++
AR:在/ usr / bin中/ ARM-Linux的gnueabihf-AR
LD:在/ usr / bin中/ ARM-Linux的gnueabihf-LD
RANLIB:/usr/bin/arm-linux-gnueabihf-gcc-ranlib-4.8ARM_EMBEDDED_TOOLCHAIN​​:在/ usr / bin中
ARM_EMBEDDED_CXX_HEADERS:/usr/arm-linux-gnueabihf/include/c++/4.8.2
ARM_EMBEDDED_FLAGS:-march =的ARMv7-A mfloat-ABI =硬-mfpu =霓虹灯-I的/ usr / ARM-Linux的gnueabihf /有/ C ++ / 4.8.2 -I的/ usr / ARM-Linux的gnueabihf /有/ C ++ / 4.8.2 / ARM-Linux的gnueabihf
ARM_EMBEDDED_SYSROOT:在/ usr / ARM-Linux的gnueabihf

这表明正确的编译器已被发现。然而,当我使用使构建库我碰到下面的错误

  /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8 /../../../../臂Linux的gnueabihf /斌/ LD:找不到/usr/arm-linux-gnueabihf/lib/libc.so.6里面的/ usr / ARM-Linux的gnueabihf
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ LD:无法找到的/ usr / ARM-Linux的gnueabihf / lib目录/里面的/ usr / ARM-Linux的gnueabihf libc_nonshared.a
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ LD:无法找到的/ usr / ARM-Linux的gnueabihf / lib目录/里面的/ usr / ARM-Linux的gnueabihf LD-Linux的armhf.so.3

但是,当我打开位置的/ usr / ARM-Linux的gnueabihf / lib目录我可以找到所有以上即提到的三个错误文件的libc .so.6 libc_nonshared.a LD-Linux的armhf.so.3

我试图编译Beaglebone库,有没有什么帮助。

更新1:

运行的结果使-f GNUmakefile交叉系统做一个新的混帐拉后

 哈桑哈桑@  - 灵-7537:〜/ cryptopp-armhf $化妆-f GNUmakefile交叉系统
CXX:在/ usr / bin中/ ARM-Linux的gnueabihf-G ++
CXXFLAGS:-DNDEBUG -g2 -Os -Wall -Wextra -DCRYPTOPP_DISABLE_ASM -march =的ARMv7-A -mfloat-ABI =硬-mfpu =霓虹灯-mthumb -I的/ usr / ARM-Linux的gnueabihf /有/ C ++ / 4.8.2 -I的/ usr / ARM-Linux的gnueabihf /有/ C ++ / 4.8.2 / ARM-Linux的gnueabihf --sysroot =的/ usr / ARM-Linux的gnueabihf -Wno型限制-Wno-未知编译指示
LDLIBS:
GCC_COMPILER:1
CLANG_COMPILER:0
INTEL_COMPILER:0
UNALIGNED_ACCESS:
UNAME:Linux的哈桑-的Inspiron - 7537 3.13.0-35泛型#62,Ubuntu的SMP周五8月15日1时58分42秒UTC 2014年的x86_64 x86_64的x86_64的GNU / Linux的
机:
系统:
发布:
令:为'系统'做什么也没有。


解决方案

这个问题很简单。它是在 - SYSROOT 选项。此选项的值为的/ usr / ARM-Linux的gnueabihf / ,它是用来链接器和所产生的库文件夹变
的/ usr / ARM-Linux的gnueabihf的/ usr / ARM-Linux的gnueabihf / lib目录/

我删除了 - 从68行中的文件GNUmakefile交叉SYSROOT 选项和一切编译和链接确定

不过,我不能在我的BeagleBone黑色运行,因为某些共享库的版本不匹配的例子。但是,这不是一个真正的问题对我来说,因为在我的应用程序链接加密++静态而非动态。

I'm trying to compile the crypto++ library to run for the armhf architecture. I'm following the method provided in this answer. I tweaked the setenv-embed.sh to match my system's configuration. The output of running . ./setenv-embed.sh is

CPP: /usr/bin/arm-linux-gnueabihf-cpp 
CXX: /usr/bin/arm-linux-gnueabihf-g++
AR: /usr/bin/arm-linux-gnueabihf-ar
LD: /usr/bin/arm-linux-gnueabihf-ld
RANLIB: /usr/bin/arm-linux-gnueabihf-gcc-ranlib-4.8

ARM_EMBEDDED_TOOLCHAIN: /usr/bin
ARM_EMBEDDED_CXX_HEADERS: /usr/arm-linux-gnueabihf/include/c++/4.8.2
ARM_EMBEDDED_FLAGS: -march=armv7-a mfloat-abi=hard -mfpu=neon -I/usr/arm-linux-gnueabihf/include/c++/4.8.2 -I/usr/arm-linux-gnueabihf/include/c++/4.8.2/arm-linux-gnueabihf 
ARM_EMBEDDED_SYSROOT: /usr/arm-linux-gnueabihf

which indicates that the correct compilers have been found. However, when I build the library using make I run into the following error

/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/‌​ld: cannot find /usr/arm-linux-gnueabihf/lib/libc.so.6 inside /usr/arm-linux-gnueabihf
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/‌​ld: cannot find /usr/arm-linux-gnueabihf/lib/libc_nonshared.a inside /usr/arm-linux-gnueabihf        
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/‌​ld: cannot find /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 inside /usr/arm-linux-gnueabihf

But when I open the location /usr/arm-linux-gnueabihf/lib I can find all the three error files mentioned above ie libc.so.6, libc_nonshared.a and ld-linux-armhf.so.3

I'm trying to compile the library for Beaglebone, if that helps.

Update 1:

The results of running make -f GNUmakefile-cross system after doing a fresh git pull

hassan@hassan-Inspiron-7537:~/cryptopp-armhf$ make -f GNUmakefile-cross system
CXX: /usr/bin/arm-linux-gnueabihf-g++
CXXFLAGS: -DNDEBUG -g2 -Os -Wall -Wextra -DCRYPTOPP_DISABLE_ASM -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -I/usr/arm-linux-gnueabihf/include/c++/4.8.2 -I/usr/arm-linux-gnueabihf/include/c++/4.8.2/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf -Wno-type-limits -Wno-unknown-pragmas
LDLIBS: 
GCC_COMPILER: 1
CLANG_COMPILER: 0
INTEL_COMPILER: 0
UNALIGNED_ACCESS: 
UNAME: Linux hassan-Inspiron-7537 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
MACHINE: 
SYSTEM: 
RELEASE: 
make: Nothing to be done for `system'.

解决方案

The problem is simple. It is in the --sysroot option. The value of this option is /usr/arm-linux-gnueabihf/ and it is used by the linker and the resulting library folder becomes /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/

I removed the --sysroot option from line 68 in the file GNUmakefile-cross and everything compiled and linked OK.

However, I couldn't run the example on my BeagleBone Black because of mismatch of some shared libraries versions. But this wasn't a real problem for me, because in my application I link crypto++ statically, not dynamically.

这篇关于编译加密++时为ARMHF链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆