Skip to content

secp256k1-sys cannot be cross compiled using rust cross. #734

@KernelPanic0

Description

@KernelPanic0

I am trying to cross compile a rust application from Ubuntu to a Windows machine. With podman installed, I run the following:
cross build --release --target x86_64-pc-windows-msvc
Everything is fine, up until the compiler reaches the secp256k1-sys crate.

   Compiling same-file v1.0.6
The following warnings were emitted during compilation:

warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: In file included from /usr/include/stdio.h:894,
warning: [email protected]:                  from depend/secp256k1/src/util.h:14,
warning: [email protected]:                  from depend/secp256k1/src/field.h:10,
warning: [email protected]:                  from depend/secp256k1/src/group.h:10,
warning: [email protected]:                  from depend/secp256k1/src/precomputed_ecmult_gen.c:3:
warning: [email protected]: /usr/include/x86_64-linux-gnu/bits/stdio2.h:111:1: error: expected identifier or ‘(’ before ‘{’ token
warning: [email protected]:   111 | {
warning: [email protected]:       | ^
warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: GNU compiler is not supported for this target
warning: [email protected]: GNU compiler is not supported for this target

error: failed to run custom build command for `secp256k1-sys v0.10.0`

Caused by:
  process didn't exit successfully: `/var/www/Kraken/target/release/build/secp256k1-sys-af278a91dc73c6d7/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/var/www/Kraken/target/x86_64-pc-windows-msvc/release/build/secp256k1-sys-6b3c23eb15e9fc2b/out)
  TARGET = Some(x86_64-pc-windows-msvc)
  OPT_LEVEL = Some(3)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=VCINSTALLDIR
  VCINSTALLDIR = None
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CROSS_COMPILE
  CROSS_COMPILE = None
  RUSTC_LINKER = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  cargo:warning=GNU compiler is not supported for this target
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  OUT_DIR = Some(/var/www/Kraken/target/x86_64-pc-windows-msvc/release/build/secp256k1-sys-6b3c23eb15e9fc2b/out)
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  OUT_DIR = Some(/var/www/Kraken/target/x86_64-pc-windows-msvc/release/build/secp256k1-sys-6b3c23eb15e9fc2b/out)
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=GNU compiler is not supported for this target
  cargo:warning=In file included from /usr/include/stdio.h:894,
  cargo:warning=                 from depend/secp256k1/src/util.h:14,
  cargo:warning=                 from depend/secp256k1/src/field.h:10,
  cargo:warning=                 from depend/secp256k1/src/group.h:10,
  cargo:warning=                 from depend/secp256k1/src/precomputed_ecmult_gen.c:3:
  cargo:warning=/usr/include/x86_64-linux-gnu/bits/stdio2.h:111:1: error: expected identifier or ‘(’ before ‘{’ token
  cargo:warning=  111 | {
  cargo:warning=      | ^
  cargo:warning=GNU compiler is not supported for this target
  cargo:warning=GNU compiler is not supported for this target
  cargo:warning=GNU compiler is not supported for this target
  cargo:warning=GNU compiler is not supported for this target
  cargo:rerun-if-env-changed=AR_x86_64-pc-windows-msvc
  AR_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=AR_x86_64_pc_windows_msvc
  AR_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:warning=GNU compiler is not supported for this target
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-pc-windows-msvc
  ARFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_pc_windows_msvc
  ARFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None

  --- stderr


  error occurred: Failed to find tool. Is `lib.exe` installed?

Am I missing something obivous?

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