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

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

问题描述

我正在尝试编译crypto ++库来运行armhf架构。我遵循此答案中提供的方法。我调整了 setenv-embed.sh 以匹配我的系统配置。运行的输出。 ./setenv-embed.sh

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

,表示已找到正确的编译器。但是,当我使用 make 构建库时,遇到以下错误

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

但是当我打开位置 / usr / arm-linux-gnueabihf / lib 我可以找到上面提到的所有三个错误文件ie libc.so.6 libc_nonshared.a ld-linux-armhf.so.3

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

我正在为Beaglebone编译库,如果那个hel ps。

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

更新1:

运行 make -f GNUmakefile-cross系统在执行新的 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'.


推荐答案

问题很简单。它位于 - sysroot 选项中。该选项的值为 / usr / arm-linux-gnueabihf / ,由链接器使用,生成的库文件夹将成为
/ usr / arm-linux-gnueabihf / usr / arm-linux-gnueabihf / lib /

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/

我删除了 - sysroot 选项从第68行文件GNUmakefile-cross和所有编译和链接确定。

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

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

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编译Crypto ++时链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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