Skip to content

Cannot compile cmake projects with cross-rs freebsd target #1291

Open
@cruxpot

Description

@cruxpot

Checklist

Describe your issue

I am trying to set up cross-compilers toolchains to compile against various platforms including freebsd x64. I cannot get the mbedtls 0.11.0 crate to build, which I need for a project of mine. I am on commit hash 37c681a of the cross-rs repo and I am using the dockerfiles in there but I've added a few packages to the common.sh file which I will show below. I've reproduce this issue with both cross 0.2.4 and cross 0.2.5. I cannot get the mbedtls crate to build due to cmake errors and I have tried changing many variables that affect the sysroot but it makes no difference. Have had much greater success with musl targets than gnu targets overall but I have been able to get many gnu targets working. Anyway I am not a cmake expert so I would appreciate the help on this or a fix if it's related to this image's cmake setup. It works on many of the cross-rs images.

To recreate my issue...

It's a very simple hello world project with the mbedtls crate added.

My Cargo.toml:

[package]
name = "test-mbedtls"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
mbedtls = "0.11.0"

My Cross.toml mainly for mbedtls cmake system needs python and some packages for it (using custom built image from cross/docker/Dockerfile.x86_64-unknown-freebsd):

[target.x86_64-unknown-freebsd]
  image = "x86_64-unknown-freebsd-cross-v3:latest"
  pre-build = [ "pip3 install jsonschema jinja2" ]

My docker/common.sh file for adding additional packages my application needs:

updated docker/common.sh:

install_packages \
      autoconf \
      automake \
      binutils \
      ca-certificates \
      curl \
      file \
      gcc \
      git \
      libtool \
      m4 \
      make \
      protobuf-compiler \
      uuid-runtime \
      python3 \
      python3-pip \
      clang

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

x86_64-unknown-freebsd

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 v0.2.5

Example

Build step:

$ cross build --target x86_64-unknown-freebsd
info: downloading component 'rust-std' for 'x86_64-unknown-freebsd'
info: installing component 'rust-std' for 'x86_64-unknown-freebsd'
 29.3 MiB /  29.3 MiB (100 %)  15.2 MiB/s in  1s ETA:  0s
[+] Building 0.0s (6/6) FINISHED
 => [internal] load build definition from Dockerfile.x86_64-unknown-freebsd-custom                                              0.0s
 => => transferring dockerfile: 235B                                                                                            0.0s
 => [internal] load .dockerignore                                                                                               0.0s
 => => transferring context: 2B                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/x86_64-unknown-freebsd-cross-v3:latest                                       0.0s
 => [1/2] FROM docker.io/library/x86_64-unknown-freebsd-cross-v3:latest                                                         0.0s
 => CACHED [2/2] RUN eval "pip3 install jsonschema jinja2"                                                                      0.0s
 => exporting to image                                                                                                          0.0s
 => => exporting layers                                                                                                         0.0s
 => => writing image sha256:e050e756d534861e12835bb9affb8ab712c3641e07b655eafd6cd34c0af2124c                                    0.0s
 => => naming to localhost/cross-rs/cross-custom-test-mbedtls-rs:x86_64-unknown-freebsd-afa10-pre-build                         0.0s
   Compiling proc-macro2 v1.0.63
   Compiling unicode-ident v1.0.8
   Compiling libc v0.2.144
   Compiling quote v1.0.29
   Compiling memchr v2.5.0
   Compiling glob v0.3.1
   Compiling cfg-if v1.0.0
   Compiling prettyplease v0.2.10
   Compiling autocfg v1.1.0
   Compiling clang-sys v1.6.1
   Compiling syn v2.0.23
   Compiling minimal-lexical v0.2.1
   Compiling log v0.4.17
   Compiling cc v1.0.79
   Compiling libloading v0.7.4
   Compiling nom v7.1.3
   Compiling yansi-term v0.1.2
   Compiling bindgen v0.65.1
   Compiling either v1.8.1
   Compiling syn v1.0.109
   Compiling unicode-width v0.1.10
   Compiling regex-syntax v0.7.1
   Compiling annotate-snippets v0.9.1
   Compiling cexpr v0.6.0
   Compiling which v4.4.0
   Compiling regex v1.8.1
   Compiling peeking_take_while v0.1.2
   Compiling bitflags v1.3.2
   Compiling shlex v1.1.0
   Compiling rustc-hash v1.1.0
   Compiling lazycell v1.3.0
   Compiling lazy_static v1.4.0
   Compiling cmake v0.1.50
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling mbedtls-platform-support v0.3.0
   Compiling num-bigint v0.2.6
   Compiling serde v1.0.163
   Compiling mbedtls v0.11.0
   Compiling once_cell v1.17.1
   Compiling bit-vec v0.5.1
   Compiling yasna v0.2.2
   Compiling serde_derive v1.0.163
   Compiling byteorder v1.4.3
   Compiling mbedtls-sys-auto v3.5.0-alpha.2+0b3de6f
error: failed to run custom build command for `mbedtls-sys-auto v3.5.0-alpha.2+0b3de6f`

Caused by:
  process didn't exit successfully: `/target/debug/build/mbedtls-sys-auto-38f0040633ee243b/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=threading_component="pthread"
  cargo:rustc-cfg=time_component="libc"
  cargo:rustc-cfg=std_component="fs"
  cargo:rustc-cfg=std_component="entropy"
  cargo:rustc-cfg=std_component="net"
  cargo:platform-components=threading_component=pthread,time_component=libc,std_component=fs,std_component=entropy,std_component=net
  cargo:rerun-if-env-changed=RUST_MBEDTLS_SYS_SOURCE
  cargo:rerun-if-changed=vendor/CMakeLists.txt
  cargo:rerun-if-changed=vendor/include/mbedtls/build_info.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform_time.h
  cargo:rerun-if-changed=vendor/include/mbedtls/private_access.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform_util.h
  cargo:rerun-if-changed=vendor/include/mbedtls/bignum.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md.h
  cargo:rerun-if-changed=vendor/include/mbedtls/threading.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecp.h
  cargo:rerun-if-changed=vendor/include/mbedtls/rsa.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecdsa.h
  cargo:rerun-if-changed=vendor/include/mbedtls/asn1.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pk.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509.h
  cargo:rerun-if-changed=vendor/include/mbedtls/cipher.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_crl.h
  cargo:rerun-if-changed=vendor/include/mbedtls/aes.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_ciphersuites.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_crt.h
  cargo:rerun-if-changed=vendor/include/mbedtls/dhm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecdh.h
  cargo:rerun-if-changed=vendor/include/mbedtls/oid.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ctr_drbg.h
  cargo:rerun-if-changed=vendor/include/mbedtls/hmac_drbg.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl.h
  cargo:rerun-if-changed=vendor/include/mbedtls/md5.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha1.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha256.h
  cargo:rerun-if-changed=vendor/include/mbedtls/sha512.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ecjpake.h
  cargo:rerun-if-changed=vendor/include/mbedtls/psa_util.h
  cargo:rerun-if-changed=vendor/include/mbedtls/net_sockets.h
  cargo:rerun-if-changed=vendor/include/mbedtls/poly1305.h
  cargo:rerun-if-changed=vendor/include/mbedtls/chacha20.h
  cargo:rerun-if-changed=vendor/include/mbedtls/x509_csr.h
  cargo:rerun-if-changed=vendor/include/mbedtls/version.h
  cargo:rerun-if-changed=vendor/include/mbedtls/timing.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_ticket.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_cookie.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ssl_cache.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ripemd160.h
  cargo:rerun-if-changed=vendor/include/mbedtls/platform.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pkcs5.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pkcs7.h
  cargo:rerun-if-changed=vendor/include/mbedtls/pem.h
  cargo:rerun-if-changed=vendor/include/mbedtls/nist_kw.h
  cargo:rerun-if-changed=vendor/include/mbedtls/memory_buffer_alloc.h
  cargo:rerun-if-changed=vendor/include/mbedtls/lms.h
  cargo:rerun-if-changed=vendor/include/mbedtls/hkdf.h
  cargo:rerun-if-changed=vendor/include/mbedtls/gcm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/error.h
  cargo:rerun-if-changed=vendor/include/mbedtls/entropy.h
  cargo:rerun-if-changed=vendor/include/mbedtls/des.h
  cargo:rerun-if-changed=vendor/include/mbedtls/debug.h
  cargo:rerun-if-changed=vendor/include/mbedtls/constant_time.h
  cargo:rerun-if-changed=vendor/include/mbedtls/cmac.h
  cargo:rerun-if-changed=vendor/include/mbedtls/chachapoly.h
  cargo:rerun-if-changed=vendor/include/mbedtls/ccm.h
  cargo:rerun-if-changed=vendor/include/mbedtls/camellia.h
  cargo:rerun-if-changed=vendor/include/mbedtls/base64.h
  cargo:rerun-if-changed=vendor/include/mbedtls/asn1write.h
  cargo:rerun-if-changed=vendor/include/mbedtls/aria.h
  cargo:rerun-if-changed=vendor/library/md.c
  cargo:rerun-if-changed=vendor/library/memory_buffer_alloc.c
  cargo:rerun-if-changed=vendor/library/asn1parse.c
  cargo:rerun-if-changed=vendor/library/ssl_tls13_server.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_slot_management.c
  cargo:rerun-if-changed=vendor/library/chacha20.c
  cargo:rerun-if-changed=vendor/library/common.h
  cargo:rerun-if-changed=vendor/library/alignment.h
  cargo:rerun-if-changed=vendor/library/ssl_client.c
  cargo:rerun-if-changed=vendor/library/psa_crypto.c
  cargo:rerun-if-changed=vendor/library/ecp.c
  cargo:rerun-if-changed=vendor/library/timing.c
  cargo:rerun-if-changed=vendor/library/.gitignore
  cargo:rerun-if-changed=vendor/library/ssl_debug_helpers_generated.c
  cargo:rerun-if-changed=vendor/library/hash_info.h
  cargo:rerun-if-changed=vendor/library/ssl_tls13_invasive.h
  cargo:rerun-if-changed=vendor/library/pk_wrap.c
  cargo:rerun-if-changed=vendor/library/ecjpake.c
  cargo:rerun-if-changed=vendor/library/bignum_core.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_cipher.c
  cargo:rerun-if-changed=vendor/library/ecp_internal_alt.h
  cargo:rerun-if-changed=vendor/library/x509_crl.c
  cargo:rerun-if-changed=vendor/library/rsa_alt_helpers.c
  cargo:rerun-if-changed=vendor/library/ssl_misc.h
  cargo:rerun-if-changed=vendor/library/mps_error.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_client.c
  cargo:rerun-if-changed=vendor/library/des.c
  cargo:rerun-if-changed=vendor/library/bignum_mod.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_slot_management.h
  cargo:rerun-if-changed=vendor/library/ssl_tls12_client.c
  cargo:rerun-if-changed=vendor/library/ssl_tls13_keys.h
  cargo:rerun-if-changed=vendor/library/rsa_alt_helpers.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_random_impl.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_mac.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_ecp.c
  cargo:rerun-if-changed=vendor/library/ripemd160.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_hash.h
  cargo:rerun-if-changed=vendor/library/platform.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_hash.c
  cargo:rerun-if-changed=vendor/library/padlock.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_aead.c
  cargo:rerun-if-changed=vendor/library/ssl_msg.c
  cargo:rerun-if-changed=vendor/library/x509write_csr.c
  cargo:rerun-if-changed=vendor/library/entropy_poll.c
  cargo:rerun-if-changed=vendor/library/lms.c
  cargo:rerun-if-changed=vendor/library/x509_crt.c
  cargo:rerun-if-changed=vendor/library/ecp_invasive.h
  cargo:rerun-if-changed=vendor/library/ecdsa.c
  cargo:rerun-if-changed=vendor/library/mps_reader.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_ecp.h
  cargo:rerun-if-changed=vendor/library/aria.c
  cargo:rerun-if-changed=vendor/library/Makefile
  cargo:rerun-if-changed=vendor/library/gcm.c
  cargo:rerun-if-changed=vendor/library/asn1write.c
  cargo:rerun-if-changed=vendor/library/bn_mul.h
  cargo:rerun-if-changed=vendor/library/padlock.h
  cargo:rerun-if-changed=vendor/library/net_sockets.c
  cargo:rerun-if-changed=vendor/library/aesce.c
  cargo:rerun-if-changed=vendor/library/hmac_drbg.c
  cargo:rerun-if-changed=vendor/library/hash_info.c
  cargo:rerun-if-changed=vendor/library/poly1305.c
  cargo:rerun-if-changed=vendor/library/ssl_ciphersuites.c
  cargo:rerun-if-changed=vendor/library/aes.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_rsa.h
  cargo:rerun-if-changed=vendor/library/threading.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_its.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_se.c
  cargo:rerun-if-changed=vendor/library/psa_its_file.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_rsa.c
  cargo:rerun-if-changed=vendor/library/aesni.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_driver_wrappers.h
  cargo:rerun-if-changed=vendor/library/sha256.c
  cargo:rerun-if-changed=vendor/library/bignum_mod_raw.h
  cargo:rerun-if-changed=vendor/library/pkwrite.c
  cargo:rerun-if-changed=vendor/library/cipher_wrap.c
  cargo:rerun-if-changed=vendor/library/md5.c
  cargo:rerun-if-changed=vendor/library/pk.c
  cargo:rerun-if-changed=vendor/library/pkcs12.c
  cargo:rerun-if-changed=vendor/library/pkcs7.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_core.h
  cargo:rerun-if-changed=vendor/library/entropy_poll.h
  cargo:rerun-if-changed=vendor/library/x509_create.c
  cargo:rerun-if-changed=vendor/library/ssl_tls13_generic.c
  cargo:rerun-if-changed=vendor/library/ssl_ticket.c
  cargo:rerun-if-changed=vendor/library/lmots.h
  cargo:rerun-if-changed=vendor/library/cipher.c
  cargo:rerun-if-changed=vendor/library/bignum_mod.h
  cargo:rerun-if-changed=vendor/library/mps_common.h
  cargo:rerun-if-changed=vendor/library/constant_time_internal.h
  cargo:rerun-if-changed=vendor/library/bignum_core.h
  cargo:rerun-if-changed=vendor/library/pkparse.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_core_common.h
  cargo:rerun-if-changed=vendor/library/ecdh.c
  cargo:rerun-if-changed=vendor/library/constant_time_invasive.h
  cargo:rerun-if-changed=vendor/library/ssl_tls12_server.c
  cargo:rerun-if-changed=vendor/library/aesni.c
  cargo:rerun-if-changed=vendor/library/sha512.c
  cargo:rerun-if-changed=vendor/library/nist_kw.c
  cargo:rerun-if-changed=vendor/library/ecp_curves.c
  cargo:rerun-if-changed=vendor/library/mps_trace.c
  cargo:rerun-if-changed=vendor/library/ssl_client.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_cipher.h
  cargo:rerun-if-changed=vendor/library/pk_wrap.h
  cargo:rerun-if-changed=vendor/library/aesce.h
  cargo:rerun-if-changed=vendor/library/entropy.c
  cargo:rerun-if-changed=vendor/library/check_crypto_config.h
  cargo:rerun-if-changed=vendor/library/base64.c
  cargo:rerun-if-changed=vendor/library/md_wrap.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_storage.h
  cargo:rerun-if-changed=vendor/library/debug.c
  cargo:rerun-if-changed=vendor/library/cmac.c
  cargo:rerun-if-changed=vendor/library/rsa.c
  cargo:rerun-if-changed=vendor/library/dhm.c
  cargo:rerun-if-changed=vendor/library/pem.c
  cargo:rerun-if-changed=vendor/library/ssl_tls.c
  cargo:rerun-if-changed=vendor/library/ssl_cookie.c
  cargo:rerun-if-changed=vendor/library/ccm.c
  cargo:rerun-if-changed=vendor/library/ssl_cache.c
  cargo:rerun-if-changed=vendor/library/pkwrite.h
  cargo:rerun-if-changed=vendor/library/version.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_pake.c
  cargo:rerun-if-changed=vendor/library/bignum_mod_raw_invasive.h
  cargo:rerun-if-changed=vendor/library/constant_time.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_mac.h
  cargo:rerun-if-changed=vendor/library/ssl_tls13_keys.c
  cargo:rerun-if-changed=vendor/library/pkcs5.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_se.h
  cargo:rerun-if-changed=vendor/library/ssl_tls13_client.c
  cargo:rerun-if-changed=vendor/library/x509_csr.c
  cargo:rerun-if-changed=vendor/library/sha1.c
  cargo:rerun-if-changed=vendor/library/platform_util.c
  cargo:rerun-if-changed=vendor/library/CMakeLists.txt
  cargo:rerun-if-changed=vendor/library/psa_crypto_storage.c
  cargo:rerun-if-changed=vendor/library/oid.c
  cargo:rerun-if-changed=vendor/library/x509.c
  cargo:rerun-if-changed=vendor/library/psa_util.c
  cargo:rerun-if-changed=vendor/library/mps_trace.h
  cargo:rerun-if-changed=vendor/library/bignum.c
  cargo:rerun-if-changed=vendor/library/bignum_mod_raw.c
  cargo:rerun-if-changed=vendor/library/ssl_debug_helpers.h
  cargo:rerun-if-changed=vendor/library/chachapoly.c
  cargo:rerun-if-changed=vendor/library/mps_reader.c
  cargo:rerun-if-changed=vendor/library/x509write_crt.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_invasive.h
  cargo:rerun-if-changed=vendor/library/psa_crypto_pake.h
  cargo:rerun-if-changed=vendor/library/ctr_drbg.c
  cargo:rerun-if-changed=vendor/library/cipher_wrap.h
  cargo:rerun-if-changed=vendor/library/hkdf.c
  cargo:rerun-if-changed=vendor/library/camellia.c
  cargo:rerun-if-changed=vendor/library/psa_crypto_aead.h
  cargo:rerun-if-changed=vendor/library/lmots.c
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-freebsd")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-freebsd
  CC_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_freebsd
  CC_x86_64_unknown_freebsd = Some("x86_64-unknown-freebsd12-gcc")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-freebsd
  CFLAGS_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_freebsd
  CFLAGS_x86_64_unknown_freebsd = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-freebsd = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_freebsd = Some("/opt/toolchain.cmake")
  CMAKE_GENERATOR_x86_64-unknown-freebsd = None
  CMAKE_GENERATOR_x86_64_unknown_freebsd = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-freebsd = None
  CMAKE_PREFIX_PATH_x86_64_unknown_freebsd = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-freebsd = None
  CMAKE_x86_64_unknown_freebsd = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/mbedtls-sys-auto-3.5.0-alpha.2+0b3de6f/vendor" "-DENABLE_PROGRAMS=OFF" "-DENABLE_TESTING=OFF" "-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain.cmake" "-DCMAKE_INSTALL_PREFIX=/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out" "-DCMAKE_C_FLAGS= -DMBEDTLS_CONFIG_FILE=\"\\\"/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/config.h\\\"\" -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Debug"
  -- The C compiler identification is GNU 6.4.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/local/bin/x86_64-unknown-freebsd12-gcc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Found Python3: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter
  -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
  -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
  -- Found Perl: /usr/bin/perl (found version "5.30.0")
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/build
  running: cd "/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/build" && MAKEFLAGS="-j --jobserver-fds=11,12 --jobserver-auth=11,12" "cmake" "--build" "." "--target" "lib" "--config" "Debug"
  [  1%] Generating version_features.c
  [  1%] Generating error.c
  [  2%] Generating psa_crypto_driver_wrappers.c
  [  3%] Building C object library/CMakeFiles/mbedcrypto.dir/aes.c.o
  [  4%] Building C object library/CMakeFiles/mbedcrypto.dir/aesni.c.o
  [  5%] Building C object library/CMakeFiles/mbedcrypto.dir/aesce.c.o
  [  6%] Building C object library/CMakeFiles/mbedcrypto.dir/aria.c.o
  [  7%] Building C object library/CMakeFiles/mbedcrypto.dir/asn1parse.c.o
  [  8%] Building C object library/CMakeFiles/mbedcrypto.dir/asn1write.c.o
  [  9%] Building C object library/CMakeFiles/mbedcrypto.dir/base64.c.o
  [ 10%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum.c.o
  [ 10%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum_core.c.o
  [ 11%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum_mod.c.o
  [ 12%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum_mod_raw.c.o
  [ 13%] Building C object library/CMakeFiles/mbedcrypto.dir/camellia.c.o
  [ 14%] Building C object library/CMakeFiles/mbedcrypto.dir/ccm.c.o
  [ 15%] Building C object library/CMakeFiles/mbedcrypto.dir/chacha20.c.o
  [ 16%] Building C object library/CMakeFiles/mbedcrypto.dir/chachapoly.c.o
  [ 17%] Building C object library/CMakeFiles/mbedcrypto.dir/cipher.c.o
  [ 18%] Building C object library/CMakeFiles/mbedcrypto.dir/cipher_wrap.c.o
  [ 19%] Building C object library/CMakeFiles/mbedcrypto.dir/constant_time.c.o
  [ 20%] Building C object library/CMakeFiles/mbedcrypto.dir/cmac.c.o
  [ 20%] Building C object library/CMakeFiles/mbedcrypto.dir/ctr_drbg.c.o
  [ 21%] Building C object library/CMakeFiles/mbedcrypto.dir/des.c.o
  [ 22%] Building C object library/CMakeFiles/mbedcrypto.dir/dhm.c.o
  [ 23%] Building C object library/CMakeFiles/mbedcrypto.dir/ecdh.c.o
  [ 24%] Building C object library/CMakeFiles/mbedcrypto.dir/ecdsa.c.o
  [ 25%] Building C object library/CMakeFiles/mbedcrypto.dir/ecjpake.c.o
  [ 26%] Building C object library/CMakeFiles/mbedcrypto.dir/ecp.c.o
  [ 27%] Building C object library/CMakeFiles/mbedcrypto.dir/ecp_curves.c.o
  [ 28%] Building C object library/CMakeFiles/mbedcrypto.dir/entropy.c.o
  [ 29%] Building C object library/CMakeFiles/mbedcrypto.dir/entropy_poll.c.o
  [ 30%] Building C object library/CMakeFiles/mbedcrypto.dir/error.c.o
  [ 30%] Building C object library/CMakeFiles/mbedcrypto.dir/gcm.c.o
  [ 31%] Building C object library/CMakeFiles/mbedcrypto.dir/hash_info.c.o
  [ 32%] Building C object library/CMakeFiles/mbedcrypto.dir/hkdf.c.o
  [ 33%] Building C object library/CMakeFiles/mbedcrypto.dir/hmac_drbg.c.o
  [ 34%] Building C object library/CMakeFiles/mbedcrypto.dir/lmots.c.o
  [ 35%] Building C object library/CMakeFiles/mbedcrypto.dir/lms.c.o
  [ 36%] Building C object library/CMakeFiles/mbedcrypto.dir/md.c.o
  [ 37%] Building C object library/CMakeFiles/mbedcrypto.dir/md5.c.o
  [ 38%] Building C object library/CMakeFiles/mbedcrypto.dir/memory_buffer_alloc.c.o
  [ 39%] Building C object library/CMakeFiles/mbedcrypto.dir/nist_kw.c.o
  [ 40%] Building C object library/CMakeFiles/mbedcrypto.dir/oid.c.o
  [ 40%] Building C object library/CMakeFiles/mbedcrypto.dir/padlock.c.o
  [ 41%] Building C object library/CMakeFiles/mbedcrypto.dir/pem.c.o
  [ 42%] Building C object library/CMakeFiles/mbedcrypto.dir/pk.c.o
  [ 43%] Building C object library/CMakeFiles/mbedcrypto.dir/pk_wrap.c.o
  [ 44%] Building C object library/CMakeFiles/mbedcrypto.dir/pkcs12.c.o
  [ 45%] Building C object library/CMakeFiles/mbedcrypto.dir/pkcs5.c.o
  [ 46%] Building C object library/CMakeFiles/mbedcrypto.dir/pkparse.c.o
  [ 47%] Building C object library/CMakeFiles/mbedcrypto.dir/pkwrite.c.o
  [ 48%] Building C object library/CMakeFiles/mbedcrypto.dir/platform.c.o
  [ 49%] Building C object library/CMakeFiles/mbedcrypto.dir/platform_util.c.o
  [ 50%] Building C object library/CMakeFiles/mbedcrypto.dir/poly1305.c.o
  [ 50%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto.c.o
  [ 51%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_aead.c.o
  [ 52%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_cipher.c.o
  [ 53%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_client.c.o
  [ 54%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_driver_wrappers.c.o
  [ 55%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_ecp.c.o
  [ 56%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_hash.c.o
  [ 57%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_mac.c.o
  [ 58%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_pake.c.o
  [ 59%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_rsa.c.o
  [ 60%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_slot_management.c.o
  [ 60%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_se.c.o
  [ 61%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_crypto_storage.c.o
  [ 62%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_its_file.c.o
  [ 63%] Building C object library/CMakeFiles/mbedcrypto.dir/psa_util.c.o
  [ 64%] Building C object library/CMakeFiles/mbedcrypto.dir/ripemd160.c.o
  [ 65%] Building C object library/CMakeFiles/mbedcrypto.dir/rsa.c.o
  [ 66%] Building C object library/CMakeFiles/mbedcrypto.dir/rsa_alt_helpers.c.o
  [ 67%] Building C object library/CMakeFiles/mbedcrypto.dir/sha1.c.o
  [ 68%] Building C object library/CMakeFiles/mbedcrypto.dir/sha256.c.o
  [ 69%] Building C object library/CMakeFiles/mbedcrypto.dir/sha512.c.o
  [ 70%] Building C object library/CMakeFiles/mbedcrypto.dir/threading.c.o
  [ 70%] Building C object library/CMakeFiles/mbedcrypto.dir/timing.c.o
  [ 71%] Building C object library/CMakeFiles/mbedcrypto.dir/version.c.o
  [ 72%] Building C object library/CMakeFiles/mbedcrypto.dir/version_features.c.o
  [ 73%] Linking C static library libmbedcrypto.a
  [ 73%] Built target mbedcrypto
  [ 74%] Building C object library/CMakeFiles/mbedx509.dir/pkcs7.c.o
  [ 75%] Building C object library/CMakeFiles/mbedx509.dir/x509.c.o
  [ 76%] Building C object library/CMakeFiles/mbedx509.dir/x509_create.c.o
  [ 77%] Building C object library/CMakeFiles/mbedx509.dir/x509_crl.c.o
  [ 78%] Building C object library/CMakeFiles/mbedx509.dir/x509_crt.c.o
  [ 79%] Building C object library/CMakeFiles/mbedx509.dir/x509_csr.c.o
  [ 80%] Building C object library/CMakeFiles/mbedx509.dir/x509write_crt.c.o
  [ 81%] Building C object library/CMakeFiles/mbedx509.dir/x509write_csr.c.o
  [ 82%] Linking C static library libmbedx509.a
  [ 82%] Built target mbedx509
  [ 83%] Generating ssl_debug_helpers_generated.c
  [ 84%] Building C object library/CMakeFiles/mbedtls.dir/debug.c.o
  [ 85%] Building C object library/CMakeFiles/mbedtls.dir/mps_reader.c.o
  [ 86%] Building C object library/CMakeFiles/mbedtls.dir/mps_trace.c.o
  [ 87%] Building C object library/CMakeFiles/mbedtls.dir/net_sockets.c.o
  [ 89%] Building C object library/CMakeFiles/mbedtls.dir/ssl_ciphersuites.c.o
  [ 89%] Building C object library/CMakeFiles/mbedtls.dir/ssl_cache.c.o
  [ 89%] Building C object library/CMakeFiles/mbedtls.dir/ssl_client.c.o
  [ 90%] Building C object library/CMakeFiles/mbedtls.dir/ssl_cookie.c.o
  [ 91%] Building C object library/CMakeFiles/mbedtls.dir/ssl_debug_helpers_generated.c.o
  [ 92%] Building C object library/CMakeFiles/mbedtls.dir/ssl_msg.c.o
  [ 93%] Building C object library/CMakeFiles/mbedtls.dir/ssl_ticket.c.o
  [ 94%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls.c.o
  [ 95%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls12_client.c.o
  [ 96%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls12_server.c.o
  [ 97%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls13_keys.c.o
  [ 98%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls13_server.c.o
  [ 99%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls13_client.c.o
  [ 99%] Building C object library/CMakeFiles/mbedtls.dir/ssl_tls13_generic.c.o
  [100%] Linking C static library libmbedtls.a
  [100%] Built target mbedtls
  [100%] Built target lib
  cargo:root=/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out
  cargo:rustc-link-search=native=/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/build/library
  cargo:rustc-link-search=native=/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/build/crypto/library
  cargo:rustc-link-lib=mbedtls
  cargo:rustc-link-lib=mbedx509
  cargo:rustc-link-lib=mbedcrypto
  cargo:include=/home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/mbedtls-sys-auto-3.5.0-alpha.2+0b3de6f/vendor/include
  cargo:config_h=/target/x86_64-unknown-freebsd/debug/build/mbedtls-sys-auto-83f93d0eb151c3a5/out/config.h
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-freebsd")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-freebsd
  CC_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_freebsd
  CC_x86_64_unknown_freebsd = Some("x86_64-unknown-freebsd12-gcc")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-freebsd
  CFLAGS_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_freebsd
  CFLAGS_x86_64_unknown_freebsd = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

  --- stderr
  vendor/include/mbedtls/platform_time.h:38:10: fatal error: 'time.h' file not found
  thread 'main' panicked at 'bindgen error: ClangDiagnostic("vendor/include/mbedtls/platform_time.h:38:10: fatal error: 'time.h' file not found\n")', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/mbedtls-sys-auto-3.5.0-alpha.2+0b3de6f/build/bindgen.rs:113:25
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional information / notes

I can build with these commands with similar Dockerfile updates (need python3, pip and those python packages as above in the image for it to work, pre-build does not always work).

cross build --target mips-unknown-linux-gnu

cross build --target mipsel-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions