我刚从源代码中在Ubuntu服务器上安装了postfix 2.7.11。我不使用ubuntu自己的,因为我需要旧版本。
我发现了一个非常有趣的问题。之前,在CentOS 5和6中,我可以毫无问题地构建源代码。但是,在Ubuntu服务器12.04是完全不同的。
我遇到了以下问题:
dict_nis.c:173: error: undefined reference to 'yp_match'<br>
dict_nis.c:187: error: undefined reference to 'yp_match'<br>
dns_lookup.c:347: error: undefined reference to '__dn_expand'<br>
dns_lookup.c:218: error: undefined reference to '__res_search'<br>
dns_lookup.c:287: error: undefined reference to '__dn_expand'<br>
dns_lookup.c:498: error: undefined reference to '__dn_expand'<br>
dns_lookup.c:383: error: undefined reference to '__dn_expand'<br>
是的,这个原因很明显。我只是搜索相关的库并将其添加到makefile中。有用。
问题是为什么? Ubuntu Server和CentOS有什么区别?
一种可能性是gcc和ld版本。 Ubuntu服务器使用不同版本的gcc和ld与CentOS。但我不确定。
答案 0 :(得分:0)
最后,与他人一起帮忙。我找到了原因。
Ubuntu有特殊的.so位置。位置与CentOS不同。
但是在Postfix makedefs文件中,它不包含此特定位置。我们来看看来源:
SYSLIBS="-ldb"
for name in nsl resolv
do
for lib in /usr/lib64 /lib64 /usr/lib /lib
do
test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
SYSLIBS="$SYSLIBS -l$name"
break
}
done
done
这里,make make时会使用SYSLIBS。此脚本将检查一些特殊文件夹以添加.so lib。但这些位置不包括Ubuntu。
答案 1 :(得分:0)
Ubuntu 12.04和后缀2.9.3与vda-patch 2.9.1有同样的问题
gcc -Wmissing-prototypes -Wformat -DDEBIAN -DMAX_DYNAMIC_MAPS -DHAS_PCRE -DHAS_LDAP -DHAS_SQLITE -DMYORIGIN_FROM_FILE -DNO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAS_CDB -DHAS_MYSQL -I/usr/include/mysql -DHAS_PGSQL -I/usr/include/postgresql -DHAS_SQLITE -I/usr/include -DHAS_SSL -I/usr/include/openssl -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_CYRUS_SASL -DUSE_TLS -O2 -I. -I../../include -DLINUX3 -o smtpd smtpd.o smtpd_token.o smtpd_check.o smtpd_chat.o smtpd_state.o smtpd_peer.o smtpd_sasl_proto.o smtpd_sasl_glue.o smtpd_proxy.o smtpd_xforward.o smtpd_dsn_fix.o smtpd_milter.o smtpd_resolve.o smtpd_expand.o ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a ../../lib/libxsasl.a ../../lib/libmilter.a ../../lib/libglobal.a ../../lib/libutil.a -lssl -lcrypto -lsasl2 -lpthread -L/usr/src/postfix-2.9.3/debian -ldb
../../lib/libdns.a: undefined reference to `__res_search'
../../lib/libdns.a: undefined reference to `__dn_expand'
collect2: ld gab 1 als Ende-Status zurück
make: *** [smtpd] Fehler 1
问题:缺少-lresolv
在文件&#34; makedefs&#34;:gcc -print-search-dirs | sed -n&#39; / ^ libraries:= / s / libraries:= // p&#39;没有为我工作,因为我有德语的Ubuntu。 gcc -print-search-dirs输出是&#34; Bibliotheken:&#34;
答案 2 :(得分:0)
您应该将-ldb -lnsl -lresolv
追加到AUXLIBS
。