ubuntu 货物安装搜索错误路径

hrirmatl  于 2023-02-03  发布在  其他
关注(0)|答案(1)|浏览(126)
    • 货物安装**时出现错误

错误

= note: /usr/bin/ld: cannot find -lsqlite3: No such file or directory
          /usr/bin/ld: cannot find -lpq: No such file or directory
          /usr/bin/ld: cannot find -lmysqlclient: No such file or directory
          collect2: error: ld returned 1 exit status

我在**/usr/lib/**中安装了库,例如名为libsqlite3.so.0的sqlite

问题

我怎样才能改变路径,货物安装正在搜索,我不必为每个文件做一个符号链接.

版本

货物

货物1.67.0(8ecd4f20a 2023年1月10日)
Ubuntu
没有可用的LSB模块。分销商ID:Ubuntu描述:Ubuntu 22.04.1 LTS版本:22.04代号:果酱的

重现错误

我用rustup命令安装了Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

输出:

info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/simon/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/simon/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/simon/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/simon/.profile
  /home/simon/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

制作了一个新的Cargo项目:

cargo new diesel-demo

插入了依赖关系:

[dependencies]
diesel = { version = "2.0.0", features = ["sqlite"] }
dotenv = "0.15"

结束然后使用:

cargo install diesel_cli

从而产生此错误。
在堆栈溢出中使用标签[货物][ubuntu][ rust 柴油]进行搜索。
我试着做符号链接,但我不想为每一个新的库做一个。也许有一个选项,即货物安装搜索正确的库。

eyh26e7m

eyh26e7m1#

可以将环境变量 LD_LIBRARY_PATH 设置为库的路径:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib

这样你就可以告诉链接器在默认库搜索路径之外的指定路径中搜索库。你可以把它添加到你的shell配置文件中,比如***~/.bashrc***或者***~/.bash_profile***,使它永久化。

相关问题