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

Failing to build: custom build command for openssl-sys fails #50

Closed
LemmingAvalanche opened this issue Mar 30, 2017 · 3 comments
Closed

Comments

@LemmingAvalanche
Copy link

I am trying to build this program with cargo build, but I get an error
which seems to be coming from the package openssl-sys, version 0.9.1.

Steps to reproduce

Executed with Rustc version 1.12.0 and Cargo version 0.13.0 in shell
nix-shell --pure -p rustStable.rustc -p rustStable.cargo -p git.

  • OS: Ubuntu 14.04
$ git checkout 0.9.1
$ cargo --version
cargo 0.13.0 (built 2016-10-21)
$ rustc --version
rustc 1.12.0
$ RUST_BACKTRACE=1 cargo build
   Compiling openssl-sys v0.9.1
   Compiling num v0.1.36
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys v0.9.1`
process didn't exit successfully: `<path>/git-and-tools/git-series/repo/git-series/target/debug/build/openssl-sys-76c1fa79ef1208aa/build-script-build` (exit code: 101)
--- 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.

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 = x86_64-unknown-linux-gnu
    openssl-sys = 0.9.1


It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.

', <home>/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.1/build.rs:142
stack backtrace:
   1:     0x563b41d65f0b - std::sys::backtrace::tracing::imp::write::h00e948915d1e4c72
   2:     0x563b41d6cddf - std::panicking::default_hook::_{{closure}}::h7b8a142818383fb8
   3:     0x563b41d6c025 - std::panicking::default_hook::h41cf296f654245d7
   4:     0x563b41d6c6e5 - std::panicking::rust_panic_with_hook::h4cbd7ca63ce1aee9
   5:     0x563b41d28d76 - std::panicking::begin_panic::h93672d0313d5e8e9
                        at /tmp/nix-build-rustc-1.12.0.drv-0/rust-3191fba/src/libstd/panicking.rs:384
   6:     0x563b41d416fb - build_script_build::find_openssl_dir::hb68e52b7bbb3a4dd
                        at <home>/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.1/build.rs:3
   7:     0x563b41d43688 - build_script_build::main::_{{closure}}::h3e9f4699862f6d52
                        at <home>/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.1/build.rs:15
   8:     0x563b41d23d80 - _<core..option..Option<T>>::unwrap_or_else::heb656dab87effcd3
                        at /tmp/nix-build-rustc-1.12.0.drv-0/rust-3191fba/src/libcore/option.rs:361
   9:     0x563b41d400e9 - build_script_build::main::h73ab0570d224c5dd
                        at <home>/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.1/build.rs:14
  10:     0x563b41d72c76 - __rust_maybe_catch_panic
  11:     0x563b41d6ba39 - std::rt::lang_start::h53bf99b0829cc03c
  12:     0x563b41d447a3 - main
  13:     0x7fc3caf3c2df - __libc_start_main
  14:     0x563b41d20769 - _start
                        at ../sysdeps/x86_64/start.S:120
  15:                0x0 - <unknown>
@joshtriplett
Copy link
Member

@LemmingAvalanche Do you have pkg-config installed, as well as a -dev package for libssl?

@LemmingAvalanche
Copy link
Author

@LemmingAvalanche Do you have pkg-config installed, as well as a -dev
package for libssl?

Good question. I did have pkg-config(1) installed but apparently not
libssl dev.

The thing is that I used the --pure flag to the nix-shell command,
which makes it so that most things are not included on PATH in order
to get more reproducible behaviour. But I was able to make Git-series
build successfully by removing that flag and installing libssl-dev
through APT (my OS package manager).

So running this:

sudo apt-get install libssl-dev
nix-shell -p rustStable.rustc -p rustStable.cargo -p git

Gave me a shell in which I could run RUST_BACKTRACE=1 cargo build with
success.

Closing since now it seems I just need to figure out how to find the
right packages in Nix in order to get this to work as I want (in a
pure way).

I’ve been unsuccesful in finding the right packages to use from Nix.
I’ve tried the packages libressl, openssl, and pkgconfig, but both
of these Nix shells weren’t good enough:

nix-shell --pure -p rustStable.rustc -p rustStable.cargo -p git -p openssl -p pkgconfig
nix-shell -p rustStable.rustc -p rustStable.cargo -p git -p libressl -p pkgconfig

@LemmingAvalanche
Copy link
Author

It turns out that Git-series has been added to Nixpkgs recently:
NixOS/nixpkgs/pull/25666.

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

2 participants