Thread: 9.1.1 build failure : postgres link fails

9.1.1 build failure : postgres link fails

From
Rob Sargentg
Date:
I just got round to updating my laptop to ubuntu-10.4 (32bit), in part
because I kept hitting snags while trying to configure postgres 9.1.1.

The upgrade did in fact solve the dependency issues (though  I was
surprised UUID came along with out the ossp specific impl??) but the
build is having troubles linking the server executable.

Here's my configure line:
./configure --with-pgport=5439 --with-perl --with-python --with-openssl
--with-ldap --with-ossp-uuid --with-libxml --with-libxslt

and the tail of the configure output:

configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to
src/backend/port/tas.s
config.status: linking src/backend/port/dynloader/linux.c to
src/backend/port/dynloader.c
config.status: linking src/backend/port/sysv_sema.c to
src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to
src/backend/port/pg_shmem.c
config.status: linking src/backend/port/unix_latch.c to
src/backend/port/pg_latch.c
config.status: linking src/backend/port/dynloader/linux.h to
src/include/dynloader.h
config.status: linking src/include/port/linux.h to
src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

ubuntu-10.4 is not the latest of course and comes with gnu make 3.8.1,
but it seems to compile everything then fails to link postgres executable:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -L../../src/port -Wl,--as-needed
-Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  -Wl,-E <<TONS OF
DOT OHs>> ../../src/port/libpgport_srv.a -lxslt -lxml2 -lssl -lcrypto
-lcrypt -ldl -lm -lldap -o postgres
postmaster/postmaster.o: In function `PostmasterMain':
postmaster.c:(.text+0x48d7): undefined reference to `optreset'
tcop/postgres.o: In function `process_postgres_switches':
postgres.c:(.text+0x1312): undefined reference to `optreset'
utils/misc/ps_status.o: In function `set_ps_display':
ps_status.c:(.text+0xd4): undefined reference to `setproctitle'
collect2: ld returned 1 exit status
make[2]: *** [postgres] Error 1
make[2]: Leaving directory `/home/rob/tools/postgresql-9.1.1/src/backend'
make[1]: *** [all-backend-recurse] Error 2
make[1]: Leaving directory `/home/rob/tools/postgresql-9.1.1/src'
make: *** [all-src-recurse] Error 2


Re: 9.1.1 build failure : postgres link fails

From
Tom Lane
Date:
Rob Sargentg <robjsargent@gmail.com> writes:
> I just got round to updating my laptop to ubuntu-10.4 (32bit), in part
> because I kept hitting snags while trying to configure postgres 9.1.1.
> ubuntu-10.4 is not the latest of course and comes with gnu make 3.8.1,
> but it seems to compile everything then fails to link postgres executable:

> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Wendif-labels -Wformat-security
> -fno-strict-aliasing -fwrapv -L../../src/port -Wl,--as-needed
> -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  -Wl,-E <<TONS OF
> DOT OHs>> ../../src/port/libpgport_srv.a -lxslt -lxml2 -lssl -lcrypto
> -lcrypt -ldl -lm -lldap -o postgres
> postmaster/postmaster.o: In function `PostmasterMain':
> postmaster.c:(.text+0x48d7): undefined reference to `optreset'
> tcop/postgres.o: In function `process_postgres_switches':
> postgres.c:(.text+0x1312): undefined reference to `optreset'
> utils/misc/ps_status.o: In function `set_ps_display':
> ps_status.c:(.text+0xd4): undefined reference to `setproctitle'
> collect2: ld returned 1 exit status

There's a similar report in the archives:
http://archives.postgresql.org/pgsql-hackers/2011-02/msg01474.php

It appears that on Ubuntu, libbsd defines those symbols, which confuses
configure into supposing that they're provided by libc, and then the
link fails because libbsd isn't actually linked into the postmaster.
The question is what's pulling in libbsd though.  In the previous report
it came via libedit, which you're not using.  I'd try looking in the
config.log file to see what it was linking in the test that decided
setproctitle was available, and then using ldd on each of those
libraries to see which one(s) require libbsd.

            regards, tom lane

Re: 9.1.1 build failure : postgres link fails

From
Rob Sargent
Date:

On 11/20/2011 09:24 AM, Tom Lane wrote:
> Rob Sargentg <robjsargent@gmail.com> writes:
>> I just got round to updating my laptop to ubuntu-10.4 (32bit), in part
>> because I kept hitting snags while trying to configure postgres 9.1.1.
>> ubuntu-10.4 is not the latest of course and comes with gnu make 3.8.1,
>> but it seems to compile everything then fails to link postgres executable:
>> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
>> -Wdeclaration-after-statement -Wendif-labels -Wformat-security
>> -fno-strict-aliasing -fwrapv -L../../src/port -Wl,--as-needed
>> -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  -Wl,-E <<TONS OF
>> DOT OHs>> ../../src/port/libpgport_srv.a -lxslt -lxml2 -lssl -lcrypto
>> -lcrypt -ldl -lm -lldap -o postgres
>> postmaster/postmaster.o: In function `PostmasterMain':
>> postmaster.c:(.text+0x48d7): undefined reference to `optreset'
>> tcop/postgres.o: In function `process_postgres_switches':
>> postgres.c:(.text+0x1312): undefined reference to `optreset'
>> utils/misc/ps_status.o: In function `set_ps_display':
>> ps_status.c:(.text+0xd4): undefined reference to `setproctitle'
>> collect2: ld returned 1 exit status
> There's a similar report in the archives:
> http://archives.postgresql.org/pgsql-hackers/2011-02/msg01474.php
>
> It appears that on Ubuntu, libbsd defines those symbols, which confuses
> configure into supposing that they're provided by libc, and then the
> link fails because libbsd isn't actually linked into the postmaster.
> The question is what's pulling in libbsd though.  In the previous report
> it came via libedit, which you're not using.  I'd try looking in the
> config.log file to see what it was linking in the test that decided
> setproctitle was available, and then using ldd on each of those
> libraries to see which one(s) require libbsd.
>
>             regards, tom lane


Will do.  Then there's always trying Ubuntu-11?

Re: 9.1.1 build failure : postgres link fails

From
Tom Lane
Date:
Rob Sargent <robjsargent@gmail.com> writes:
> On 11/20/2011 09:24 AM, Tom Lane wrote:
>> It appears that on Ubuntu, libbsd defines those symbols, which confuses
>> configure into supposing that they're provided by libc, and then the
>> link fails because libbsd isn't actually linked into the postmaster.
>> The question is what's pulling in libbsd though.  In the previous report
>> it came via libedit, which you're not using.  I'd try looking in the
>> config.log file to see what it was linking in the test that decided
>> setproctitle was available, and then using ldd on each of those
>> libraries to see which one(s) require libbsd.

> Will do.  Then there's always trying Ubuntu-11?

Couldn't say.  But re-reading this, I wonder if maybe you *are* using
libedit.  Have you got readline installed?  If not, configure will try
libedit as second choice ... so maybe the best fix is to install
readline (and don't forget readline-devel or local equivalent).

            regards, tom lane

Re: 9.1.1 build failure : postgres link fails

From
Rob Sargentg
Date:
On 11/20/2011 11:05 AM, Tom Lane wrote:
> Rob Sargent<robjsargent@gmail.com>  writes:
>> On 11/20/2011 09:24 AM, Tom Lane wrote:
>>> It appears that on Ubuntu, libbsd defines those symbols, which confuses
>>> configure into supposing that they're provided by libc, and then the
>>> link fails because libbsd isn't actually linked into the postmaster.
>>> The question is what's pulling in libbsd though.  In the previous report
>>> it came via libedit, which you're not using.  I'd try looking in the
>>> config.log file to see what it was linking in the test that decided
>>> setproctitle was available, and then using ldd on each of those
>>> libraries to see which one(s) require libbsd.
>> Will do.  Then there's always trying Ubuntu-11?
> Couldn't say.  But re-reading this, I wonder if maybe you *are* using
> libedit.  Have you got readline installed?  If not, configure will try
> libedit as second choice ... so maybe the best fix is to install
> readline (and don't forget readline-devel or local equivalent).
>
>             regards, tom lane
I built readline-6.2 from source and got passed linking 'postgres'
executable.  Progress!  now chasing down libperl

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fpic -shared -o plperl.so plperl.o SPI.o
Util.o -L../../../src/port -Wl,--as-needed
-Wl,-rpath,'/usr/lib/perl/5.10/CORE',--enable-new-dtags
-fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.10/CORE -lperl
-ldl -lm -lpthread -lc -lcrypt
/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status
make[3]: *** [plperl.so] Error 1
make[3]: Leaving directory `/home/rob/tools/postgresql-9.1.1/src/pl/plperl'
make[2]: *** [all-plperl-recurse] Error 2
make[2]: Leaving directory `/home/rob/tools/postgresql-9.1.1/src/pl'
make[1]: *** [all-pl-recurse] Error 2
make[1]: Leaving directory `/home/rob/tools/postgresql-9.1.1/src'
make: *** [all-src-recurse] Error 2

I had to make a simlink 'ln -s /usr/lib/libperl.so.5.10
/usr/lib/libperl.so' which I thought was supposed to happen automagically...

BUT
make[1]: Leaving directory `/home/rob/tools/postgresql-9.1.1/config'
All of PostgreSQL successfully made. Ready to install.
PostgreSQL installation complete.

Thank you Tom for the readline tip.  Sort of thing that would take me
forever to track down.



Re: 9.1.1 build failure : postgres link fails

From
Rob Sargent
Date:
This may be a duplicate response.

On 11/20/2011 11:05 AM, Tom Lane wrote:
> Rob Sargent <robjsargent@gmail.com> writes:
>> On 11/20/2011 09:24 AM, Tom Lane wrote:
>>> It appears that on Ubuntu, libbsd defines those symbols, which confuses
>>> configure into supposing that they're provided by libc, and then the
>>> link fails because libbsd isn't actually linked into the postmaster.
>>> The question is what's pulling in libbsd though.  In the previous report
>>> it came via libedit, which you're not using.  I'd try looking in the
>>> config.log file to see what it was linking in the test that decided
>>> setproctitle was available, and then using ldd on each of those
>>> libraries to see which one(s) require libbsd.
>> Will do.  Then there's always trying Ubuntu-11?
> Couldn't say.  But re-reading this, I wonder if maybe you *are* using
> libedit.  Have you got readline installed?  If not, configure will try
> libedit as second choice ... so maybe the best fix is to install
> readline (and don't forget readline-devel or local equivalent).
>
>             regards, tom lane

I made readline-6.2 from source, than had to manually symlink
perl.so.5.10 to perl.so

and SUCCESS!

Thanks for the readline pointer Tom.  Sort of thing that would have
taken me forever to get through.

rjs