On September 23, 2014 2:27:29 PM EDT, Adrian Klaver
<adrian.klaver@aklaver.com> wrote:
> On 09/23/2014 11:05 AM, Nick Guenther wrote:
>>
>>
>> Quoting Seref Arikan <serefarikan@gmail.com>:
>>>
>>> On Tue, Sep 23, 2014 at 9:36 AM, Craig Ringer
> <craig@2ndquadrant.com>
>>> wrote:
>>>
>>>> Hi all
>>>>
>>>> I've had some issues with how the procedural languages are packaged
> in
>>>> the Windows installer for a while, but I was very surprised to see
> that
>>>> plpython2 appears to be entirely absent in 9.3.
>>>>
>>>> It doesn't seem to be provided via EDB's StackBuilder app either.
>>>>
>>>> What's going on? It looks like it was dropped in 9.1.
>>>>
>>>
>>> I've gone through the same journey myself. Tried to juggle dlls
> etc.[...]
>>>
>>>
>>
>> I've struggled with plpython on OpenBSD 5.5-amd64 as well. Could it
> be
>> related? Maybe the amount of dependencies python pulls in gets
>> overwhelming and things break?
>>
>>
>> $ psql -h localhost -d postgres
>> psql (9.3.2)
>> Type "help" for help.
>> postgres=# create language plpython2u;
>> ERROR: could not load library
> "/usr/local/lib/postgresql/plpython2.so":
>> dlopen (/usr/local/lib/postgresql/plpython2.so) failed: Cannot load
>> specified object
>> postgres=# create language plperl;
>> CREATE LANGUAGE
>> postgres=#
>>
>>
>
> What user are you running as?
> plpythonu is an untrusted language so it can only be installed by a
> superuser.
My user account which is also the one that ran initdb and the one that
ran postgres. I discovered this when trying to work on a project I'd
started on arch linux where everything is peachy.
> Also languages are now extensions and should be installed using CREATE
> EXTENSION:
>
> http://www.postgresql.org/docs/9.3/interactive/sql-createlanguage.html
Ah, thanks for the tip. I will change over to that. But CREATE
EXTENSION gives the identical error:
postgres=# create extension plpython2u;
ERROR: could not load library
"/usr/local/lib/postgresql/plpython2.so": dlopen
(/usr/local/lib/postgresql/plpython2.so) failed: Cannot load specified
object
On September 23, 2014 2:25:43 PM EDT, Alan Hodgson
<ahodgson@simkin.ca> wrote:
>
> I'm not a current BSD user, but I'd suggest ldd'ing that library and
> see if it
> has any shared libraries it can't find or if it references shared
> libraries
> that are not in whatever OpenBSD uses for a library search path (ie.
> the
> equivalent of Linux's ld.so.conf), or if any of those shared libraries
> have
> permissions issues.
Ah, good point.
It turned out that the problem DLL was libpthread. I discovered this
using LD_DEBUG and worked around it with LD_PRELOAD.
Full output is below, so that hopefully this becomes searchable:
$ uname -a
OpenBSD localhost.localdomain 5.5 GENERIC.MP#315 amd64
$ initdb data
The files belonging to this database system will be owned by user "nguenthe".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory data ... ok
creating subdirectories ... ok
selecting default max_connections ... 40
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... not supported on this platform
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
postgres -D data
or
pg_ctl -D data -l logfile start
$ LD_DEBUG=1 postgres -D ./data
rtld loading: 'postgres'
exe load offset: 0x1c2000400000
flags postgres = 0x0
head postgres
obj postgres has postgres as head
examining: 'postgres'
loading: libasn1.so.20.0 required by postgres
flags /usr/lib/libasn1.so.20.0 = 0x0
obj /usr/lib/libasn1.so.20.0 has postgres as head
loading: libroken.so.1.0 required by postgres
flags /usr/lib/libroken.so.1.0 = 0x0
obj /usr/lib/libroken.so.1.0 has postgres as head
loading: libwind.so.1.0 required by postgres
flags /usr/lib/libwind.so.1.0 = 0x0
obj /usr/lib/libwind.so.1.0 has postgres as head
loading: libc.so.73.1 required by postgres
flags /usr/lib/libc.so.73.1 = 0x0
obj /usr/lib/libc.so.73.1 has postgres as head
loading: libkrb5.so.20.0 required by postgres
flags /usr/lib/libkrb5.so.20.0 = 0x0
obj /usr/lib/libkrb5.so.20.0 has postgres as head
loading: libcrypto.so.23.0 required by postgres
flags /usr/lib/libcrypto.so.23.0 = 0x0
obj /usr/lib/libcrypto.so.23.0 has postgres as head
loading: libcom_err.so.20.0 required by postgres
flags /usr/lib/libcom_err.so.20.0 = 0x0
obj /usr/lib/libcom_err.so.20.0 has postgres as head
loading: libheimbase.so.1.0 required by postgres
flags /usr/lib/libheimbase.so.1.0 = 0x0
obj /usr/lib/libheimbase.so.1.0 has postgres as head
loading: libm.so.9.0 required by postgres
flags /usr/lib/libm.so.9.0 = 0x0
obj /usr/lib/libm.so.9.0 has postgres as head
loading: libxml2.so.15.1 required by postgres
flags /usr/local/lib/libxml2.so.15.1 = 0x0
obj /usr/local/lib/libxml2.so.15.1 has postgres as head
loading: libssl.so.20.0 required by postgres
flags /usr/lib/libssl.so.20.0 = 0x0
obj /usr/lib/libssl.so.20.0 has postgres as head
linking dep /usr/lib/libkrb5.so.20.0 as child of postgres
linking dep /usr/lib/libasn1.so.20.0 as child of postgres
linking dep /usr/lib/libcrypto.so.23.0 as child of postgres
linking dep /usr/lib/libwind.so.1.0 as child of postgres
linking dep /usr/lib/libroken.so.1.0 as child of postgres
linking dep /usr/lib/libcom_err.so.20.0 as child of postgres
linking dep /usr/lib/libheimbase.so.1.0 as child of postgres
linking dep /usr/local/lib/libxml2.so.15.1 as child of postgres
linking dep /usr/lib/libssl.so.20.0 as child of postgres
linking dep /usr/lib/libm.so.9.0 as child of postgres
linking dep /usr/lib/libc.so.73.1 as child of postgres
examining: '/usr/lib/libkrb5.so.20.0'
examining: '/usr/lib/libasn1.so.20.0'
examining: '/usr/lib/libcrypto.so.23.0'
examining: '/usr/lib/libwind.so.1.0'
examining: '/usr/lib/libroken.so.1.0'
examining: '/usr/lib/libcom_err.so.20.0'
examining: '/usr/lib/libheimbase.so.1.0'
examining: '/usr/local/lib/libxml2.so.15.1'
loading: libz.so.5.0 required by /usr/local/lib/libxml2.so.15.1
flags /usr/lib/libz.so.5.0 = 0x0
obj /usr/lib/libz.so.5.0 has postgres as head
loading: libm.so.9.0 required by /usr/local/lib/libxml2.so.15.1
loading: libiconv.so.6.0 required by /usr/local/lib/libxml2.so.15.1
flags /usr/local/lib/libiconv.so.6.0 = 0x0
obj /usr/local/lib/libiconv.so.6.0 has postgres as head
linking dep /usr/lib/libz.so.5.0 as child of /usr/local/lib/libxml2.so.15.1
linking dep /usr/local/lib/libiconv.so.6.0 as child of
/usr/local/lib/libxml2.so.15.1
linking dep /usr/lib/libm.so.9.0 as child of /usr/local/lib/libxml2.so.15.1
examining: '/usr/lib/libssl.so.20.0'
examining: '/usr/lib/libm.so.9.0'
examining: '/usr/lib/libc.so.73.1'
examining: '/usr/lib/libz.so.5.0'
examining: '/usr/local/lib/libiconv.so.6.0'
flags /usr/libexec/ld.so = 0x0
obj /usr/libexec/ld.so has postgres as head
relocation took 0.005890
Start End Type Open Ref GrpRef Name
00001c2000400000 00001c2000d7a000 exe 1 0 0 postgres
00001c220744d000 00001c22078ba000 rlib 0 1 0
/usr/lib/libkrb5.so.20.0
00001c220f1b6000 00001c220f632000 rlib 0 1 0
/usr/lib/libasn1.so.20.0
00001c2206de6000 00001c22073a0000 rlib 0 1 0
/usr/lib/libcrypto.so.23.0
00001c2204895000 00001c2204cbd000 rlib 0 1 0
/usr/lib/libwind.so.1.0
00001c2205465000 00001c2205876000 rlib 0 1 0
/usr/lib/libroken.so.1.0
00001c220d958000 00001c220dd5a000 rlib 0 1 0
/usr/lib/libcom_err.so.20.0
00001c2201c95000 00001c2202099000 rlib 0 1 0
/usr/lib/libheimbase.so.1.0
00001c220877e000 00001c2208cd7000 rlib 0 1 0
/usr/local/lib/libxml2.so.15.1
00001c22078ba000 00001c2207d18000 rlib 0 1 0
/usr/lib/libssl.so.20.0
00001c2208356000 00001c220877e000 rlib 0 2 0 /usr/lib/libm.so.9.0
00001c22016f6000 00001c2201bdf000 rlib 0 1 0 /usr/lib/libc.so.73.1
00001c22061d0000 00001c22065e5000 rlib 0 1 0 /usr/lib/libz.so.5.0
00001c220352b000 00001c2203a28000 rlib 0 1 0
/usr/local/lib/libiconv.so.6.0
00001c220c700000 00001c220c700000 rtld 0 1 0 /usr/libexec/ld.so
symcache lookups 3759 hits 0 ratio 0% hits
dynamic loading done, success.
doing ctors obj 0x1c2203ac13b8 @0x1c2207466600: [/usr/lib/libkrb5.so.20.0]
doing ctors obj 0x1c2204894610 @0x1c220f1cdac0: [/usr/lib/libasn1.so.20.0]
doing ctors obj 0x1c2203ac1740 @0x1c2206e4cb20: [/usr/lib/libcrypto.so.23.0]
doing ctors obj 0x1c2204894cf8 @0x1c2204896760: [/usr/lib/libwind.so.1.0]
doing ctors obj 0x1c2204894990 @0x1c22054694e0: [/usr/lib/libroken.so.1.0]
doing ctors obj 0x1c2203ac1a98 @0x1c220d958ec0: [/usr/lib/libcom_err.so.20.0]
doing ctors obj 0x1c2205876008 @0x1c2201c96900: [/usr/lib/libheimbase.so.1.0]
doing ctors obj 0x1c2208291008 @0x1c22061d20a0: [/usr/lib/libz.so.5.0]
doing ctors obj 0x1c2208291348 @0x1c220352dea0:
[/usr/local/lib/libiconv.so.6.0]
doing ctors obj 0x1c2205876350 @0x1c220835a740: [/usr/lib/libm.so.9.0]
doing ctors obj 0x1c22058766a0 @0x1c22087b07a0:
[/usr/local/lib/libxml2.so.15.1]
doing ctors obj 0x1c2205876a08 @0x1c22078cfa70: [/usr/lib/libssl.so.20.0]
doing ctors obj 0x1c2203ac1078 @0x1c2201715c50: [/usr/lib/libc.so.73.1]
entry point: 0x1c200048b530
LOG: database system was shut down at 2014-09-15 00:31:32 EDT
doing dtors
doing dtors obj 0x1c2203ac13b8 @0x1c22074a1c60: [/usr/lib/libkrb5.so.20.0]
doing dtors obj 0x1c2204894610 @0x1c220f2216f0: [/usr/lib/libasn1.so.20.0]
doing dtors obj 0x1c2203ac1740 @0x1c2206f2a070: [/usr/lib/libcrypto.so.23.0]
doing dtors obj 0x1c2204894cf8 @0x1c2204898170: [/usr/lib/libwind.so.1.0]
doing dtors obj 0x1c2204894990 @0x1c2205472d60: [/usr/lib/libroken.so.1.0]
doing dtors obj 0x1c2203ac1a98 @0x1c220d959580: [/usr/lib/libcom_err.so.20.0]
doing dtors obj 0x1c2205876008 @0x1c2201c97a60: [/usr/lib/libheimbase.so.1.0]
doing dtors obj 0x1c22058766a0 @0x1c2208893210:
[/usr/local/lib/libxml2.so.15.1]
doing dtors obj 0x1c2205876a08 @0x1c2207903c80: [/usr/lib/libssl.so.20.0]
doing dtors obj 0x1c2203ac1078 @0x1c220179df80: [/usr/lib/libc.so.73.1]
doing dtors obj 0x1c2205876350 @0x1c2208373d90: [/usr/lib/libm.so.9.0]
doing dtors obj 0x1c2208291008 @0x1c22061dd050: [/usr/lib/libz.so.5.0]
doing dtors obj 0x1c2208291348 @0x1c22035460e0:
[/usr/local/lib/libiconv.so.6.0]
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
here I load perl with psql:
postgres=# create extension plperl;
CREATE EXTENSION
dlopen: loading: /usr/local/lib/postgresql/plperl.so
flags /usr/local/lib/postgresql/plperl.so = 0x0
head /usr/local/lib/postgresql/plperl.so
obj /usr/local/lib/postgresql/plperl.so has
/usr/local/lib/postgresql/plperl.so as head
linking /usr/local/lib/postgresql/plperl.so as dlopen()ed
head [/usr/local/lib/postgresql/plperl.so]
examining: '/usr/local/lib/postgresql/plperl.so'
loading: libheimbase.so.1.0 required by /usr/local/lib/postgresql/plperl.so
loading: libutil.so.12.0 required by /usr/local/lib/postgresql/plperl.so
flags /usr/lib/libutil.so.12.0 = 0x0
obj /usr/lib/libutil.so.12.0 has /usr/local/lib/postgresql/plperl.so as head
loading: libcrypto.so.23.0 required by /usr/local/lib/postgresql/plperl.so
loading: libcom_err.so.20.0 required by /usr/local/lib/postgresql/plperl.so
loading: libwind.so.1.0 required by /usr/local/lib/postgresql/plperl.so
loading: libc.so.73.1 required by /usr/local/lib/postgresql/plperl.so
loading: libroken.so.1.0 required by /usr/local/lib/postgresql/plperl.so
loading: libm.so.9.0 required by /usr/local/lib/postgresql/plperl.so
loading: libperl.so.14.0 required by /usr/local/lib/postgresql/plperl.so
flags /usr/lib/libperl.so.14.0 = 0x0
obj /usr/lib/libperl.so.14.0 has /usr/local/lib/postgresql/plperl.so as head
loading: libasn1.so.20.0 required by /usr/local/lib/postgresql/plperl.so
loading: libkrb5.so.20.0 required by /usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libkrb5.so.20.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libasn1.so.20.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libcrypto.so.23.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libwind.so.1.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libroken.so.1.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libcom_err.so.20.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libheimbase.so.1.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libperl.so.14.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libm.so.9.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libutil.so.12.0 as child of
/usr/local/lib/postgresql/plperl.so
linking dep /usr/lib/libc.so.73.1 as child of
/usr/local/lib/postgresql/plperl.so
examining: '/usr/lib/libperl.so.14.0'
examining: '/usr/lib/libutil.so.12.0'
tail /usr/local/lib/postgresql/plperl.so
doing ctors obj 0xd817a343880 @0xd8163048280: [/usr/lib/libperl.so.14.0]
doing ctors obj 0xd817a343518 @0xd8168d5d790: [/usr/lib/libutil.so.12.0]
doing ctors obj 0xd817a3430b8 @0xd8164c49b70:
[/usr/local/lib/postgresql/plperl.so]
dlopen: /usr/local/lib/postgresql/plperl.so: done (success).
dlsym: Pg_magic_func in /usr/local/lib/postgresql/plperl.so: 0xd8164c4a860
dlsym: _PG_init in /usr/local/lib/postgresql/plperl.so: 0xd8164c4c990
dlsym: plperl_call_handler in /usr/local/lib/postgresql/plperl.so:
0xd8164c528d0
dlsym: pg_finfo_plperl_call_handler in
/usr/local/lib/postgresql/plperl.so: 0xd8164c4a8f0
dlsym: plperl_inline_handler in /usr/local/lib/postgresql/plperl.so:
0xd8164c52fb0
dlsym: pg_finfo_plperl_inline_handler in
/usr/local/lib/postgresql/plperl.so: 0xd8164c4a900
dlsym: plperl_validator in /usr/local/lib/postgresql/plperl.so: 0xd8164c52da0
dlsym: pg_finfo_plperl_validator in
/usr/local/lib/postgresql/plperl.so: 0xd8164c4a910
For reference,
$ ldd /usr/local/lib/postgresql/plperl.so
/usr/local/lib/postgresql/plperl.so:
Start End Type Open Ref GrpRef Name
000012ac91102000 000012ac91517000 dlib 1 0 0
/usr/local/lib/postgresql/plperl.so
000012ac949ce000 000012ac94e3b000 rlib 0 1 0
/usr/lib/libkrb5.so.20.0
000012ac9de19000 000012ac9e295000 rlib 0 1 0
/usr/lib/libasn1.so.20.0
000012ac92cb7000 000012ac93271000 rlib 0 1 0
/usr/lib/libcrypto.so.23.0
000012ac95991000 000012ac95db9000 rlib 0 1 0
/usr/lib/libwind.so.1.0
000012ac98721000 000012ac98b32000 rlib 0 1 0
/usr/lib/libroken.so.1.0
000012ac90832000 000012ac90c34000 rlib 0 1 0
/usr/lib/libcom_err.so.20.0
000012ac9d494000 000012ac9d898000 rlib 0 1 0
/usr/lib/libheimbase.so.1.0
000012ac975ee000 000012ac97b5a000 rlib 0 1 0
/usr/lib/libperl.so.14.0
000012ac9d898000 000012ac9dcc0000 rlib 0 1 0 /usr/lib/libm.so.9.0
000012ac945c3000 000012ac949ce000 rlib 0 1 0
/usr/lib/libutil.so.12.0
here I load python, which fails
postgres=# create extension plpython2u;
ERROR: could not load library
"/usr/local/lib/postgresql/plpython2.so": dlopen
(/usr/local/lib/postgresql/plpython2.so) failed: Cannot load specified
object
dlopen: loading: /usr/local/lib/postgresql/plpython2.so
flags /usr/local/lib/postgresql/plpython2.so = 0x0
head /usr/local/lib/postgresql/plpython2.so
obj /usr/local/lib/postgresql/plpython2.so has
/usr/local/lib/postgresql/plpython2.so as head
linking /usr/local/lib/postgresql/plpython2.so as dlopen()ed
head [/usr/local/lib/postgresql/plpython2.so]
examining: '/usr/local/lib/postgresql/plpython2.so'
loading: libwind.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libroken.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libm.so.9.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libkrb5.so.20.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libcrypto.so.23.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libcom_err.so.20.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libc.so.73.1 required by /usr/local/lib/postgresql/plpython2.so
loading: libheimbase.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libutil.so.12.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libpthread.so.18.0 required by /usr/local/lib/postgresql/plpython2.so
flags /usr/lib/libpthread.so.18.0 = 0x68
dlopen: failed to open libpthread.so.18.0
unload_shlib called on /usr/local/lib/postgresql/plpython2.so
unload_shlib unloading on /usr/local/lib/postgresql/plpython2.so
dlopen: /usr/local/lib/postgresql/plpython2.so: done (failed).
ERROR: could not load library
"/usr/local/lib/postgresql/plpython2.so": dlopen
(/usr/local/lib/postgresql/plpython2.so) failed: Cannot load specified
object
STATEMENT: create extension plpython2u;
doing dtors
doing dtors obj 0xd816b3ef9a0 @0xd8165486c60: [/usr/lib/libkrb5.so.20.0]
doing dtors obj 0xd816e9c2750 @0xd816f5ae6f0: [/usr/lib/libasn1.so.20.0]
doing dtors obj 0xd816e9c23f8 @0xd81642a5070: [/usr/lib/libcrypto.so.23.0]
doing dtors obj 0xd816b3efd08 @0xd81700f8170: [/usr/lib/libwind.so.1.0]
doing dtors obj 0xd816e9c2ab8 @0xd816c576d60: [/usr/lib/libroken.so.1.0]
doing dtors obj 0xd816b3ef618 @0xd81714ec580: [/usr/lib/libcom_err.so.20.0]
doing dtors obj 0xd816e9c20b0 @0xd816bf9fa60: [/usr/lib/libheimbase.so.1.0]
doing dtors obj 0xd816385c348 @0xd8162bca210: [/usr/local/lib/libxml2.so.15.1]
doing dtors obj 0xd816385ca10 @0xd816923fc80: [/usr/lib/libssl.so.20.0]
doing dtors obj 0xd816385c6b0 @0xd8165d60f80: [/usr/lib/libc.so.73.1]
doing dtors obj 0xd816385c008 @0xd816f024d90: [/usr/lib/libm.so.9.0]
doing dtors obj 0xd816d22f348 @0xd816af7c050: [/usr/lib/libz.so.5.0]
doing dtors obj 0xd816d22f008 @0xd81705380e0: [/usr/local/lib/libiconv.so.6.0]
$ ldd /usr/local/lib/postgresql/plpython2.so
/usr/local/lib/postgresql/plpython2.so:
Start End Type Open Ref GrpRef Name
000013888eed4000 000013888f2f1000 dlib 1 0 0
/usr/local/lib/postgresql/plpython2.so
0000138890611000 0000138890a7e000 rlib 0 1 0
/usr/lib/libkrb5.so.20.0
0000138895d33000 00001388961af000 rlib 0 1 0
/usr/lib/libasn1.so.20.0
000013889141f000 00001388919d9000 rlib 0 1 0
/usr/lib/libcrypto.so.23.0
000013888f6d1000 000013888faf9000 rlib 0 1 0
/usr/lib/libwind.so.1.0
0000138893a45000 0000138893e56000 rlib 0 1 0
/usr/lib/libroken.so.1.0
000013888dc60000 000013888e062000 rlib 0 1 0
/usr/lib/libcom_err.so.20.0
0000138889b0c000 0000138889f10000 rlib 0 1 0
/usr/lib/libheimbase.so.1.0
0000138895783000 0000138895d33000 rlib 0 1 0
/usr/local/lib/libpython2.7.so.0.0
0000138890a7e000 0000138890e90000 rlib 0 3 0
/usr/lib/libpthread.so.18.0
000013888900b000 0000138889416000 rlib 0 2 0
/usr/lib/libutil.so.12.0
0000138886c18000 0000138887040000 rlib 0 2 0 /usr/lib/libm.so.9.0
$
http://comments.gmane.org/gmane.os.openbsd.misc/214048 explains that
I can force libpthread to load with LD_PRELOAD, and indeed this fixes
it!
$ LD_PRELOAD=libpthread.so LD_DEBUG=1 postgres -D ./data
rtld loading: 'postgres'
exe load offset: 0x185c32d00000
flags postgres = 0x0
head postgres
obj postgres has postgres as head
flags /usr/lib/libpthread.so.18.0 = 0x68
obj /usr/lib/libpthread.so.18.0 has postgres as head
objname /usr/lib/libpthread.so.18.0 is nodelete
linking dep /usr/lib/libpthread.so.18.0 as child of postgres
examining: 'postgres'
loading: libcrypto.so.23.0 required by postgres
flags /usr/lib/libcrypto.so.23.0 = 0x0
obj /usr/lib/libcrypto.so.23.0 has postgres as head
loading: libssl.so.20.0 required by postgres
flags /usr/lib/libssl.so.20.0 = 0x0
obj /usr/lib/libssl.so.20.0 has postgres as head
loading: libxml2.so.15.1 required by postgres
flags /usr/local/lib/libxml2.so.15.1 = 0x0
obj /usr/local/lib/libxml2.so.15.1 has postgres as head
loading: libcom_err.so.20.0 required by postgres
flags /usr/lib/libcom_err.so.20.0 = 0x0
obj /usr/lib/libcom_err.so.20.0 has postgres as head
loading: libasn1.so.20.0 required by postgres
flags /usr/lib/libasn1.so.20.0 = 0x0
obj /usr/lib/libasn1.so.20.0 has postgres as head
loading: libm.so.9.0 required by postgres
flags /usr/lib/libm.so.9.0 = 0x0
obj /usr/lib/libm.so.9.0 has postgres as head
loading: libheimbase.so.1.0 required by postgres
flags /usr/lib/libheimbase.so.1.0 = 0x0
obj /usr/lib/libheimbase.so.1.0 has postgres as head
loading: libkrb5.so.20.0 required by postgres
flags /usr/lib/libkrb5.so.20.0 = 0x0
obj /usr/lib/libkrb5.so.20.0 has postgres as head
loading: libc.so.73.1 required by postgres
flags /usr/lib/libc.so.73.1 = 0x0
obj /usr/lib/libc.so.73.1 has postgres as head
loading: libroken.so.1.0 required by postgres
flags /usr/lib/libroken.so.1.0 = 0x0
obj /usr/lib/libroken.so.1.0 has postgres as head
loading: libwind.so.1.0 required by postgres
flags /usr/lib/libwind.so.1.0 = 0x0
obj /usr/lib/libwind.so.1.0 has postgres as head
linking dep /usr/lib/libkrb5.so.20.0 as child of postgres
linking dep /usr/lib/libasn1.so.20.0 as child of postgres
linking dep /usr/lib/libcrypto.so.23.0 as child of postgres
linking dep /usr/lib/libwind.so.1.0 as child of postgres
linking dep /usr/lib/libroken.so.1.0 as child of postgres
linking dep /usr/lib/libcom_err.so.20.0 as child of postgres
linking dep /usr/lib/libheimbase.so.1.0 as child of postgres
linking dep /usr/local/lib/libxml2.so.15.1 as child of postgres
linking dep /usr/lib/libssl.so.20.0 as child of postgres
linking dep /usr/lib/libm.so.9.0 as child of postgres
linking dep /usr/lib/libc.so.73.1 as child of postgres
examining: '/usr/lib/libpthread.so.18.0'
examining: '/usr/lib/libkrb5.so.20.0'
examining: '/usr/lib/libasn1.so.20.0'
examining: '/usr/lib/libcrypto.so.23.0'
examining: '/usr/lib/libwind.so.1.0'
examining: '/usr/lib/libroken.so.1.0'
examining: '/usr/lib/libcom_err.so.20.0'
examining: '/usr/lib/libheimbase.so.1.0'
examining: '/usr/local/lib/libxml2.so.15.1'
loading: libm.so.9.0 required by /usr/local/lib/libxml2.so.15.1
loading: libz.so.5.0 required by /usr/local/lib/libxml2.so.15.1
flags /usr/lib/libz.so.5.0 = 0x0
obj /usr/lib/libz.so.5.0 has postgres as head
loading: libiconv.so.6.0 required by /usr/local/lib/libxml2.so.15.1
flags /usr/local/lib/libiconv.so.6.0 = 0x0
obj /usr/local/lib/libiconv.so.6.0 has postgres as head
linking dep /usr/lib/libz.so.5.0 as child of /usr/local/lib/libxml2.so.15.1
linking dep /usr/local/lib/libiconv.so.6.0 as child of
/usr/local/lib/libxml2.so.15.1
linking dep /usr/lib/libm.so.9.0 as child of /usr/local/lib/libxml2.so.15.1
examining: '/usr/lib/libssl.so.20.0'
examining: '/usr/lib/libm.so.9.0'
examining: '/usr/lib/libc.so.73.1'
examining: '/usr/lib/libz.so.5.0'
examining: '/usr/local/lib/libiconv.so.6.0'
flags /usr/libexec/ld.so = 0x0
obj /usr/libexec/ld.so has postgres as head
relocation took 0.006179
Start End Type Open Ref GrpRef Name
0000185c32d00000 0000185c3367a000 exe 1 0 0 postgres
0000185e35f8a000 0000185e3639c000 rlib 0 2 0
/usr/lib/libpthread.so.18.0
0000185e430ca000 0000185e43537000 rlib 0 1 0
/usr/lib/libkrb5.so.20.0
0000185e36f2a000 0000185e373a6000 rlib 0 1 0
/usr/lib/libasn1.so.20.0
0000185e3c739000 0000185e3ccf3000 rlib 0 1 0
/usr/lib/libcrypto.so.23.0
0000185e37714000 0000185e37b3c000 rlib 0 1 0
/usr/lib/libwind.so.1.0
0000185e39a1d000 0000185e39e2e000 rlib 0 1 0
/usr/lib/libroken.so.1.0
0000185e336f6000 0000185e33af8000 rlib 0 1 0
/usr/lib/libcom_err.so.20.0
0000185e3f253000 0000185e3f657000 rlib 0 1 0
/usr/lib/libheimbase.so.1.0
0000185e3ff3b000 0000185e40494000 rlib 0 1 0
/usr/local/lib/libxml2.so.15.1
0000185e42c6c000 0000185e430ca000 rlib 0 1 0
/usr/lib/libssl.so.20.0
0000185e3e3f9000 0000185e3e821000 rlib 0 2 0 /usr/lib/libm.so.9.0
0000185e3639c000 0000185e36885000 rlib 0 1 0 /usr/lib/libc.so.73.1
0000185e37d89000 0000185e3819e000 rlib 0 1 0 /usr/lib/libz.so.5.0
0000185e38a5e000 0000185e38f5b000 rlib 0 1 0
/usr/local/lib/libiconv.so.6.0
0000185e35600000 0000185e35600000 rtld 0 1 0 /usr/libexec/ld.so
symcache lookups 3827 hits 0 ratio 0% hits
dynamic loading done, success.
doing ctors obj 0x185e3a3900c8 @0x185e35f8ee90: [/usr/lib/libpthread.so.18.0]
doing ctors obj 0x185e4073ad80 @0x185e430e3600: [/usr/lib/libkrb5.so.20.0]
doing ctors obj 0x185e4073a348 @0x185e36f41ac0: [/usr/lib/libasn1.so.20.0]
doing ctors obj 0x185e3a390528 @0x185e3c79fb20: [/usr/lib/libcrypto.so.23.0]
doing ctors obj 0x185e3ccf37a8 @0x185e37715760: [/usr/lib/libwind.so.1.0]
doing ctors obj 0x185e3ccf3440 @0x185e39a214e0: [/usr/lib/libroken.so.1.0]
doing ctors obj 0x185e4073a008 @0x185e336f6ec0: [/usr/lib/libcom_err.so.20.0]
doing ctors obj 0x185e4073aa28 @0x185e3f254900: [/usr/lib/libheimbase.so.1.0]
doing ctors obj 0x185e3ccf3c78 @0x185e37d8b0a0: [/usr/lib/libz.so.5.0]
doing ctors obj 0x185e33f01008 @0x185e38a60ea0:
[/usr/local/lib/libiconv.so.6.0]
doing ctors obj 0x185e4073a6b0 @0x185e3e3fd740: [/usr/lib/libm.so.9.0]
doing ctors obj 0x185e3a390be0 @0x185e3ff6d7a0:
[/usr/local/lib/libxml2.so.15.1]
doing ctors obj 0x185e3a390880 @0x185e42c81a70: [/usr/lib/libssl.so.20.0]
doing ctors obj 0x185e3ccf30e8 @0x185e363bbc50: [/usr/lib/libc.so.73.1]
entry point: 0x185c32d8b530
dlctl: _dl_thread_fnc set to 0x185e35f911b0
dlctl: _dl_bind_lock_f set to 0x185e35f90af0
LOG: database system was shut down at 2014-09-15 00:41:55 EDT
doing dtors
doing dtors obj 0x185e4073ad80 @0x185e4311ec60: [/usr/lib/libkrb5.so.20.0]
doing dtors obj 0x185e4073a348 @0x185e36f956f0: [/usr/lib/libasn1.so.20.0]
doing dtors obj 0x185e3a390528 @0x185e3c87d070: [/usr/lib/libcrypto.so.23.0]
doing dtors obj 0x185e3ccf37a8 @0x185e37717170: [/usr/lib/libwind.so.1.0]
doing dtors obj 0x185e3ccf3440 @0x185e39a2ad60: [/usr/lib/libroken.so.1.0]
doing dtors obj 0x185e4073a008 @0x185e336f7580: [/usr/lib/libcom_err.so.20.0]
doing dtors obj 0x185e4073aa28 @0x185e3f255a60: [/usr/lib/libheimbase.so.1.0]
doing dtors obj 0x185e3a390be0 @0x185e40050210:
[/usr/local/lib/libxml2.so.15.1]
doing dtors obj 0x185e3a390880 @0x185e42cb5c80: [/usr/lib/libssl.so.20.0]
doing dtors obj 0x185e3ccf30e8 @0x185e36443f80: [/usr/lib/libc.so.73.1]
doing dtors obj 0x185e4073a6b0 @0x185e3e416d90: [/usr/lib/libm.so.9.0]
doing dtors obj 0x185e3ccf3c78 @0x185e37d96050: [/usr/lib/libz.so.5.0]
doing dtors obj 0x185e33f01008 @0x185e38a790e0:
[/usr/local/lib/libiconv.so.6.0]
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
# psql
postgres=# create extension plpython2u;
CREATE EXTENSION
postgres=#
# back to postgres
dlopen: loading: /usr/local/lib/postgresql/plpython2.so
flags /usr/local/lib/postgresql/plpython2.so = 0x0
head /usr/local/lib/postgresql/plpython2.so
obj /usr/local/lib/postgresql/plpython2.so has
/usr/local/lib/postgresql/plpython2.so as head
linking /usr/local/lib/postgresql/plpython2.so as dlopen()ed
head [/usr/local/lib/postgresql/plpython2.so]
examining: '/usr/local/lib/postgresql/plpython2.so'
loading: libcom_err.so.20.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libc.so.73.1 required by /usr/local/lib/postgresql/plpython2.so
loading: libpthread.so.18.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libutil.so.12.0 required by /usr/local/lib/postgresql/plpython2.so
flags /usr/lib/libutil.so.12.0 = 0x0
obj /usr/lib/libutil.so.12.0 has
/usr/local/lib/postgresql/plpython2.so as head
loading: libpython2.7.so.0.0 required by
/usr/local/lib/postgresql/plpython2.so
flags /usr/local/lib/libpython2.7.so.0.0 = 0x0
obj /usr/local/lib/libpython2.7.so.0.0 has
/usr/local/lib/postgresql/plpython2.so as head
loading: libkrb5.so.20.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libroken.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libwind.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libheimbase.so.1.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libcrypto.so.23.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libasn1.so.20.0 required by /usr/local/lib/postgresql/plpython2.so
loading: libm.so.9.0 required by /usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libkrb5.so.20.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libasn1.so.20.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libcrypto.so.23.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libwind.so.1.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libroken.so.1.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libcom_err.so.20.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libheimbase.so.1.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/local/lib/libpython2.7.so.0.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libpthread.so.18.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libutil.so.12.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libm.so.9.0 as child of
/usr/local/lib/postgresql/plpython2.so
linking dep /usr/lib/libc.so.73.1 as child of
/usr/local/lib/postgresql/plpython2.so
examining: '/usr/local/lib/libpython2.7.so.0.0'
loading: libutil.so.12.0 required by /usr/local/lib/libpython2.7.so.0.0
loading: libpthread.so.18.0 required by /usr/local/lib/libpython2.7.so.0.0
loading: libm.so.9.0 required by /usr/local/lib/libpython2.7.so.0.0
linking dep /usr/lib/libpthread.so.18.0 as child of
/usr/local/lib/libpython2.7.so.0.0
linking dep /usr/lib/libutil.so.12.0 as child of
/usr/local/lib/libpython2.7.so.0.0
linking dep /usr/lib/libm.so.9.0 as child of
/usr/local/lib/libpython2.7.so.0.0
examining: '/usr/lib/libutil.so.12.0'
tail /usr/local/lib/postgresql/plpython2.so
doing ctors obj 0x185e3d517528 @0x185e4bf8d790: [/usr/lib/libutil.so.12.0]
doing ctors obj 0x185e3d517890 @0x185e4081ef90:
[/usr/local/lib/libpython2.7.so.0.0]
doing ctors obj 0x185e3d5170b8 @0x185e3b39b0b0:
[/usr/local/lib/postgresql/plpython2.so]
dlopen: /usr/local/lib/postgresql/plpython2.so: done (success).
dlsym: Pg_magic_func in /usr/local/lib/postgresql/plpython2.so: 0x185e3b3a0440
dlsym: _PG_init in /usr/local/lib/postgresql/plpython2.so: 0x185e3b3a0ae0
dlsym: plpython2_call_handler in
/usr/local/lib/postgresql/plpython2.so: 0x185e3b3a09b0
dlsym: pg_finfo_plpython2_call_handler in
/usr/local/lib/postgresql/plpython2.so: 0x185e3b3a0490
dlsym: plpython2_inline_handler in
/usr/local/lib/postgresql/plpython2.so: 0x185e3b3a07f0
dlsym: pg_finfo_plpython2_inline_handler in
/usr/local/lib/postgresql/plpython2.so: 0x185e3b3a04a0
dlsym: plpython2_validator in /usr/local/lib/postgresql/plpython2.so:
0x185e3b3a0ad0
dlsym: pg_finfo_plpython2_validator in
/usr/local/lib/postgresql/plpython2.so: 0x185e3b3a0480
But I do not understand why libpthread.so refuses to load if the
system knows it needs it. libpython2.7.so isn't preloaded like
libkrb5.so and friends, and that seems to load fine except for its
broken dependency.
Anyway, thanks for the tips; I'll take this to the OpenBSD maintainers now.