How to compile openssl 1.0.2f on Beaglebone Black?

2019-03-02 09:35发布

问题:

Currently, I use command below to compile openssl 1.0.2f from openssl package:

$ tar xzf openssl-1.0.2e.tar.gz
$ cd openssl-1.0.2e
$export PREFIX={PREFIX}
$./Configure -DOPENSSL_NO_HEARTBEATS --openssldir=$PREFIX shared os/compiler:${TARGET}
$ make

This is architecture of Beaglebone Black

$uname -a
$Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux

I also try to set TARGET from list:

  • linux-armv7l || linux-aarch64 || linux-alpha+bwx-ccc || linux-alpha+bwx-gcc|| linux-alpha-ccc || linux-alpha-gcc || linux-aout || linux-armv4 || linux-elf || linux-generic32 || linux-generic64 || linux-ia32-icc || linux-ia64 ||linux-ia64-icc || linux-mips32 || linux-mips64 || linux-ppc || linux-ppc64 || linux-ppc64le ||linux-sparcv8 || linux-sparcv9 || linux-x32 || linux-x86_64 || linux-x86_64-clang || linux-x86_64-icc || linux32-s390x || linux64-mips64 || linux64-s390x || linux64-sparcv9

But when make openssl, it return:

make[1]: {TARGET}: Command not found

I also try set:

os/compiler:gcc

gcc version:

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2

But when make openssl, it return:

/bin/sh: 1: ./pod2mantest: Permission denied
installing man1/CA.pl.1
sh: 1: --section=1: not found
Makefile:634: recipe for target 'install_docs' failed
make: *** [install_docs] Error 127

Could you tell me what is wrong here?

回答1:

How to compile openssl 1.0.2f on Beaglebone Black?

I believe you want the linux-armv4 target.

$ ./Configure LIST | grep -i arm
android-armeabi
linux-arm64ilp32
linux-armv4

Also see Compilation and Installation on the OpenSSL wiki.


Its probably easiest to follow Leśny's advice and run ./config. config tries to guess at the target. If the guess is wrong, then use ./Configure with the triplet:

$ wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz
...
$ tar xzf openssl-1.0.2g.tar.gz
...
$ cd openssl-1.0.2g

And then (notice linux-armv4):

$ ./config shared no-ssl2 no-ssl3 no-comp -DOPENSSL_NO_HEARTBEATS                     
Operating system: armv7l-whatever-linux2
Configuring for linux-armv4
    no-comp         [option]   OPENSSL_NO_COMP (skip dir)
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-libunbound   [experimental] OPENSSL_NO_LIBUNBOUND (skip dir)
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE (skip dir)
    no-ssl2         [option]   OPENSSL_NO_SSL2 (skip dir)
    no-ssl3         [option]   OPENSSL_NO_SSL3 (skip dir)
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST (skip dir)
    no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS (skip dir)
    no-zlib         [default] 
    no-zlib-dynamic [default] 
    ...

You may need to fallback to something like this:

$./Configure linux-armv4 shared no-ssl2 no-ssl3 no-comp -DOPENSSL_NO_HEARTBEATS
...
$ make depend
...
$ make clean
...
$ make

For completeness, I was working from a BeagleBone Black using a Debian console image from December, 2015 (I needed the small, 2GB footprint so storage was available for other things):

$ uname -a
Linux beaglebone 4.1.15-ti-rt-r40 #1 SMP PREEMPT RT Thu Jan 7 23:32:08 UTC 2016 armv7l GNU/Linux