Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just installed postfix 2.7.11 in Ubuntu server from source code. I do not use the ubuntu own one because I need the old version.

I found a very interesting problem. Before, in both CentOS 5 and 6, I can build the source code without any problem. But, in Ubuntu server 12.04 is totally different.

I got the following problems:

dict_nis.c:173: error: undefined reference to 'yp_match'
dict_nis.c:187: error: undefined reference to 'yp_match'

dns_lookup.c:347: error: undefined reference to '__dn_expand'
dns_lookup.c:218: error: undefined reference to '__res_search'
dns_lookup.c:287: error: undefined reference to '__dn_expand'
dns_lookup.c:498: error: undefined reference to '__dn_expand'
dns_lookup.c:383: error: undefined reference to '__dn_expand'

Yes, this reason is obviously. I just search related library and add it to the makefile. It works.

The question is why? What is the difference between Ubuntu Server and CentOS?

One possibility is gcc and ld version. Ubuntu server use different version of gcc and ld with CentOS. But I am not sure.

share|improve this question

3 Answers 3

The postfix package on Ubuntu will autoinstall all dependent libraries for installation, called the "Build Dependencies".

I'd recommend you install all the build dependency packages shown at this link and then try to rebuild, its likely you're missing certain libraries for compiling.

share|improve this answer
    
Hi @Lord of Time I already run "apt-get build-dep postfix" before install postfix. Maybe you can see, in fact I have all the header files and libraries, just missing the "-lnsl" in the make file. That is the question, why the same package can be build without modification in CentOS? Thank you for your link, but how can I get postfix version 2.7? I do need this version of it. –  Coofucoo Aug 9 '12 at 1:17
    
You will need to check the CentOS package's source and make sure its building without that, in Debian it might be necessary, but not in CentOS. (CentOS is Red-Hat based, Ubuntu is Debian based) –  Thomas W. Aug 9 '12 at 12:58
up vote 0 down vote accepted

Finally, with others help. I found the reason.
Ubuntu have special .so location. The location is different from CentOS.
But in Postfix makedefs file, it do not include this specific location. Let's check the source:

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 

Here, SYSLIBS will be used when do make. This script will check some special folder to add .so lib. But these locations do not include Ubuntu's.

share|improve this answer

You should append -ldb -lnsl -lresolv to AUXLIBS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.