Skip to content

Cross compilation results in size mismatch of ssize_t and pointer size #265

@aparcar

Description

@aparcar

I'm trying to build project for multiple architectures but it fails on aarch64 due to a mismatch of the ssize_t and the pointer size. Full error message below. I see that it's possible to set --no-size_t-is-usize but wonder if that's the correct way to do so, I see that ops-sys explicitly sets this option to true in build.rs.

error: failed to run custom build command for oqs-sys v0.9.1+liboqs-0.9.0 (https://github.com/open-quantum-safe/liboqs-rust.git?rev=07e569027cf4dcaa5991cf2f16d63b0363957327#07e56902)

Caused by:
  process didn't exit successfully: `/home/aparcar/openwrt/build_dir/target-aarch64_generic_musl/rosenpass-72f68c9bac3b1b3cd09110493f9b953f6dc29eff/target/release/build/oqs-sys-80409713af391698/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBOQS_NO_VENDOR
  cargo:rerun-if-env-changed=LIBOQS_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBOQS_STATIC
  cargo:rerun-if-env-changed=LIBOQS_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=LIBOQS_STATIC
  cargo:rerun-if-env-changed=LIBOQS_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rustc-link-search=native=/home/aparcar/openwrt/staging_dir/target-aarch64_generic_musl/usr/lib
  cargo:rustc-link-lib=oqs
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBOQS_STATIC
  cargo:rerun-if-env-changed=LIBOQS_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at /home/aparcar/openwrt/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/codegen/mod.rs:912:25:
  assertion `left == right` failed: Target platform requires `--no-size_t-is-usize`. The size of `ssize_t` (4) does not match the target pointer size (8)
    left: 4
   right: 8
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions