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 sccache on Ubuntu 18.04 #749

Closed
augusto2112 opened this issue May 19, 2020 · 3 comments
Closed

Can't build sccache on Ubuntu 18.04 #749

augusto2112 opened this issue May 19, 2020 · 3 comments

Comments

@augusto2112
Copy link

I'm trying to install sccache but I can't make it work. I'm using Ubuntu 18.04

It fails with the message: Failed to find OpenSSL development headers. (...)

I installed OpenSSL by following the sccache page's instructions.

All the environment variables seems to be set correctly:

➜  sccache git:(master) echo $OPENSSL_LIB_DIR    
/usr/local/lib
➜  sccache git:(master) echo $OPENSSL_INCLUDE_DIR
/usr/local/include
➜  sccache git:(master) echo $OPENSSL_STATIC     
yes
➜  sccache git:(master) which openssl
/usr/local/bin/openssl

I tried setting OPENSSL_DIR to both /usr/local and /usr/local/bin but it still doesn't work.

Anyone has any idea what I'm doing wrong?

Here's the whole error message:

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

Caused by:
  process didn't exit successfully: `/tmp/cargo-installGKAYDn/release/build/openssl-sys-a8c73423c4f344c2/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
cargo:rustc-link-search=native=/usr/local/lib
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/usr/local/include" "-Wall" "-Wextra" "-E" "build/expando.c"
cargo:warning=build/expando.c:4:24: error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
cargo:warning= #define VERSION2(n, v) RUST_VERSION_##n##_##v
cargo:warning=                        ^
cargo:warning=build/expando.c:5:23: note: in expansion of macro ‘VERSION2’
cargo:warning= #define VERSION(n, v) VERSION2(n, v)
cargo:warning=                       ^~~~~~~~
cargo:warning=build/expando.c:10:1: note: in expansion of macro ‘VERSION’
cargo:warning= VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
cargo:warning= ^~~~~~~
exit code: 1

--- stderr
thread 'main' panicked at '
Header expansion error:
Error { kind: ToolExecError, message: "Command \"cc\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-m64\" \"-I\" \"/usr/local/include\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args \"cc\" did not execute successfully (status code exit code: 1)." }

Failed to find OpenSSL development headers.

You can try fixing this setting the `OPENSSL_DIR` environment variable
pointing to your OpenSSL installation or installing OpenSSL headers package
specific to your distribution:

    # On Ubuntu
    sudo apt-get install libssl-dev
    # On Arch Linux
    sudo pacman -S openssl
    # On Fedora
    sudo dnf install openssl-devel

See rust-openssl README for more information:

    https://github.com/sfackler/rust-openssl#linux
', /home/augusto/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.56/build/main.rs:138:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: failed to compile `sccache v0.2.13`, intermediate artifacts can be found at `/tmp/cargo-installGKAYDn`
@luser
Copy link
Contributor

luser commented May 19, 2020

I think you might get better help opening an issue on the rust-openssl repository. If there's something specific to sccache's usage of rust-openssl then it can certainly be fixed here, but it sounds like the problem is just that you can't build that crate on your system.

@augusto2112
Copy link
Author

@luser thank you! I took a look at the issues in rust-openssl and someone had the same issue as me. I got it working now. Should've looked there sooner!

@mirrir0
Copy link

mirrir0 commented Aug 15, 2023

For those who find this issue in the future. Make sure you have the openssl dev packages installed libssl-dev (sfackler/rust-openssl#1021 (comment))

sudo apt install libssl-dev

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

No branches or pull requests

3 participants