Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross not work with --target=i686-unknown-linux-gnu on my ubuntu 20.04 64-bit os #617

Closed
liudonghua123 opened this issue Dec 16, 2021 · 2 comments

Comments

@liudonghua123
Copy link

I installed and configured cross according to https://github.com/rust-embedded/cross, https://podman.io/getting-started/installation.html, https://www.atlantic.net/dedicated-server-hosting/how-to-install-and-use-podman-on-ubuntu-20-04/.

I create a sample tauri app and want to build a 32-bit linux app, then I execute cross build --target=i686-unknown-linux-gnu --release. but it failed with the following errors. It seemed the os in the docker is 64-bit not 32-bit.

logs
liudonghua@DESKTOP-DELL:/mnt/d/code/rust/tauri-app$ cd src-tauri/
liudonghua@DESKTOP-DELL:/mnt/d/code/rust/tauri-app/src-tauri$ cross build --target=i686-unknown-linux-gnu --release
info: downloading component 'rust-src'
info: retrying download for 'https://static.rust-lang.org/dist/2021-12-02/rust-src-1.57.0.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2021-12-02/rust-src-1.57.0.tar.xz'
  2.4 MiB /   2.4 MiB (100 %) 456.2 KiB/s in  3s ETA:  0s
info: installing component 'rust-src'
Unable to find image 'rustembedded/cross:i686-unknown-linux-gnu-0.2.1' locally
i686-unknown-linux-gnu-0.2.1: Pulling from rustembedded/cross
b5e173e44934: Pull complete
29047100b040: Pull complete
15743a713c2a: Pull complete
4b6bc9e29877: Pull complete
34ea03ff2444: Pull complete
abff224518c3: Pull complete
6680dabef0d0: Pull complete
be74807f7b06: Pull complete
66ef7ba0daf5: Pull complete
d38a2c9d2ff8: Pull complete
6d903a8f299e: Pull complete
276f952e2bc7: Pull complete
017a015267b2: Pull complete
0af284a73b45: Pull complete
a30b17c5c6ec: Pull complete
312f77096739: Pull complete
dcf4fb1eddf8: Pull complete
98c5ce4a6a7e: Pull complete
Digest: sha256:e9393178d1d59be819c3e4318880ca816b3b04acc225097a4784aa1f59b41da9
Status: Downloaded newer image for rustembedded/cross:i686-unknown-linux-gnu-0.2.1
   Compiling proc-macro2 v1.0.33
   Compiling unicode-xid v0.2.2
   Compiling libc v0.2.111
   Compiling syn v1.0.82
   Compiling serde_derive v1.0.131
   Compiling serde v1.0.131
   Compiling pkg-config v0.3.24
   Compiling unicode-segmentation v1.8.0
   Compiling smallvec v1.7.0
   Compiling anyhow v1.0.51
   Compiling either v1.6.1
   Compiling version-compare v0.0.11
   Compiling cfg-if v1.0.0
   Compiling strum v0.21.0
   Compiling autocfg v1.0.1
   Compiling ppv-lite86 v0.2.15
   Compiling memchr v2.4.1
   Compiling siphasher v0.3.7
   Compiling getrandom v0.1.16
   Compiling version_check v0.9.3
   Compiling log v0.4.14
   Compiling bitflags v1.3.2
   Compiling proc-macro-hack v0.5.19
   Compiling futures-core v0.3.18
   Compiling pin-project-lite v0.2.7
   Compiling once_cell v1.8.0
   Compiling futures-task v0.3.18
   Compiling futures-io v0.3.18
   Compiling futures-channel v0.3.18
   Compiling futures-sink v0.3.18
   Compiling parking_lot_core v0.8.5
   Compiling futures-util v0.3.18
   Compiling slab v0.4.5
   Compiling version-compare v0.0.10
   Compiling pin-utils v0.1.0
   Compiling strum v0.18.0
   Compiling crossbeam-utils v0.8.5
   Compiling byteorder v1.4.3
   Compiling lazy_static v1.4.0
   Compiling scopeguard v1.1.0
   Compiling ucd-trie v0.1.3
   Compiling serde_json v1.0.72
   Compiling matches v0.1.9
   Compiling zstd-safe v4.1.1+zstd.1.5.0
   Compiling itoa v0.4.8
   Compiling convert_case v0.4.0
   Compiling gio v0.14.8
   Compiling tinyvec_macros v0.1.0
   Compiling new_debug_unreachable v1.0.4
   Compiling mac v0.1.1
   Compiling precomputed-hash v0.1.1
   Compiling percent-encoding v2.1.0
   Compiling crossbeam-epoch v0.9.5
   Compiling crc32fast v1.3.0
   Compiling fnv v1.0.7
   Compiling ryu v1.0.9
   Compiling typenum v1.14.0
   Compiling dtoa v0.4.8
   Compiling utf-8 v0.7.6
   Compiling rayon-core v1.9.1
   Compiling unicode-bidi v0.3.7
   Compiling stable_deref_trait v1.2.0
   Compiling cty v0.2.2
   Compiling nodrop v0.1.14
   Compiling bytes v1.1.0
   Compiling thin-slice v0.1.1
   Compiling tao v0.5.2 (https://github.com/tauri-apps/tao?branch=next#dce2d529)
   Compiling cache-padded v1.1.1
   Compiling nix v0.17.0
   Compiling adler v1.0.2
   Compiling openssl v0.10.38
   Compiling adler32 v1.2.0
   Compiling waker-fn v1.1.0
   Compiling fastrand v1.5.0
   Compiling foreign-types-shared v0.1.1
   Compiling parking v2.0.0
   Compiling same-file v1.0.6
   Compiling static_assertions v1.1.0
   Compiling regex-syntax v0.6.25
   Compiling arrayref v0.3.6
   Compiling cfg-if v0.1.10
   Compiling constant_time_eq v0.1.5
   Compiling arrayvec v0.7.2
   Compiling native-tls v0.2.8
   Compiling wry v0.12.2 (https://github.com/tauri-apps/wry?rev=11557f15cf759fcf3008598b684c009f03a8c645#11557f15)
   Compiling void v1.0.2
   Compiling cfg_aliases v0.1.1
   Compiling rfd v0.6.1
   Compiling scoped-tls v1.0.0
   Compiling semver v1.0.4
   Compiling openssl-probe v0.1.4
   Compiling http-range v0.1.4
   Compiling pathdiff v0.2.1
   Compiling wildmatch v2.1.0
   Compiling remove_dir_all v0.5.3
   Compiling state v0.5.2
   Compiling minisign-verify v0.2.0
   Compiling base64 v0.13.0
   Compiling heck v0.3.3
   Compiling cfg-expr v0.8.1
   Compiling cfg-expr v0.9.0
   Compiling gtk v0.14.3
   Compiling x11-dl v2.19.1
   Compiling itertools v0.10.3
   Compiling instant v0.1.12
   Compiling memoffset v0.6.5
   Compiling miniz_oxide v0.4.4
   Compiling rayon v1.5.1
   Compiling tokio v1.14.0
   Compiling phf_shared v0.8.0
   Compiling phf_shared v0.10.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling generic-array v0.14.4
   Compiling thread_local v1.1.3
   Compiling fxhash v0.2.1
   Compiling lock_api v0.4.5
   Compiling pest v2.1.3
   Compiling tinyvec v1.5.1
   Compiling futf v0.1.4
   Compiling form_urlencoded v1.0.1
   Compiling dtoa-short v0.3.3
   Compiling raw-window-handle v0.4.2
   Compiling servo_arc v0.1.1
   Compiling http v0.2.5
   Compiling concurrent-queue v1.2.2
   Compiling deflate v0.8.6
   Compiling miniz_oxide v0.3.7
   Compiling foreign-types v0.3.2
   Compiling walkdir v2.3.2
   Compiling tauri v1.0.0-beta.8 (https://github.com/tauri-apps/tauri?branch=next#d56a7fc7)
   Compiling open v2.0.2
   Compiling tendril v0.4.2
   Compiling semver-parser v0.10.2
   Compiling unicode-normalization v0.1.19
   Compiling quote v1.0.10
   Compiling tauri-build v1.0.0-beta.4 (https://github.com/tauri-apps/tauri?branch=next#d56a7fc7)
   Compiling jobserver v0.1.24
   Compiling getrandom v0.2.3
   Compiling num_cpus v1.13.0
   Compiling socket2 v0.4.2
   Compiling raw-window-handle v0.3.4
   Compiling time v0.1.43
   Compiling filetime v0.2.15
   Compiling xattr v0.2.2
   Compiling dirs-sys-next v0.1.2
   Compiling os_pipe v1.0.0
   Compiling shared_child v1.0.0
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling polling v2.2.0
   Compiling futures-lite v1.12.0
   Compiling crossbeam-channel v0.5.1
   Compiling semver v0.11.0
   Compiling png v0.16.8
   Compiling idna v0.2.3
   Compiling app v0.1.0 (/project)
   Compiling rand_core v0.6.3
   Compiling cc v1.0.72
   Compiling rand_core v0.5.1
   Compiling parking_lot v0.11.2
   Compiling uuid v0.8.2
   Compiling nb-connect v1.2.0
   Compiling tar v0.4.37
   Compiling dirs-next v2.0.0
   Compiling flate2 v1.0.22
   Compiling regex v1.5.4
   Compiling async-io v1.6.0
   Compiling rustc_version v0.3.3
   Compiling rand_chacha v0.3.1
   Compiling rand_chacha v0.2.2
   Compiling rand_pcg v0.2.1
   Compiling crossbeam-deque v0.8.1
   Compiling cfb v0.4.0
   Compiling zstd-sys v1.6.1+zstd.1.5.0
   Compiling openssl-sys v0.9.72
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling blake3 v1.2.0
   Compiling globset v0.4.8
   Compiling field-offset v0.3.4
   Compiling rand v0.8.4
   Compiling rand v0.7.3
   Compiling thiserror-impl v1.0.30
   Compiling strum_macros v0.21.1
   Compiling futures-macro v0.3.18
   Compiling strum_macros v0.18.0
   Compiling cssparser v0.27.2
   Compiling html5ever v0.25.1
   Compiling cssparser-macros v0.6.0
   Compiling derive_more v0.99.17
   Compiling enumflags2_derive v0.6.4
   Compiling serde_repr v0.1.7
   Compiling derivative v2.2.0
   Compiling infer v0.4.0
   Compiling digest v0.9.0
   Compiling ignore v0.4.18
   Compiling phf_generator v0.10.0
error: failed to run custom build command for `openssl-sys v0.9.72`

Caused by:
  process didn't exit successfully: `/target/release/build/openssl-sys-d87840f444dcaa66/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=I686_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  I686_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=I686_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  I686_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=I686_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  I686_UNKNOWN_LINUX_GNU_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_i686-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_i686_unknown_linux_gnu
  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_i686-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_i686_unknown_linux_gnu
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_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_i686-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_i686_unknown_linux_gnu
  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_i686-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_i686_unknown_linux_gnu
  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_i686-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_i686_unknown_linux_gnu
  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\" \"--libs\" \"--cflags\" \"openssl\"` did not exit successfully: exit status: 1\nerror: could not find system library 'openssl' required by the 'openssl-sys' crate\n\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'openssl' found\n"

  --- 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 = i686-unknown-linux-gnu
  openssl-sys = 0.9.72

  ', /cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.72/build/find_normal.rs:180:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
liudonghua@DESKTOP-DELL:/mnt/d/code/rust/tauri-app/src-tauri$
@Emilgardis
Copy link
Member

Openssl is not installed in the image, see #229

In #510 there is a workaround using vendored OpenSSL

You can also also specify a custom image with OpenSSL installed, see https://github.com/rust-embedded/cross#custom-docker-images

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented May 29, 2022

With #727 we've added the PKG_CONFIG_PATH to all *-linux-gnu images, so adding external packages is now documented and pkg-config support is enabled by default. This is a duplicate of #149.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants