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

Can't build with x86_64-musl around pkg-config #51

Closed
HiraokaTakuya opened this issue Aug 10, 2022 · 3 comments · Fixed by #53
Closed

Can't build with x86_64-musl around pkg-config #51

HiraokaTakuya opened this issue Aug 10, 2022 · 3 comments · Fixed by #53

Comments

@HiraokaTakuya
Copy link

I want to build the plotters example in x86_64-musl.
I did these commands.

git clone https://github.com/plotters-rs/plotters.git --recursive
cd plotters
docker run --rm -it -v `pwd`:/home/rust/src messense/rust-musl-cross:x86_64-musl
# in the container.
cd plotters
RUST_BACKTRACE=1 cargo run --example histogram

And I got errors.

error: failed to run custom build command for `yeslogic-fontconfig-sys v3.2.0`

Caused by:
  process didn't exit successfully: `/home/rust/src/target/debug/build/yeslogic-fontconfig-sys-cac8f25c1297fba5/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=RUST_FONTCONFIG_DLOPEN
  cargo:rerun-if-env-changed=FONTCONFIG_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_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_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_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_SYSROOT_DIR_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_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 'called `Result::unwrap()` on an `Err` value: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/yeslogic-fontconfig-sys-3.2.0/build.rs:8:48
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
     2: core::result::unwrap_failed
               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
     3: core::result::Result<T,E>::unwrap
               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1078:23
     4: build_script_build::main
               at ./build.rs:8:9
     5: core::ops::function::FnOnce::call_once
               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:248:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...

It seems to be a problem with the configuration around pkg-config.
Sorry if this is not appropriate as an issue.
Is this a problem with messense/rust-musl-cross:x86_64-musl ?
Or should I create a properly configured Docker container based on messense/rust-musl-cross:x86_64-musl ?

@messense
Copy link
Member

I don't know much about pkg-config, I'm afraid I'm unable to help you.

@prisme60
Copy link

I think if you are building a musl executable, you don't have the right to use local libraries that are using glibc. That's why you need a pkg-config of a cross build environment. You can try to use buildroot https://buildroot.org/ and add your own package(s).

@paulwratt
Copy link

paulwratt commented Sep 18, 2022

@HiraokaTakuya can you not edit the Docker file and add pkg-config or did you not want a full OS docker image?

(or is that docker file explicitly for building rust-musl-cross - you could try pulling pkg-config off an Alpine image)

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

Successfully merging a pull request may close this issue.

4 participants