Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 756913 - dev-util/sccache: build fails because OPENSSL_DIR isn't set.
Summary: dev-util/sccache: build fails because OPENSSL_DIR isn't set.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-26 20:28 UTC by Allen Webb
Modified: 2020-11-28 06:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build log (dev-util:sccache-0.2.13:20201126-202244.log,139.28 KB, text/x-log)
2020-11-26 20:30 UTC, Allen Webb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Allen Webb 2020-11-26 20:28:30 UTC
I am importing dev-util/sccache into Chrome OS and ran into the following:

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

Caused by:
  process didn't exit successfully: `/var/tmp/portage/dev-util/sccache-0.2.13/work/sccache-0.2.13/target/release/build/openssl-sys-a0d5a562fcd388a9/build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset

I have a workaround here:
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2562578/1/dev-util/sccache/sccache.bashrc

However, it would be possible to fix this by adding:

export OPENSSL_DIR="${ESYSROOT}/usr"

to src_prepare

Reproducible: Always
Comment 1 Allen Webb 2020-11-26 20:30:11 UTC
Created attachment 675190 [details]
Build log
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-11-27 20:18:23 UTC
looks like you have some kind of pkg-config wrapper in cros returns  err.

the error comes from pkg-config invocation

ERROR: Do not call unprefixed tools directly.\n \u{1b}[31;01m*\u{1b}[0m pkg-config: ERROR: For board tools, use `tc-export PKG_CONFIG` (or ${CHOST}-pkg-config).\n \u{1b}[31;01m*\u{1b}[0m pkg-config: ERROR: For build-time-only tools, `tc-export BUILD_PKG_CONFIG` (or ${CBUILD}-pkg-config)


here's the logic how the crate chooses which pkg-config to run


    fn command(&self, name: &str, args: &[&str]) -> Command {
        let exe = self
            .env_var_os("PKG_CONFIG")
            .unwrap_or_else(|| OsString::from("pkg-config"));

https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L395-L398


so I think more appropriate fix would be to export PKG_CONFIG variable properly, like wrapper suggests.

in ::gentoo we do it in cargo_src_compile from cargo.eclass

currently it has tc-export AR CC CXX
I can add PKG_CONFIG in there.
in case you don't use our cargo.eclass, I think you could add similar export to yours.


can you test this suggestion with your wrapper?
Comment 3 Allen Webb 2020-11-28 02:02:40 UTC
I added PKG_CONFIG to the tc-export in cargo_src_compile() like you suggested and that worked. Thanks.
Comment 4 Georgy Yakovlev archtester gentoo-dev 2020-11-28 06:35:19 UTC
nice, thanks for confirming.
Comment 5 Larry the Git Cow gentoo-dev 2020-11-28 06:36:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=010e27edb8f99fa7d61a51acbaffafac6b7f8a33

commit 010e27edb8f99fa7d61a51acbaffafac6b7f8a33
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-11-28 06:34:22 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-11-28 06:35:49 +0000

    eclass/cargo.eclass: tc-export PKG_CONFIG
    
    this way cargo will call properly prefixed pkg-config binary
    
    Closes: https://bugs.gentoo.org/756913
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 eclass/cargo.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)