【发布时间】:2016-07-31 12:31:48
【问题描述】:
我用 C 语言为 Raspberry Pi 编写了一个简单的加密程序。它使用 gcc encoder.c -lcrypto -o encoder 成功为我的 X86 CPU 编译(我安装了 libssl-dev),但是当我想交叉编译它时(使用 arm-linux-gnueabihf- gcc),就会出现这个错误:
$ 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.
如何为 Raspberry Pi 交叉编译 openssl C 应用程序?
【问题讨论】:
-
最简单的方法可能是通过 SSH 进入 RPI 并直接从设备工作。默认凭据是用户名
pi和密码raspberry。否则,您需要为交叉编译设置 shell 环境。您需要将工具链和标题放在路径上,并且需要设置一些变量,例如CROSS_COMPILE。查看Configure script中的cmets。 -
谢谢。正如你所建议的,我不能将 armhf 包直接安装到 x86 系统中。这是一个类似的问题和理由:superuser.com/questions/1080869/…
-
您需要直接访问设备以进行本机构建,或者您需要交叉编译。如果您无法通过 SSH 连接到设备并且无法使用适当的工具链进行交叉编译,那么您就无法为设备构建程序。
标签: openssl raspberry-pi cross-compiling