taiki-e / setup-cross-toolchain-action

GitHub Action for setup toolchains for cross compilation and cross testing for Rust.
Apache License 2.0
32 stars 3 forks source link

Cross.toml is ignored? #8

Closed VorpalBlade closed 1 year ago

VorpalBlade commented 1 year ago

I set up a project that uses Cross.toml to install OpenSSL in the pre-build step as documented here:

[target.armv7-unknown-linux-gnueabihf]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH"
]

# Same for the other architectures

This works fine locally, but it seems to be ignored by this action, as I'm getting errors like this: https://github.com/VorpalBlade/chezmoi_modify_manager/actions/runs/4692601025/jobs/8318514294

 error: failed to run custom build command for `openssl-sys v0.9.85`

Caused by:
  process didn't exit successfully: `/home/runner/work/chezmoi_modify_manager/chezmoi_modify_manager/target/debug/build/openssl-sys-84e6b09c34fe3be8/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR
  ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR
  ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR
  ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
  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_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: pkg-config has not been configured to support cross-compilation.

  Install a sysroot for the target platform and configure it via
  PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
  cross-compiling wrapper for pkg-config and set it via
  PKG_CONFIG environment variable.

  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = armv7-unknown-linux-gnueabihf
  openssl-sys = 0.9.85

  ', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.85/build/find_normal.rs:190:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/4087deaccd8bceb458c9610d29744d5f3504c5c0/library/std/src/panicking.rs:577:5
     1: core::panicking::panic_fmt
               at /rustc/4087deaccd8bceb458c9610d29744d5f3504c5c0/library/core/src/panicking.rs:67:14
     2: core::panicking::panic_display
               at /rustc/4087deaccd8bceb458c9610d29744d5f3504c5c0/library/core/src/panicking.rs:150:5
     3: build_script_main::find_normal::find_openssl_dir
               at ./build/find_normal.rs:190:5
     4: build_script_main::find_normal::get_openssl::{{closure}}
               at ./build/find_normal.rs:14:68
     5: core::option::Option<T>::unwrap_or_else
               at /rustc/4087deaccd8bceb458c9610d29744d5f3504c5c0/library/core/src/option.rs:1000:21
     6: build_script_main::find_normal::get_openssl
               at ./build/find_normal.rs:14:31
     7: build_script_main::find_openssl
               at ./build/main.rs:63:5
     8: build_script_main::main
               at ./build/main.rs:80:35
     9: core::ops::function::FnOnce::call_once
               at /rustc/4087deaccd8bceb458c9610d29744d5f3504c5c0/library/core/src/ops/function.rs:250:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This is either a bug, or am I doing something stupid/wrong (quite possible).

taiki-e commented 1 year ago

Cross.toml is a config for cross-rs/cross. Unrelated to this project.

If you want to use cross-rs/cross in github actions I would recommend using install-action to install it.

VorpalBlade commented 1 year ago

Oh okay, I thought this used cross. Thanks.