Compilation error E0283 while installing
3zcurdia opened this issue · comments
Describe the bug
While installing cargo-generate I got the following error
make sure you
- I'm on the latest rust version
rustup update
- I'm on the latest cargo-generate version
cargo install cargo-generate
- In case you have an own
.gitconfig
, provide all sections that contains one of:insteadOf
,url
To Reproduce
Steps to reproduce the behavior:
cargo install cargo-generate
- Then got the following error message
Compiling cargo-generate v0.18.2
error[E0283]: type annotations needed
--> /Users/ezcurdia/.cargo/registry/src/github.com-1ecc6299db9ec823/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` 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 `/var/folders/_0/svj1v6qd27723q6k6mhrwcxh0000gn/T/cargo-installm16ibj`
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
- OS: MacOS 13.4
rustc --version
: rustc 1.69.0 (84c898d65 2023-04-16) (built from a source tarball)
Additional context
# This is Git's per-user configuration file.
[merge]
tool = opendiff
[init]
defaultBranch = main
[ull]
rebase = false
I was getting the same error on my M1 Mac.
$> rustc --version
rustc 1.69.0 (84c898d65 2023-04-16)
I could get it to install running cargo install --locked cargo-generate
. However, when I tried to use it I got the following error, which traces back to Issue #528, which was closed last year.
$> 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
Initially saw a different issue on my Ubuntu box:
❯ 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`
Ran cargo install cargo-generate
with the --locked
flag and it worked just fine.
Initially saw a different issue on my Ubuntu box:
❯ 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`Ran
cargo install cargo-generate
with the--locked
flag and it worked just fine.
Any idea for a solution on macOS?
Any idea for a solution on macOS?
This comment on a closed issue does seem to be a clue: dyld: Symbol not found: _EVP_aes_128_cbc #528 (comment)
I think this issue might be caused by a new trait being implemented in the 1.5.0 release of bstr 1.5.0 commmit.
Using --locked worked for me on an M1 Mac
Running
cargo install --locked cargo-generate
also works for me.
Still seeing the same issue on my M1.
$> cargo install --locked cargo-generate
...
$> cargo generate --git https://github.com/tui-rs-revival/rust-tui-template --name foo
dyld[30382]: symbol not found in flat namespace '_EVP_aes_128_cbc'
[1] 30382 abort cargo generate --git https://github.com/tui-rs-revival/rust-tui-template
@folkengine perhaps yours is a different issue? Could it be an issue with a dynamically linked library?
Given the function band reported it looks like a crypto routine, have you got an alternative OpenSSL installed as well as the system default?
cargo install cargo-generate --features vendored-openssl
worked for me on M2
cargo install cargo-generate --features vendored-openssl
Thank you ... that did it for me on a an M1 too.
这也解决了我的问题