0

I'm using freebsd AMD64 and tried to cross compile openssl for my nanopi R2S running on ARM64 BSD-generic32.

This is what I've tried so far:

  1. I tried to run different command since im building for bare metal aarch64 as below:

    pkg install aarch64-none-elf-gcc

    ./Configure BSD-generic32 shared --prefix=/opt/openssl-custom --openssldir=/opt/openssl-custom -Wl,-rpath=/opt/openssl-custom/lib
    
     make CC=/usr/local/bin/aarch64-none-elf-gcc RANLIB=/usr/local/bin/aarch64-none-elf-gcc MAKEDEPPROG=/usr/local/bin/aarch64-none-elf-gcc PROCESSOR=ARM
    

The error stated that:

root@Client_Site1:~/Work File/openssl-1_1_k-custom-master/openssl-1_1_k-custom-master # make CC=/usr/l                                                                                                                        ocal/bin/aarch64-none-elf-gcc RANLIB=/usr/local/bin/aarch64-none-elf-gcc MAKEDEPPROG=/usr/local/bin/aa                                                                                                                        rch64-none-elf-gcc PROCESSOR=ARM
/usr/local/bin/perl "-I." -Mconfigdata "util/dofile.pl"  "-oMakefile" include/crypto/bn_conf.h.in > in                                                                                                                        clude/crypto/bn_conf.h
/usr/local/bin/perl "-I." -Mconfigdata "util/dofile.pl"  "-oMakefile" include/crypto/dso_conf.h.in > i                                                                                                                        nclude/crypto/dso_conf.h
/usr/local/bin/perl "-I." -Mconfigdata "util/dofile.pl"  "-oMakefile" include/openssl/opensslconf.h.in                                                                                                                         > include/openssl/opensslconf.h
make depend && make _all
/usr/local/bin/perl util/mkbuildinf.pl "/usr/local/bin/aarch64-none-elf-gcc -fPIC -pthread -Wa,--noexe                                                                                                                        cstack -Qunused-arguments -Wall -O3 -DOPENSSL_PIC -D_THREAD_SAFE -D_REENTRANT -DNDEBUG" "BSD-generic32                                                                                                                        " > crypto/buildinf.h
/usr/local/bin/aarch64-none-elf-gcc  -I. -Iinclude -Icrypto -fPIC -pthread -Wa,--noexecstack -Qunused-                                                                                                                        arguments -Wall -O3 -DOPENSSL_PIC -DOPENSSLDIR="\"/opt/openssl-custom\"" -DENGINESDIR="\"/opt/openssl-                                                                                                                        custom/lib/engines-1.1\"" -D_THREAD_SAFE -D_REENTRANT -DNDEBUG  -MMD -MF crypto/cversion.d.tmp -MT cry                                                                                                                        pto/cversion.o -c -o crypto/cversion.o crypto/cversion.c
aarch64-none-elf-gcc: error: unrecognized command line option '-pthread'
aarch64-none-elf-gcc: error: unrecognized command line option '-Qunused-arguments'; did you mean '-Wun                                                                                                                        used-parameter'?
*** Error code 1

Stop.
make[1]: stopped in /root/Work File/openssl-1_1_k-custom-master/openssl-1_1_k-custom-master
*** Error code 1
  1. I also have tried to linked configure to sysroot as command below:

    ./Configure BSD-generic32 --sysroot=/usr/local/freebsd-sysroot/aarch64 -prefix=/usr/local/openssl-custom --openssldir=/opt/openssl-custom -Wl,-rpath=/user/local/openssl-custom/lib

Then got error as below when run make command:

o crypto/x509v3/v3_info.o crypto/x509v3/v3_int.o crypto/x509v3/v3_lib.o crypto/x509v3/v3_ncons.o crypto/x509v3/v3_pci.o crypto/x509v3/v3_pcia.o crypto/x509v3/v3_pcons.o crypto/x509v3/v3_pku.o crypto/x509v3/v3_pmaps.o crypto/x509v3/v3_prn.o crypto/x509v3/v3_purp.o crypto/x509v3/v3_skey.o crypto/x509v3/v3_sxnet.o crypto/x509v3/v3_tlsf.o crypto/x509v3/v3_utl.o crypto/x509v3/v3err.o  -pthread
ld: error: crypto/aes/aes_cbc.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_cfb.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_core.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_ecb.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_ige.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_misc.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_ofb.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aes/aes_wrap.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/aria/aria.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_bitstr.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_d2i_fp.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_digest.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_dup.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_gentm.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_i2d_fp.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_int.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_mbstr.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_object.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_octet.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: crypto/asn1/a_print.o is incompatible with /usr/local/freebsd-sysroot/aarch64/usr/lib/crti.o
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1


                                                                          

Do you guys have any idea on how to cross compile openssl for freebsd arm64?

Please share with me you thought on this, really appreciate your assistance.

  • For starters, the target `arm-none-eabi` is 32-bit ARM. You want to look for `aarch64-*`. – Nate Eldredge Feb 20 '22 at 17:32
  • I'm aware of nanopi R2S is ARM64/aarch64, but I'm got confuse because when I run command ./config (in openssl source code dir) on my nanopi it is stated as BSD-generic32 and not BSD-generic64. Btw, have you tried to cross compile freebsd to bsd arm before ? I will be glad if you experience about it because im stuck right now – Babayaga99 Feb 21 '22 at 02:46

0 Answers0