Skip to content

error[E0463]: can't find crate for llvm_sys #9838

Closed
@nivekithan

Description

@nivekithan

Problem

I am using llvm_sys in my code. For some reason when I am testing it ( cargo test ) it says that can't find crate for llvm_sys even though it is available in crates.io

Note: There is no problem when I am running command cargo build

Steps

You must installed a compatible llvm before running cargo test

  1. gh repo clone nivekithan/rust_llvm_sys_prob
  2. cargo test

Notes

Output of cargo version:
cargo 1.54.0 (5ae8d74b3 2021-06-22)

Error log:

cargo test --verbose
       Fresh ucd-trie v0.1.3
       Fresh regex-syntax v0.6.25
       Fresh lazy_static v1.4.0
       Fresh cc v1.0.69
       Fresh pest v2.1.3
       Fresh memchr v2.4.1
       Fresh semver-parser v0.10.2
       Fresh libc v0.2.100
       Fresh aho-corasick v0.7.18
       Fresh semver v0.11.0
       Fresh regex v1.5.4
       Fresh llvm-sys v120.2.0
   Compiling prob_llvm_sys v0.1.0 (/home/nivekithan/temp/rust_llvm_sys_prob)
     Running `rustc --crate-name prob_llvm_sys --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=7af2b1f9b764f802 -C extra-filename=-7af2b1f9b764f802 --out-dir /home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps -C incremental=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/incremental -L dependency=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps --extern llvm_sys=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps/libllvm_sys-609303481c4ac12b.rlib -L native=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/build/llvm-sys-ca4cab83bdad502f/out -L native=/home/nivekithan/dep/llvm/binary/lib`
error[E0463]: can't find crate for `llvm_sys`
 --> src/lib.rs:1:5
  |
1 | use llvm_sys::prelude::*;
  |     ^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `prob_llvm_sys`

Caused by:
  process didn't exit successfully: `rustc --crate-name prob_llvm_sys --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=7af2b1f9b764f802 -C extra-filename=-7af2b1f9b764f802 --out-dir /home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps -C incremental=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/incremental -L dependency=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps --extern llvm_sys=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/deps/libllvm_sys-609303481c4ac12b.rlib -L native=/home/nivekithan/temp/rust_llvm_sys_prob/target/debug/build/llvm-sys-ca4cab83bdad502f/out -L native=/home/nivekithan/dep/llvm/binary/lib` (exit status: 1)

cargo.toml

[package]
name = "prob_llvm_sys"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
llvm-sys = "120.0.0"

rustc --version --verbose

rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions