![/usr/bin/ld:找不到 -lpq 或 -l](https://linux22.com/image/912473/%2Fusr%2Fbin%2Fld%EF%BC%9A%E6%89%BE%E4%B8%8D%E5%88%B0%20-lpq%20%E6%88%96%20-l.png)
我刚刚从 Windows 迁移到 Ubuntu。我正在尝试下载用于 Rust 的 diesel_cli。在获取最后的所有包后,它给出了一个错误/usr/bin/ld:找不到 -lpq。
答案1
该ld
命令告诉您它找不到该pq
库。man ld
将告诉您有关:
-l namespec
--library=namespec
Add the archive or object file specified by namespec to the list of files to link.
This option may be used any number of times. If namespec is of the form :filename, ld
will search the library path for a file called filename, otherwise it will search the
library path for a file called libnamespec.a.
On systems which support shared libraries, ld may also search for files other than
libnamespec.a. Specifically, on ELF and SunOS systems, ld will search a directory for
a library called libnamespec.so before searching for one called libnamespec.a. (By
convention, a ".so" extension indicates a shared library.) Note that this behavior
does not apply to :filename, which always specifies a file called filename.
这告诉我们您实际需要的文件名是libpq.so
或libpq.a
。
您应该查看您的rust/diesel_cli
环境是否有libpq.so
。
向包装系统询问libpq
,可以看到:
$ apt-cache search libpq
libpq-dev - header files for libpq5 (PostgreSQL library)
libpq5 - PostgreSQL C client library
cl-pg - Common Lisp library that provides a socket level postgresql interface
golang-github-lib-pq-dev - pure Go postgres driver for Go’s database/sql package
libghc-postgresql-libpq-dev - low-level binding to libpq
libghc-postgresql-libpq-doc - low-level binding to libpq; documentation
libghc-postgresql-libpq-prof - low-level binding to libpq; profiling libraries
libpgtcl - Tcl client library binding for PostgreSQL
libpgtcl-dev - Tcl client library binding for PostgreSQL - development files
libpostgresql-ocaml - OCaml bindings to PostgreSQL's libpq (runtime)
libpostgresql-ocaml-dev - OCaml bindings to PostgreSQL's libpq
libpqtypes-dev - parameterized queries libpq extension - development
libpqtypes0 - parameterized queries libpq extension - shared library
libpqtypes0-dbg - parameterized queries libpq extension - debug symbols
libpqxx-3.1 - C++ library to connect to PostgreSQL
libpqxx-3.1-dbg - C++ library to connect to PostgreSQL (debugging symbols)
libpqxx-4.0 - C++ library to connect to PostgreSQL
libpqxx-dbg - C++ library to connect to PostgreSQL (debugging symbols)
libpqxx-dev - C++ library to connect to PostgreSQL (development files)
libpqxx-doc - C++ library to connect to PostgreSQL (documentation)
libpqxx3-dev - C++ library to connect to PostgreSQL (development files)
libpqxx3-doc - C++ library to connect to PostgreSQL (documentation)
python-pg8000 - Pure-Python PostgreSQL Driver
ruby-pg - PostgreSQL interface for Ruby
检查rust/diesel_cli
文档以了解要求postgresql
?
我会让你apt-cache search postgresql
自己做,而不是在这篇文章中添加 452 行。