1833515 Members
2665 Online
110061 Solutions
New Discussion

DB starting error

 
SOLVED
Go to solution
Sutapa Dey
Frequent Advisor

DB starting error

Hi All,

I am having this peculiar problem that needs some troubleshooting
I hv installed gmake and are trying to compile some postgres code, please find the steps as below:

ln -s /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE/libperl.so libperl.so

cd /opt/pgsql/src
cd /opt/pgsql/src/postgresql-8.2.4

export CC=cc
export CPP="cc -E +legacy_cpp"
export LIBS="-lkrb5 -lk5crypto -lcom_err"
export LDFLAGS="-Wl,+nodefaultrpath"
./configure --prefix=/opt/iexpress/postgresql --disable-rpath --with-perl --enable-integer-datetimes --with-openssl --libdir=/opt/iexpress/postgresql/lib/hpux32 --without-readline --without-zlib --without-docdir

/usr/local/bin/gmake -f /opt/pgsql/src/postgresql-8.2.4/GNUmakefile all
/usr/local/bin/gmake -f /opt/pgsql/src/postgresql-8.2.4/GNUmakefile install

su - postgres
/opt/iexpress/postgresql/bin/createlang --echo --dbname=vsm --username=postgres plperl
$ /opt/iexpress/postgresql/bin/createlang --echo --dbname=vsm --username=postgres plperl
/usr/lib/dld.sl: Can't open shared library: ../../../src/interfaces/libpq/libpq.sl.5
/usr/lib/dld.sl: No such file or directory
Abort


Please help me with this error. I checked the user rights and also the existence of /usr/lib/dld.sl and /opt/iexpress/postgresql/src/postgresql-8.2.4/src/interfaces/libpq/libpq.sl.5. They are all fine. Please help
31 REPLIES 31
Sutapa Dey
Frequent Advisor

Re: DB starting error

The first line is not the one given above

ln -s /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE/libperl.sl libperl.sl
Dennis Handly
Acclaimed Contributor

Re: DB starting error

dld.sl: Can't open shared library: ../../../src/interfaces/libpq/libpq.sl.5

You don't have an absolute path to your shlib.
If you are going to use +nodefaultrpath and not +b, you might want to look to $ORIGIN for relative paths.

>export CPP="cc -E +legacy_cpp"

You can't use +legacy_cpp on PA cc.
Steven E. Protter
Exalted Contributor

Re: DB starting error

Shalom,

Check that SHLIB_PATH is properly set and that ll libraries needed are on that path variable.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi Dennis,

Thanks for the reply. I have 2 questions.

1. How can I check whether I have absolute path to SHLIB or Not? Because we have set this library path postgres .profile file

export LD_LIBRARY_PATH=/opt/pgsql/lib/:/opt/pgsql/vsm-lib:/usr/lib:/opt/pgsql/lib/hpux32
export libdir=/opt/pgsql/lib

2.If I can't use +legacy_cpp on PA cc, then how can I set the CPP value then? Any idea?

Regarding SHLIB path when I do an chatr on dld.sl I get this value

chatr /usr/lib/dld.sl
/usr/lib/dld.sl:
shared library
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared vtable support disabled
explicit unloading enabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
#
Please let me know as I am not able to enable SHLIB path here.
Dennis Handly
Acclaimed Contributor

Re: DB starting error

>1. How can I check whether I have absolute path to SHLIB or Not?

What is the -L path you pass to the compiler in your makefile?

>export LD_LIBRARY_PATH

Useless for PA32, only SHLIB_PATH works.

>2. If I can't use +legacy_cpp on PA cc, then how can I set the CPP value then?

Just -E is enough.

>Regarding SHLIB path when I do an chatr on dld.sl

It is useless to do it on dld.sl. You must do it on your executable.

>I am not able to enable SHLIB path here.

To enable it on your executable, you link with "-Wl,+s". Or you can use chatr(1).
Shinji Teragaito_1
Respected Contributor
Solution

Re: DB starting error

Hi Sutapa,

I tried to build PostgreSQL from source code on HP-UX 11.11.

------------------------------
NOTE: I used the latest HP ANSI C compiler:
% cc -V hello.c -o hello
cpp.ansi: HP92453-01 B.11.11.20 HP C Preprocessor (ANSI)
ccom: HP92453-01 B.11.11.20 HP C Compiler
/usr/ccs/bin/ld: 92453-07 linker linker ld B.11.40 040530
%

Before upgrading to this, I met the following error:
cc -Ae +O2 -I../../../../src/include -D_XOPEN_SOURCE_EXTENDED -c -o elog.o elog.c
cc: error 1405: "/opt/ansic/lbin/ccom" terminated abnormally with signal 11.
------------------------------

Here's my simple steps:

% cd /var/tmp
% gzcat postgresql-8.3.4.tar.gz | tar xvf
% cd postgresql-8.3.4
% env CC=cc CFLAGS="+O2" ./configure \
--without-readline --without-zlib 2>&1 | tee configure.log
% gmake 2>&1 | tee make.log
% gmake check 2>&1 | tee makecheck.log
..(snip)..
=======================
All 114 tests passed.
=======================

gmake[2]: Leaving directory `/var/tmp/postgresql-8.3.4/src/test/regress'
gmake[1]: Leaving directory `/var/tmp/postgresql-8.3.4/src/test'
% su -
# cd /var/tmp/postgresql-8.3.4
# /usr/local/bin/gmake install 2>&1 | tee makeinstall.log
# useradd postgres
# mkdir /usr/local/pgsql/data
# chown postgres:users /usr/local/pgsql/data
# su - postgres

$ export PGDATA=/usr/local/pgsql/data
$ export PGLIB=/usr/local/pgsql/lib
$ export PATH=/usr/local/pgsql/bin:$PATH
% initdb --encoding=EUC_JP --no-locale
$ pg_ctl -w start
$ ps -ef | grep postgres
postgres 21403 21397 0 09:17:43 ? 0:00 postgres: wal writer process
postgres 21404 21397 0 09:17:43 ? 0:00 postgres: autovacuum launcher process
postgres 22263 21937 2 09:40:33 pts/ta 0:00 ps -ef
postgres 21405 21397 0 09:17:43 ? 0:00 postgres: stats collector process
postgres 21397 1 0 09:17:42 pts/ta 0:00 /usr/local/pgsql/bin/postgres
postgres 21402 21397 0 09:17:43 ? 0:00 postgres: writer process
postgres 21937 21922 1 09:32:07 pts/ta 0:00 -sh
postgres 22264 21937 0 09:40:33 pts/ta 0:00 grep postgres
$
$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | EUC_JP
template0 | postgres | EUC_JP
template1 | postgres | EUC_JP
(3 rows)

$ createdb sample
$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | EUC_JP
sample | postgres | EUC_JP
template0 | postgres | EUC_JP
template1 | postgres | EUC_JP
(4 rows)

$
$ chatr /usr/local/pgsql/bin/createdb
/usr/local/pgsql/bin/createdb:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path enabled first /usr/local/pgsql/lib
shared library list:
dynamic ../../../src/interfaces/libpq/libpq.sl.5
dynamic /usr/lib/libxnet.2
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
shared library binding:
..(snip)..
$ ldd /usr/local/pgsql/bin/createdb
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libxnet.2 => /usr/lib/libxnet.2
/usr/lib/libxti.2 => /usr/lib/libxti.2
../../../src/interfaces/libpq/libpq.sl.5 => /usr/local/pgsql/lib/libpq.sl.5
$ ldd /usr/local/pgsql/bin/createlang
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libxnet.2 => /usr/lib/libxnet.2
/usr/lib/libxti.2 => /usr/lib/libxti.2
../../../src/interfaces/libpq/libpq.sl.5 => /usr/local/pgsql/lib/libpq.sl.5
$

I didn't specify "--with-perl" to the configure script. But it
seems to me my PostgreSQL is working well.

I hope this helps you.
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi All,

Lots of thanks for your help. It has made my understanding better.

Terajito, for you I have one question when I performed the last steps as given by you:

1. chatr /usr/bin/createdb - I got the same result as you.
2. But in the next step
ldd /usr/bin/createdb - The o/p I got is:

/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libcom_err.sl => /usr/lib/libcom_err.sl
/usr/lib/libk5crypto.sl => /usr/lib/libk5crypto.sl
/usr/lib/libkrb5.sl => /usr/lib/libkrb5.sl
/usr/lib/libcom_err.sl => /usr/lib/libcom_err.sl
/usr/lib/libk5crypto.sl => /usr/lib/libk5crypto.sl
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libcrypto.sl.0 => /usr/lib/libcrypto.sl.0
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libssl.sl.0 => /usr/lib/libssl.sl.0
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libxnet.2 => /usr/lib/libxnet.2
/usr/lib/libxti.2 => /usr/lib/libxti.2
/usr/lib/dld.sl: Can't open shared library: ../../../src/interfaces/libpq/libpq.sl.5
/usr/lib/dld.sl: No such file or directory

Please notice the last two lines. They are throwing some error. It is the same case with /usr/bin/createlang.

Please let me know your suggestions.

Regards,
Sutapa
Shinji Teragaito_1
Respected Contributor

Re: DB starting error

> 1. chatr /usr/bin/createdb - I got the same result as you.

You should not have. You should have /opt/iexpress/postgresql/lib/hpux32 as the embedded path because you specify the directory as --libdir and your libpq.sl is present there.

Can you remove the configuration for LDFLAGS="-Wl,+nodefaultrpath" ?

Dennis Handly
Acclaimed Contributor

Re: DB starting error

>Shinji: Can you remove the configuration for LDFLAGS="-Wl,+nodefaultrpath"?

This will obviously make it work. I.e. if it found it at link time, it will still be there at runtime, if on the same machine or shlib layout.
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi All,

I tried all the steps suggested like

While exporting environment variables I used:

export CC=cc
export CPP="cc -E"
export LIBS="-lkrb5 -lk5crypto -lcom_err"
./configure --prefix=/opt/iexpress/postgresql --disable-rpath --with-perl --enable-integer-datetimes --with-openssl --libdir=/opt/iexpress/postgresql/lib/hpux32 --without-readline --without-zlib --without-docdir

Changed
CPP options
Deleted the LDFLAGS="-Wl,+nodefaultrpath"

But am still getting the same error.
Dennis Handly
Acclaimed Contributor

Re: DB starting error

>Changed: CPP options

(This wouldn't have any effect at link time.)

>Deleted the LDFLAGS="-Wl,+nodefaultrpath"
>But am still getting the same error.

Let's start all over. What are the linker options?
Change CC to: export CC="cc -v"
What are the options being passed to ld?

This is what Shinji's chatr showed:
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path enabled first /usr/local/pgsql/lib

This says you can't use SHLIB_PATH. It says that ALL shlibs that aren't in /usr/lib, must be in /usr/local/pgsql/lib.

shared library list:
dynamic ../../../src/interfaces/libpq/libpq.sl.5

This is what is killing you. Where should this shlib be?
This path kind of implies that -Wl,+nodefaultrpath is NOT being passed to ld. I.e. do you have LDFLAGS in your makefile? Unless configure passes -e to make or looks at LDFLAGS, ld won't see it.

You need to provide chatr for the current executable.
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi Dennis,

Thanks for the info.
I am completely a newbie in this area, hence didnot knew these details.
The update is

1. chatr /usr/bin/createlang shows:

/usr/bin/createlang:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared library list:
dynamic ../../../src/interfaces/libpq/libpq.sl.5


Here it is showing embedded path disabled.

How can I enable this embedded path?
How can I check what are the options being passed to ld? I tried looking into the makefile but didnt undertsnad much.....

We are using these LD Flags in the .profile file of postgres user:

export LD_LIBRARY_PATH=/opt/pgsql/lib/:/opt/pgsql/vsm-lib:/usr/lib:/opt/pgsql/lib/hpux32
export libdir=/opt/pgsql/lib

What options I can pass to
export LDFLAGS="-Wl,+nodefaultrpath"
for PA-RISC 11.23?
Dennis Handly
Acclaimed Contributor

Re: DB starting error

>1. chatr /usr/bin/createlang shows:
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined

You don't have any path. All shlibs must be in /usr/lib.

shared library list:
dynamic ../../../src/interfaces/libpq/libpq.sl.5

That bad shlib.

>How can I enable this embedded path?

This is the the -Wc,+b,path option. You'll have to map that to a configure option.

>How can I check what are the options being passed to ld? I tried looking into the makefile but didn't understand much.

As I said, use CC="cc -v". Then look for a line that starts with ld.

>We are using these LD Flags in the .profile file of postgres user:
LD_LIBRARY_PATH=/opt/pgsql/lib/:/opt/pgsql/vsm-lib:/usr/lib:/opt/pgsql/lib/hpux32
export libdir=/opt/pgsql/lib

LD_LIBRARY_PATH is ignored for PA32. SHLIB_PATH is ignored because that's disabled.

>What options I can pass to
export LDFLAGS="-Wl,+nodefaultrpath"
for PA-RISC 11.23?

Well, you can toss this configure nonsense and use the raw ld commands:
export LDOPTS="+nodefaultrpath"

You need to mention how you plan to distribute your executable. Do you want to be able to move it to another location or is it fixed. Do you want to allow SHLIB_PATH or will you set up an embedded path??
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi Dennis,

I have tried with the options you told like used:

export CC="cc -v"
export LDOPTS="+nodefaultrpath"

And I got the line with "ld"

/usr/bin/ld +h libplperl.sl.0 -b plperl.o spi_internal.o SPI.o -L/opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE -L../../../src/port /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/auto/DynaLoader/DynaLoader.a -lperl -lcl -lcres -lnsl -lnm -lmalloc -ldld -lm -lcrypt -lsec -lpthread -lc -o libplperl.sl.0

Moreover it also gave an error:

ld: Mismatched ABI (not an ELF file) for -lperl
Fatal error.
gmake[3]: *** [libplperl.sl.0] Error 1
gmake[3]: Leaving directory `/opt/iexpress/postgresql/src/postgresql-8.2.4/src/pl/plperl'
gmake[2]: *** [all] Error 1
gmake[2]: Leaving directory `/opt/iexpress/postgresql/src/postgresql-8.2.4/src/pl'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/opt/iexpress/postgresql/src/postgresql-8.2.4/src'
gmake: *** [all] Error 2


To give you a background actually we are trying to enable plperl support with postgres

As for your questions:

Do you want to be able to move it to another location or is it fixed?how you plan to distribute your executable?

Actually I dont have much idea about the distribution of executables.....I was asked to check whether we are having some compatibility issues with gmake or compiler options.

Do you want to allow SHLIB_PATH or will you set up an embedded path??

I think we may go for embedded path.For enabling the embedded path as you said to configure -Wc and +b option with a configure option. I am not really clear about the configure option.

Please let me know your comments.
Shinji Teragaito_1
Respected Contributor

Re: DB starting error

Don't specify --disable-rpath at your configure line. With this, you can not have any embed shared library search path in executables.

I have never specify LIBS explicitly to any configure scripts. Does your LIBS work as you intend ?

One more thing. You don't have to specify CPP explicitly any more for PostgreSQL 8.0 or later because awk is sufficient for src/backend/utils/Gen_fmgrtab.sh. It was needed for buiding PostgreSQL 7.x on IPF (that was based on the first help I got from Dennis 5 years ago. Thank you, Dennis).

Dennis Handly
Acclaimed Contributor

Re: DB starting error

>And I got the line with "ld"

This is not the link line for your executable. Which may mean you have to export and unset LDOPTS only when you build one thing.

ld: Mismatched ABI (not an ELF file) for -lperl

I'm not sure why +nodefaultrpath would cause this?
What does "file spi_internal.o" show?
If this is 64 bit, then you need to have a 64 bit libperl.

>For enabling the embedded path as you said to configure -Wc

That's: -Wl,+b,path1:path2

>Shinji: Don't specify --disable-rpath at your configure line. With this, you can not have any embed shared library search path in executables.

Any embedded paths, or just the default?
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi,

Thanks to all of your help, I was successfully able to resolve the dld.sl issue. Here are the steps I followed:

cd /opt/pgsql/src/postgresql-8.2.4
ln -s /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE/libperl.sl libperl.sl

export CC="cc -v"
export LDOPTS="+nodefaultrpath"

./configure --prefix=/opt/iexpress/postgresql --with-perl --enable-integer-datetimes --with-openssl --libdir=/opt/iexpress/postgresql/lib/hpux32 --without-readline --without-zlib --without-docdir

/usr/local/bin/gmake -f /opt/pgsql/src/postgresql-8.2.4/GNUmakefile all
/usr/local/bin/gmake -f /opt/pgsql/src/postgresql-8.2.4/GNUmakefile install

It got installed with no problems.

But now I am facing a new error like this:

su - postgres
$ /opt/iexpress/postgresql/bin/createlang --echo --dbname=vsm --username=postgres plperl

SELECT oid FROM pg_catalog.pg_language WHERE lanname = 'plperl';
CREATE LANGUAGE "plperl";
createlang: language installation failed: ERROR: could not load library "/opt/iexpress/postgresql/lib/plperl.sl": Exec format error
Sutapa Dey
Frequent Advisor

Re: DB starting error

Moreover to add to this when I check the embedded path to the executable plperl.sl I get the result as below:

# chatr /opt/iexpress/postgresql/lib/plperl.sl
/opt/iexpress/postgresql/lib/plperl.sl:
shared library
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path enabled first /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE
internal name:
libplperl.sl.0
shared library list:
dynamic /opt/perl_32/lib/5.8.3/PA-RISC1.1-thread-multi/CORE/libperl.sl
dynamic /usr/lib/libcl.2
dynamic /usr/lib/libnsl.1
dynamic /usr/lib/libnm.sl
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libm.2
dynamic /usr/lib/libsec.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libc.2
shared vtable support disabled
explicit unloading enabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled

Here embedded path is enabled.
Dennis Handly
Acclaimed Contributor

Re: DB starting error

>ERROR: could not load library "/opt/iexpress/postgresql/lib/plperl.sl": Exec format error

What does "file /opt/iexpress/postgresql/lib/plperl.sl" show?

>internal name: libplperl.sl.0

Do you have a symlink for this name too?
Sutapa Dey
Frequent Advisor

Re: DB starting error

Please find the answers as below:

file /opt/iexpress/postgresql/lib/plperl.sl
/opt/iexpress/postgresql/lib/plperl.sl: PA-RISC2.0 shared library -not stripped

file /opt/iexpress/postgresql/lib/libperl.sl
/opt/iexpress/postgresql/lib/libperl.sl: PA-RISC1.1 shared library -not stripped

What does "not stripped" mean?

There is no symlink for libplperl.sl.0

# find / -name libplperl.sl.0

/opt/iexpress/postgresql/src/postgresql-8.2.4/src/pl/plperl/libplperl.sl.0

#file /opt/iexpress/postgresql/src/postgresql-8.2.4/src/pl/plperl/libplperl.sl.0

/opt/iexpress/postgresql/src/postgresql-8.2.4/src/pl/plperl/libplperl.sl.0: PA-RISC2.0 shared library -not stripped

Please let me know its urgent.
Dennis Handly
Acclaimed Contributor

Re: DB starting error

Where there any other messages other than:
"/opt/iexpress/postgresql/lib/plperl.sl": Exec format error

Nothing like??:
/usr/lib/dld.sl: Invalid version for shared library: xxxx
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: yyy

>There is no symlink for libplperl.sl.0

Then create one:
ln -s plperl.sl /opt/iexpress/postgresql/lib/libplperl.sl.0

>What does "not stripped" mean?

The shlib has a linker symbol table or other unloadable data.
Sutapa Dey
Frequent Advisor

Re: DB starting error

Hi Dennis,

There was no other error than the Exec format error.

After creating the symlink for libplperl.sl.0 it didnot help either

I think may be I am passing wrong options to the configure or gmake command.

Please find the attachment to see the exact steps I followed in the attachment.
Dennis Handly
Acclaimed Contributor

Re: DB starting error

>I think may be I am passing wrong options to the configure or gmake command.

I wouldn't be able to help there.

If less than 1 Mb after gzipping, can you attach: /opt/iexpress/postgresql/lib/plperl.sl
Sutapa Dey
Frequent Advisor

Re: DB starting error

hey

If possible please give me some links where I can read up how to compile postgres for plperl support.

I am attaching the plperl.sl with my answers