我用Raspberry Pi的C编写了一个简单的加密程序。它成功编译为我的X86 CPU与gcc encoder.c -lcrypto -o编码器(我安装了libssl-dev),但是当我想交叉编译它(使用arm-linux-gnueabihf-gcc)时,此错误发生:交叉编译openssl C应用时出错
$ arm-linux-gnueabihf-gcc encoder.c -lcrypto -o encoder
In file included from ./encoder.c:4:0:
/usr/include/openssl/aes.h:55:33: fatal error: openssl/opensslconf.h: No such file or directory
#include <openssl/opensslconf.h>
^
compilation terminated.
如何交叉编译openssl C应用程序的Raspberry Pi?
最简单的方法可能是通过SSH进入RPI并直接操作设备。默认凭证是用户名***'pi' ***和密码***'树莓***'。否则,您需要设置交叉编译的shell环境。您需要将工具链和标题放在路径上,并且需要设置一些变量,例如'CROSS_COMPILE'。检出[配置脚本]中的注释(http://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/Configure)。 – jww
谢谢。正如你所建议的那样,我不能直接将armhf软件包安装到x86系统中。这是一个类似的问题和理由:http://superuser.com/questions/1080869/how-do-i-download-a-debian-arm-package-from-another-computer – SAP
你需要直接访问设备本地构建或您需要交叉编译。如果您无法通过SSH连接到设备并且无法使用适当的工具链进行交叉编译,那么您无法为该设备构建程序。 – jww