Skip to content

openssl-sys compilation segfaults for arm-unknown-linux-gnueabihf #1097

Open
@eliabieri

Description

@eliabieri

Checklist

Describe your issue

arm-unknown-linux-gnueabihf-gcc segfaults when compiling openssl-sys for arm-unknown-linux-gnueabihf

What target(s) are you cross-compiling for?

arm-unknown-linux-gnueabihf

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.4 (a8082de 2022-10-26)

Example

git clone https://github.com/eliabieri/cross-openssl-segfault-demo
cd cross-openssl-segfault-demo
cross build --target armv7-unknown-linux-gnueabihf

generates

   Compiling openssl-macros v0.1.0
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
error: failed to run custom build command for `openssl-sys v0.9.77`

Caused by:
  process didn't exit successfully: `/target/debug/build/openssl-sys-f9a44440aee6c007/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rustc-cfg=openssl
  cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_NO_VENDOR
  ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  CC_armv7-unknown-linux-gnueabihf = None
  CC_armv7_unknown_linux_gnueabihf = Some("arm-linux-gnueabihf-gcc")
  CFLAGS_armv7-unknown-linux-gnueabihf = None
  CFLAGS_armv7_unknown_linux_gnueabihf = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = None
  running "perl" "./Configure" "--prefix=/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-armv4" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv7-a" "-mfpu=vfpv3-d16"
  Configuring OpenSSL version 1.1.1q (0x1010111fL) for linux-armv4
  Using os-specific seed configuration
  Creating configdata.pm
  Creating Makefile

  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL file first)         ***
  ***                                                                ***
  **********************************************************************
  running "make" "depend"
  running "make" "build_libs"
  /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
      "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
  /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
      "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
  /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
      "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
  make depend && make _build_libs
  make[1]: Entering directory '/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/build/src'
  make[1]: Leaving directory '/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/build/src'
  make[1]: Entering directory '/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/build/src'
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/apps.d.tmp -MT apps/apps.o -c -o apps/apps.o apps/apps.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/bf_prefix.d.tmp -MT apps/bf_prefix.o -c -o apps/bf_prefix.o apps/bf_prefix.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/opt.d.tmp -MT apps/opt.o -c -o apps/opt.o apps/opt.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/s_cb.d.tmp -MT apps/s_cb.o -c -o apps/s_cb.o apps/s_cb.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF apps/s_socket.d.tmp -MT apps/s_socket.o -c -o apps/s_socket.o apps/s_socket.c
  CC="arm-linux-gnueabihf-gcc" /usr/bin/perl crypto/aes/asm/aes-armv4.pl linux32 crypto/aes/aes-armv4.S
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF crypto/aes/aes_cbc.d.tmp -MT crypto/aes/aes_cbc.o -c -o crypto/aes/aes_cbc.o crypto/aes/aes_cbc.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF crypto/aes/aes_cfb.d.tmp -MT crypto/aes/aes_cfb.o -c -o crypto/aes/aes_cfb.o crypto/aes/aes_cfb.c
  arm-linux-gnueabihf-gcc  -I. -Iinclude -fPIC -pthread -Wa,--noexecstack -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -march=armv7-a -mfpu=vfpv3-d16 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG  -MMD -MF crypto/aes/aes_ecb.d.tmp -MT crypto/aes/aes_ecb.o -c -o crypto/aes/aes_ecb.o crypto/aes/aes_ecb.c
  make[1]: Leaving directory '/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-7447ba9ef8304237/out/openssl-build/build/src'

  --- stderr
  <jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
  <jemalloc>: (This is the expected behaviour if you are running under QEMU)
  Segmentation fault
  make[1]: *** [Makefile:750: crypto/aes/aes_ecb.o] Error 139
  make[1]: *** Waiting for unfinished jobs....
  make: *** [Makefile:177: build_libs] Error 2
  thread 'main' panicked at '


  Error building OpenSSL:
      Command: "make" "build_libs"
      Exit status: exit status: 2


      ', /Users/eliabieri/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.22.0+1.1.1q/src/lib.rs:490:13

Additional information / notes

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions