【问题标题】:cross compiling of openssl for linux arm-v5te-linux-gnueabi toolchain交叉编译openssl for linux arm-v5te-linux-gnueabi 工具链
【发布时间】:2013-03-21 03:40:11
【问题描述】:

openssl for linux arm-v5te-linux-gnueabi 工具链的交叉编译。 我有版本 openssl-0.9.8r 我试过了

./Configure --prefix=/usr --openssldir=/usr/sbin threads zlib shared no-asm linux-armv4

export CROSS_COMPILE=arm-v5te-linux-gnueabi-

但无济于事。

我非常需要将其交叉编译为 openssl 二进制文件的基本步骤。 我已经在链接中尝试了多个建议,因此迫切需要提出一个新问题。

请帮忙

【问题讨论】:

    标签: openssl arm cross-compiling


    【解决方案1】:

    这个有效:

    ./Configure linux-generic32 shared  -DL_ENDIAN --prefix=/home --openssldir=/home
    make CC=arm-v4t-linux-gnueabi-gcc RANLIB=arm-v4t-linux-gnueabi-ranlib LD=arm-v4t-linux-gnueabi-ld MAKEDEPPROG=arm-v4t-linux-gnueabi-gcc PROCESSOR=ARM
    

    【讨论】:

    • 不错。您应该考虑将 openssl 升级到较新的版本,以便您可以使用 ./Configure linux-arm 启用 ARM 优化。见bugs.debian.org/cgi-bin/bugreport.cgi?bug=676533
    • @ChristopheVu-Brugier 我们如何在应用程序中进一步使用它,因为我的问题在链接stackoverflow.com/questions/24671252/… 帮助我解决这个问题
    • 使用./Configure --cross-compiler-prefix=arm-v4t-linux-gnueabi- ... 然后make可以不带所有选项使用。
    • 以上评论对我不起作用 - 设置 CROSS_COMPILE 可以。
    【解决方案2】:

    我遇到了同样的问题,写了一本关于如何交叉编译openssl for arm的手册。我希望这本手册可以给你一些想法:

    这个过程非常简单。在本手册中,我们将给出一个在 Ubuntu Linux 系统中交叉编译 OPENSSL for ARM 架构的示例。

    1. 交叉编译器

    您将需要适用于 ARM 架构的 GNU C/C++ 编译器:

    $ sudo apt-get install gcc-4.8-arm-linux-gnueabihf g++-4.8-arm-linux-gnueabihf

    1. openssl 源代码(1.1.1 版)

    我们将构建的 openssl 位于 https://github.com/openssl/openssl

    $ git clone https://github.com/openssl/openssl.git

    1. 配置

    进入openssl文件夹,执行./configure如下:

    $ ./配置 linux-armv4 --prefix=/usr/local/openssl/ --openssldir=/usr/local/openssl 共享

    此配置设置目标平台 linux-armv4,这是此 openssl 支持的唯一可用 ARM 平台。 --prefix=/usr/local/openssl 告诉放置安装文件的位置。 --openssldir=/usr/local/openssl 定义了 openssl 安装的根目录。 shared 使编译器生成 .so 库文件。文件夹 openssl 下的 INSTALL 文档包含 ./Configure 的参数。

    1. 编译

    $ make CC=arm-linux-gnueabihf-gcc-4.8

    CC 告诉使用什么交叉编译器。默认编译器是 gcc。

    1. 安装

    $ 安装

    1. 输出

    安装后会在/usr/local/openssl下找到以下文件和文件夹

    $ ls /usr/local/openssl

    ct_log_list.cnf

    包括

    杂项

    openssl.cnf.dist

    分享证书

    ct_log_list.cnf.dist

    openssl.cnf

    私人

    1. 结束

    确保为 ARM 构建可执行二进制文件:

    $ 文件 /usr/local/openssl/bin/openssl

    install-arm/bin/openssl:ELF 32 位 LSB 可执行文件,ARM,EABI5 版本 1 (SYSV),动态链接,解释器 /lib/ld-linux-armhf.so.3,适用于 GNU/Linux 3.2。 0、BuildID[sha1]=a23306c9c8bd553183fc20a37a60dcac8291da91,未剥离

    如果您看到与上图类似的内容,则您已成功交叉编译了适用于 ARM 系统的 openssl。

    【讨论】:

    • 在使用./Configure linux-armv4 --openssldir=$INSTALL_DIR --cross-compile-prefix=arm-none-eabi- 进行配置后,我尝试了make depend,但失败:make[1]: Entering directory '/home/AB/Documents/CROSS_COMPILED_SCA/openssl-1.0.2p/crypto' In file included from /usr/include/newlib/dirent.h:6:0, from LPdir_unix.c:32, from o_dir.c:78: /usr/include/newlib/sys/dirent.h:10:2: error: #error "<dirent.h> not supported" #error "<dirent.h> not supported" ^ Makefile:136: recipe for target 'local_depend' failed make[1]: *** [local_depend] Error 1'
    【解决方案3】:
    ./Configure linux-armv4 --cross-compile-prefix=arm-v5te-linux-gnueabi- --prefix=/usr
    make
    

    【讨论】:

      猜你喜欢
      • 2015-12-20
      • 2014-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-20
      • 2018-01-18
      • 1970-01-01
      • 2012-07-10
      相关资源
      最近更新 更多