我正在尝试构建一个涉及 on 的 Rust 程序diesel
,postgresql
但Fedora 31
构建失败,因为链接器找不到libpq
.由于它可以用 重现gcc
,因此我使用它gcc
来缩短问题。
gcc -L /lib64 -lpq
/usr/bin/ld: cannot find -lpq
ls /lib64 | grep libpq
libpq.so.5
libpq.so.5.11
ldd /lib64/libpq.so.5
linux-vdso.so.1 (0x00007ffc06ddd000)
libssl.so.1.1 => /usr/lib64/libssl.so.1.1 (0x00007f4885ea7000)
libcrypto.so.1.1 => /usr/lib64/libcrypto.so.1.1 (0x00007f4885bc7000)
libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007f4885b75000)
libldap_r-2.4.so.2 => /usr/lib64/libldap_r-2.4.so.2 (0x00007f4885b1d000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007f4885afb000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00007f4885932000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00007f4885916000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007f488590f000)
libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007f488581e000)
libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007f4885805000)
libcom_err.so.2 => /usr/lib64/libcom_err.so.2 (0x00007f48857fe000)
libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007f48857ec000)
libkeyutils.so.1 => /usr/lib64/libkeyutils.so.1 (0x00007f48857e3000)
libresolv.so.2 => /usr/lib64/libresolv.so.2 (0x00007f48857ca000)
liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007f48857b9000)
libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007f4885799000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4885f8c000)
libselinux.so.1 => /usr/lib64/libselinux.so.1 (0x00007f488576c000)
libcrypt.so.2 => /usr/lib64/libcrypt.so.2 (0x00007f488572f000)
libpcre2-8.so.0 => /usr/lib64/libpcre2-8.so.0 (0x00007f488569d000)
例如,libpthread 也在 中lib64
,可以找到:
gcc -L /lib64 -lpthread
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o: in function `_start':
我是否遗漏了某些东西,或者通常应该立即找到它?
答案1
-lpq
导致链接器查找libpq.so
不带 soname 后缀的 。要在 Fedora 上提供此功能,您应该安装libpq-devel
:
sudo dnf install libpq-devel