Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Build failure – missing pkg-config #250

Closed
c7hm4r opened this issue Apr 7, 2017 · 5 comments · Fixed by #251
Closed

Build failure – missing pkg-config #250

c7hm4r opened this issue Apr 7, 2017 · 5 comments · Fixed by #251

Comments

@c7hm4r
Copy link
Contributor

c7hm4r commented Apr 7, 2017

The RLS does not build on my machine:

$ RUST_BACKTRACE=full cargo build --release
   Compiling openssl-sys v0.9.10
   Compiling serde_derive v0.9.13
   Compiling syntex_syntax v0.58.1
   Compiling chrono v0.2.25
   Compiling docopt v0.7.0
   Compiling url_serde v0.1.3
   Compiling cookie v0.2.5
   Compiling env_logger v0.3.5
error: failed to run custom build command for `openssl-sys v0.9.10`
process didn't exit successfully: `/home/christoph/repos/rls/target/release/build/openssl-sys-175a395ff0fee212/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"', /checkout/src/libcore/result.rs:859
stack backtrace:
   0:     0x55b3b508ff93 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h0c49f46a3545f908
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x55b3b508c1e4 - std::sys_common::backtrace::_print::hcef39a9816714c4c
                               at /checkout/src/libstd/sys_common/backtrace.rs:71
   2:     0x55b3b5095287 - std::panicking::default_hook::{{closure}}::h7c3c94835e02f846
                               at /checkout/src/libstd/sys_common/backtrace.rs:60
                               at /checkout/src/libstd/panicking.rs:355
   3:     0x55b3b5094e0b - std::panicking::default_hook::h0bf7bc3112fb107d
                               at /checkout/src/libstd/panicking.rs:371
   4:     0x55b3b50956fb - std::panicking::rust_panic_with_hook::ha27630c950090fec
                               at /checkout/src/libstd/panicking.rs:549
   5:     0x55b3b50955d4 - std::panicking::begin_panic::heb97fa3158b71158
                               at /checkout/src/libstd/panicking.rs:511
   6:     0x55b3b5095509 - std::panicking::begin_panic_fmt::h8144403278d84748
                               at /checkout/src/libstd/panicking.rs:495
   7:     0x55b3b5095497 - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:471
   8:     0x55b3b50bb16d - core::panicking::panic_fmt::h3b0cca53e68f9654
                               at /checkout/src/libcore/panicking.rs:69
   9:     0x55b3b506dc63 - core::result::unwrap_failed::heffb5e37a25f284d
  10:     0x55b3b50714ce - build_script_build::main::h584b71f3a86cfba2
  11:     0x55b3b5095455 - std::panicking::try::do_call::h689a21caeeef92aa
                               at /checkout/src/libcore/ops.rs:2606
                               at /checkout/src/libstd/panicking.rs:454
  12:     0x55b3b509e26a - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:98
  13:     0x55b3b5095e9a - std::rt::lang_start::hf63d494cb7dd034c
                               at /checkout/src/libstd/panicking.rs:433
                               at /checkout/src/libstd/panic.rs:361
                               at /checkout/src/libstd/rt.rs:57
  14:     0x7f264e69d82f - __libc_start_main
  15:     0x55b3b506c098 - _start
  16:                0x0 - <unknown>

Build failed, waiting for other jobs to finish...
error: build failed
[101]

My configuration

$ git show
commit 32cd023ef6c70e9819a6743807510315497978f5
Merge: 1cd7043 e5bbb8e
Author: Nick Cameron <nrc@ncameron.org>
Date:   Fri Apr 7 21:11:29 2017 +1200

    Merge pull request #244 from oli-obk/master
    
    Add sysroot configuration to rls.toml

$ rustup show
Default host: x86_64-unknown-linux-gnu

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.18.0-nightly (50c186419 2017-04-06)
$ rustup component list | grep '(default)\|(installed)'
cargo-x86_64-unknown-linux-gnu (default)
rust-analysis-x86_64-unknown-linux-gnu (installed)
rust-docs-x86_64-unknown-linux-gnu (default)
rust-src (installed)
rust-std-x86_64-unknown-linux-gnu (default)
rustc-x86_64-unknown-linux-gnu (default)

OS: Ubuntu Gnome 16.04 LTS
Package openssl is installed.

Solution

Cloning https://github.com/sfackler/rust-openssl and running cargo build in its openssl-sys directory yields:

$ cargo build
   Compiling libc v0.2.21
   Compiling pkg-config v0.3.9
   Compiling gcc v0.3.45
   Compiling openssl-sys v0.9.10 (file:///home/christoph/repos/rust-openssl/openssl-sys)
error: failed to run custom build command for `openssl-sys v0.9.10 (file:///home/christoph/repos/rust-openssl/openssl-sys)`
process didn't exit successfully: `/home/christoph/repos/rust-openssl/target/debug/build/openssl-sys-bb6d7f935662086b/build-script-build` (exit code: 101)
--- stdout
run pkg_config fail: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"

--- 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.10


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`.

', build.rs:179
note: Run with `RUST_BACKTRACE=1` for a backtrace.

[101]

So finally following helped:

$ sudo apt-get install pkg-config

I think this should be documented.

@c7hm4r c7hm4r changed the title Build failure Build failure – missing pkg-config Apr 7, 2017
@nrc nrc closed this as completed in #251 Apr 8, 2017
@gagarin55
Copy link

I didn't catch what is solution fort this issue ? Please, help

@c7hm4r
Copy link
Contributor Author

c7hm4r commented Apr 15, 2017

You can try to install pkg-config (Ubuntu) or pkgconfig (Fedora)

@nickgonzales
Copy link

This solution did not work for me on Ubuntu 17.04. I already had pkg-config installed.

I had to also install:

  • libssh-devel
  • cmake

@c7hm4r
Copy link
Contributor Author

c7hm4r commented Apr 25, 2017

@nickgonzales Note: rls can now be installed via rustup, see https://github.com/rust-lang-nursery/rls#setup

@discosultan
Copy link

If libssh-devel does not work, try libssh-dev.

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

Successfully merging a pull request may close this issue.

4 participants