0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Cargoインストールでエラーがおきてstarshipがインストールできない

Posted at

はじめに

この記事は2021年9月にまとめていた「細かいつまずいたことをメモしておく(9月編)をそれぞれ投稿した内容になります
解決方法が最新でない可能性もありますのでご了承ください

エラー

インストールすると以下のエラーが出力された

   Compiling pest_derive v2.1.0
error: failed to run custom build command for `openssl-sys v0.9.66`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installSj4bjN/release/build/openssl-sys-090202b3636be089/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:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  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.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

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


  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/jinwatanabe/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.66/build/find_normal.rs:174:5
  stack backtrace:
     0:     0x55fab30dc99c - std::backtrace_rs::backtrace::libunwind::trace::h7f0f727c679b121e
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
     1:     0x55fab30dc99c - std::backtrace_rs::backtrace::trace_unsynchronized::h27b8207adc787597
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x55fab30dc99c - std::sys_common::backtrace::_print_fmt::h18c4a15687f3f453
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:67:5
     3:     0x55fab30dc99c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7077f94cc0b2a619
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:46:22
     4:     0x55fab31115af - core::fmt::write::hd1fcbdc89ccede50
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/core/src/fmt/mod.rs:1096:17
     5:     0x55fab30dbfe6 - std::io::Write::write_fmt::h3030f95a96ab63e0
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/io/mod.rs:1568:15
     6:     0x55fab30f01d5 - std::sys_common::backtrace::_print::hce920b6e4ede72f2
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:49:5
     7:     0x55fab30f01d5 - std::sys_common::backtrace::print::h63694f3a744810f6
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:36:9
     8:     0x55fab30f01d5 - std::panicking::default_hook::{{closure}}::h2f22ad38e825d5e1
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:208:50
     9:     0x55fab30efda3 - std::panicking::default_hook::hc0998dccd7f968a3
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:225:9
    10:     0x55fab30f0805 - std::panicking::rust_panic_with_hook::h618d5ded1dbe5ea3
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:591:17
    11:     0x55fab30dd1b7 - std::panicking::begin_panic_handler::{{closure}}::h64f3a351a9df3931
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:497:13
    12:     0x55fab30dcafc - std::sys_common::backtrace::__rust_end_short_backtrace::hf7a8c7450479e920
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/sys_common/backtrace.rs:141:18
    13:     0x55fab30f03b2 - rust_begin_unwind
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:493:5
    14:     0x55fab30f036b - std::panicking::begin_panic_fmt::hebe0559d9879d61b
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:435:5
    15:     0x55fab303d274 - build_script_main::find_normal::find_openssl_dir::ha3782c7996688df2
    16:     0x55fab303c2e7 - build_script_main::find_normal::get_openssl::{{closure}}::hbbdead3b8da0aeaa
    17:     0x55fab30403c0 - core::option::Option<T>::unwrap_or_else::h4dbf788cd9a5f6b7
    18:     0x55fab303c04a - build_script_main::find_normal::get_openssl::h9567b5384dcb1837
    19:     0x55fab3034b4d - build_script_main::find_openssl::h84084a24f90f8a7c
    20:     0x55fab3034bf5 - build_script_main::main::h8f173f664736eea4
    21:     0x55fab303a853 - core::ops::function::FnOnce::call_once::h4717c67e116b6fc8
    22:     0x55fab303a6b9 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0f14a1131e43c4ad
    23:     0x55fab3038709 - std::rt::lang_start::{{closure}}::h491fe49517409c1a
    24:     0x55fab30f0b0a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hacf21ab16c4aa1f7
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/core/src/ops/function.rs:259:13
    25:     0x55fab30f0b0a - std::panicking::try::do_call::h002bd74c4d814788
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:379:40
    26:     0x55fab30f0b0a - std::panicking::try::hae0844c0aa736d3d
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panicking.rs:343:19
    27:     0x55fab30f0b0a - std::panic::catch_unwind::hec4fe4ae39575e8f
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/panic.rs:431:14
    28:     0x55fab30f0b0a - std::rt::lang_start_internal::h024664467cde3297
                                 at /build/rustc-AUyUKS/rustc-1.51.0+dfsg1+llvm/library/std/src/rt.rs:51:25
    29:     0x55fab30386e8 - std::rt::lang_start::hd6f7e7517feffc60
    30:     0x55fab303854b - main
    31:     0x7fe3ee21e0b3 - __libc_start_main
    32:     0x55fab30300be - _start
    33:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
error: failed to compile `starship v0.57.0`, intermediate artifacts can be found at `/tmp/cargo-installSj4bjN`

解決方法

以下を追加でインストールした

$ sudo apt-get install pkg-config

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?