链接 libresolv 时未定义的引用

发布于 2024-09-28 00:27:41 字数 1734 浏览 7 评论 0原文

我有一个项目是一个链接 libresolv 的库, 它在最近的发行版上运行良好:Ubuntu 10.x Fedora 13、Mandriva 2010.1 但在 Centos 5.x 上我收到以下错误

glibc 安装的是: glibc-2.5-18.el5_1.1

g++ -DHAVE_CONFIG_H -I.  -I./include -I/usr/include/postgresql  -O3
-ansi   -Wall -Wno-deprecated  -D_FORTIFY_SOURCE=0 -MT testUpLog.o -MD
-MP -MF .deps/testUpLog.Tpo -c -o testUpLog.o testUpLog.cc
mv -f .deps/testUpLog.Tpo .deps/testUpLog.Po
/bin/sh ./libtool --tag=CXX   --mode=link g++  -O3 -ansi   -Wall
-Wno-deprecated  -D_FORTIFY_SOURCE=0  -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql -o testUpLog testUpLog.o libUpTools.la -lpq
-lmysqlclient -lssl -lpthread
libtool: link: g++ -O3 -ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0
-o .libs/testUpLog testUpLog.o  -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql ./.libs/libUpTools.so -lpq -lmysqlclient -lssl
-lpthread
./.libs/libUpTools.so: undefined reference to `__ns_name_uncompress'
./.libs/libUpTools.so: undefined reference to `__ns_initparse'
./.libs/libUpTools.so: undefined reference to `__ns_parserr'
collect2: ld returned 1 exit status
make[1]: *** [testUpLog] Error 1
make[1]: Leaving directory `/tmp/UpTools-8.5.3'
make: *** [check-am] Error 2

library.la 文件包含:

dlname='libUpTools.so.0'
library_names='libUpTools.so.0.0.0 libUpTools.so.0 libUpTools.so'
old_library='libUpTools.a'
inherited_linker_flags=''
dependency_libs=' -L/usr/lib64 -L/lib64 -L/usr/lib64/mysql -lpq
-lmysqlclient -lssl -lpthread'
weak_library_names=''
current=0
age=0
revision=0
installed=no
shouldnotlink=no
dlopen=''
dlpreopen=''
libdir='/usr/lib'

You can read configure.ac on

http://pastebin.com/hs5q21Rq

提前致谢

I have a project that is a library that links against libresolv,
It works fine on recent distros: Ubuntu 10.x Fedora 13, Mandriva
2010.1 but on Centos 5.x I get the following errors

glibc installed is: glibc-2.5-18.el5_1.1

g++ -DHAVE_CONFIG_H -I.  -I./include -I/usr/include/postgresql  -O3
-ansi   -Wall -Wno-deprecated  -D_FORTIFY_SOURCE=0 -MT testUpLog.o -MD
-MP -MF .deps/testUpLog.Tpo -c -o testUpLog.o testUpLog.cc
mv -f .deps/testUpLog.Tpo .deps/testUpLog.Po
/bin/sh ./libtool --tag=CXX   --mode=link g++  -O3 -ansi   -Wall
-Wno-deprecated  -D_FORTIFY_SOURCE=0  -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql -o testUpLog testUpLog.o libUpTools.la -lpq
-lmysqlclient -lssl -lpthread
libtool: link: g++ -O3 -ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0
-o .libs/testUpLog testUpLog.o  -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql ./.libs/libUpTools.so -lpq -lmysqlclient -lssl
-lpthread
./.libs/libUpTools.so: undefined reference to `__ns_name_uncompress'
./.libs/libUpTools.so: undefined reference to `__ns_initparse'
./.libs/libUpTools.so: undefined reference to `__ns_parserr'
collect2: ld returned 1 exit status
make[1]: *** [testUpLog] Error 1
make[1]: Leaving directory `/tmp/UpTools-8.5.3'
make: *** [check-am] Error 2

library.la file contains:

dlname='libUpTools.so.0'
library_names='libUpTools.so.0.0.0 libUpTools.so.0 libUpTools.so'
old_library='libUpTools.a'
inherited_linker_flags=''
dependency_libs=' -L/usr/lib64 -L/lib64 -L/usr/lib64/mysql -lpq
-lmysqlclient -lssl -lpthread'
weak_library_names=''
current=0
age=0
revision=0
installed=no
shouldnotlink=no
dlopen=''
dlpreopen=''
libdir='/usr/lib'

You can read configure.ac on

http://pastebin.com/hs5q21Rq

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绿光 2024-10-05 00:27:41

如果libUpTools使用函数lib libresolv,则需要这样说:

libUpTools_la_LIBADD = -lresolv(当然-lresolv可以被configure等确定的变量替换)

这样,-lresolv将最终出现在.la 文件以及 .so 文件(如果您选择构建它)中,您可以运行 ldd 进行验证。

If libUpTools uses functions lib libresolv, you need to say so:

libUpTools_la_LIBADD = -lresolv (of course -lresolv may be replaced by variables determined by configure etc.)

That way, -lresolv will end up in the .la file and also in the .so file (if you chose to build it) that you can run ldd on for verification.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文