Skip to content

Instantly share code, notes, and snippets.

@folkengine
Last active May 22, 2023 01:19
Show Gist options
  • Save folkengine/6ae6a69d55f6842b5a6e47da275b1ffc to your computer and use it in GitHub Desktop.
Save folkengine/6ae6a69d55f6842b5a6e47da275b1ffc to your computer and use it in GitHub Desktop.

On ubuntu

❯ rustc --version
rustc 1.71.0-nightly (521f4dae1 2023-05-19)
❯ cargo install cargo-generate
...
error: failed to run custom build command for `openssl-sys v0.9.87`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installqCCYHs/release/build/openssl-sys-826ffeb1404b1fb0/build-script-main` (exit status: 101)
  --- stdout
  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_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_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: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1
  error: could not find system library 'openssl' required by the 'openssl-sys' crate

  --- stderr
  Package openssl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `openssl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'openssl' found


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

  ', /home/gaoler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.87/build/find_normal.rs:190:5
  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 `cargo-generate v0.18.2`, intermediate artifacts can be found at `/tmp/cargo-installqCCYHs`

So installed librust-openssl-sys-dev

❯ sudo apt install librust-openssl-sys-dev
❯ cargo install cargo-generate
error[E0283]: type annotations needed
   --> /home/gaoler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-generate-0.18.2/src/lib.rs:481:39
    |
481 |         let file_path = search_folder.join(name.borrow());
    |                                       ^^^^      ------ type must be known at this point
    |                                       |
    |                                       cannot infer type of the type parameter `P` declared on the method `join`
    |
    = note: multiple `impl`s satisfying `str: Borrow<_>` found in the following crates: `bstr`, `core`:
            - impl Borrow<bstr::bstr::BStr> for str;
            - impl<T> Borrow<T> for T
              where T: ?Sized;
help: consider specifying the generic argument
    |
481 |         let file_path = search_folder.join::<&Borrowed>(name.borrow());
    |                                           +++++++++++++

For more information about this error, try `rustc --explain E0283`.
error: could not compile `cargo-generate` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-generate v0.18.2`, intermediate artifacts can be found at `/tmp/cargo-installgMAwEA`

On M1 Mac

❯ cargo install --locked cargo-generate

This got it to install, but using it with rust-tui-template generated the following error:

❯ cargo generate --git https://github.com/tui-rs-revival/rust-tui-template --name pkterm
dyld[5389]: symbol not found in flat namespace '_EVP_aes_128_cbc'
[1]    5389 abort      cargo generate --git https://github.com/tui-rs-revival/rust-tui-template
@folkengine
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment