Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 246397 - dev-db/postgresql-base-8.3.4 with USE=kerberos and app-crypt/heimdal-1.2.1-r1: undefined symbol: gss_*
Summary: dev-db/postgresql-base-8.3.4 with USE=kerberos and app-crypt/heimdal-1.2.1-r1...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PgSQL Bugs
URL: http://anoncvs.postgresql.org/cvsweb....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-11 13:57 UTC by Martin von Gagern
Modified: 2010-06-02 17:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Don't filter -lgssapi for SHLIB_LINK (postgresql-8.3.4-lgssapi.patch,1.10 KB, patch)
2008-11-11 14:01 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2008-11-11 13:57:31 UTC
The libpq.so installed by dev-db/postgresql-base-8.3.4 when compiled against app-crypt/heimdal-1.2.1-r1 seems to lack some dependencies, resulting in unresolved symbols.

For some reason this doesn't cause problems at compile-time; I only encountered this issue when trying to build other packages that use libpq, namely grass.

$ ldd -r /usr/lib/postgresql-8.3/lib/libpq.so
        linux-gate.so.1 =>  (0xffffe000)
        libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0xb7f72000)
        libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0xb7e36000)
        libkrb5.so.25 => /usr/lib/libkrb5.so.25 (0xb7ddc000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7daa000)
        libldap_r-2.3.so.0 => /usr/lib/libldap_r-2.3.so.0 (0xb7d69000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7d51000)
        libc.so.6 => /lib/libc.so.6 (0xb7c1a000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7c16000)
        libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0xb7bba000)
        libasn1.so.8 => /usr/lib/libasn1.so.8 (0xb7b44000)
        libwind.so.0 => /usr/lib/libwind.so.0 (0xb7b1a000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7b16000)
        libroken.so.18 => /usr/lib/libroken.so.18 (0xb7b03000)
        libresolv.so.2 => /lib/libresolv.so.2 (0xb7af1000)
        liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0xb7ae4000)
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb7acc000)
        /lib/ld-linux.so.2 (0x44e7e000)
undefined symbol: GSS_C_NT_HOSTBASED_SERVICE                (.../lib/libpq.so)
undefined symbol: gss_release_name      (/usr/lib/postgresql-8.3/lib/libpq.so)
undefined symbol: gss_display_status    (/usr/lib/postgresql-8.3/lib/libpq.so)
undefined symbol: gss_import_name       (/usr/lib/postgresql-8.3/lib/libpq.so)
undefined symbol: gss_release_buffer    (/usr/lib/postgresql-8.3/lib/libpq.so)
undefined symbol: gss_delete_sec_context                    (.../lib/libpq.so)
undefined symbol: gss_init_sec_context  (/usr/lib/postgresql-8.3/lib/libpq.so)

$ objdump -T /usr/lib/postgresql-8.3/lib/libpq.so.5.1 | grep gss_release_name
00000000      D  *UND*  00000000              gss_release_name
$ objdump -T /usr/lib/libneon.so.27.1.3 | grep gss_release_name
00000000      DF *UND*  0000008b  HEIMDAL_GSS_1.0 gss_release_name
$ objdump -T /usr/lib/libgssapi.so.2.0.0 | grep gss_release_name
4ea1be20 g    DF .text  0000008b  HEIMDAL_GSS_1.0 gss_release_name

It looks like libgssapi.so were the required dependency. It also looks like that library wasn't around when libpq.so got linked, as it misses that column containing "HEIMDAL_GSS_1.0" which all the other libs (neon as an example) contain.

From config.log:
configure:7366: checking for library containing gss_init_sec_context
...
configure:7445: result: -lgssapi -lkrb5 -lcrypto
...
## ----------------- ##
## Output variables. ##
## ----------------- ##
...
LIBS='-lpam -lssl -lcrypto -lgssapi -lkrb5 -lcrypto -lz -lreadline -lcrypt -ldl -lm '

The linker invocation from the build log:
i686-pc-linux-gnu-gcc -march=prescott -O2 -ggdb -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libpq.so.5 -Wl,--version-script=exports.list  fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o   -L../../../src/port -lssl -lcrypto -lkrb5 -lcrypto -lcrypt -lldap_r -lpthread -Wl,-rpath,'/usr/lib/postgresql-8.3/lib' -o libpq.so.5.1

So it looks like wlthough the libs (esp. -lgssapi) are detected and used in general, they are not used for the shared library. The culprit seems to be in src/interfaces/libpq/Makefile:

# Add libraries that libpq depends (or might depend) on into the
# shared library link.  (The order in which you list them here doesn't
# matter.)
SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)

For some reason or other, this list explicitely filters out the required libs. Strange behaviour. Fixing that line fixes the problem. Patch ready.
Comment 1 Martin von Gagern 2008-11-11 14:01:30 UTC
Created attachment 171423 [details, diff]
Don't filter -lgssapi for SHLIB_LINK
Comment 2 Martin von Gagern 2008-11-11 14:07:54 UTC
Upstream has found and fixed this issue as well:
http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/Makefile.diff?r1=1.159.2.2;r2=1.159.2.3;f=h
Comment 3 Patrick Lauer gentoo-dev 2009-11-02 22:17:40 UTC
postgres is at 8.3.8 now, I would guess this error is fixed now.
Can you confirm?
Comment 4 Martin von Gagern 2009-11-09 08:02:50 UTC
(In reply to comment #3)
> postgres is at 8.3.8 now, I would guess this error is fixed now.
> Can you confirm?

8.2.8 emerged without an incident. Confirming.

Comment 5 Bob 2010-03-08 18:09:12 UTC
Doesn't seem to be fixed in 8.4.2-r1.  With the kerberos USE flag on and Heimdal installed, postgresql-base won't emerge.  Will emerge if I turn the USE flag off. Also emerged with kerberos USE flag on, with MIT kerberos instead of Heimdal.  It therefore seems to be the same bug, even if it is presenting in a different manner.  

Here's the relevant last bit from the log:

i686-pc-linux-gnu-gcc -march=pentium-m -pipe -fomit-frame-pointer -O3 -Wall -Wmi                          ssing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -f                          no-strict-aliasing -fwrapv -pthread  -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREA                          D_SEMANTICS -DECPG_COMPILE -L../../../../src/port -Wl,-O1  -Wl,--as-needed -Wl,-                          rpath,'/usr/lib/postgresql-8.4/lib' preproc.o type.o ecpg.o output.o parser.o ke                          ywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descripto                          r.o variable.o -lpgport -lpam -lssl -lcrypto -lgssapi -lkrb5 -lcrypto -lz -lread                          line -lcrypt -ldl -lm  -lpthread      -o ecpg
descriptor.o: In function `descriptor_variable':
descriptor.c:make[4]: Leaving directory `/var/tmp/paludis/dev-db-postgresql-base                          -8.4.2-r1/work/postgresql-8.4.2/src/interfaces/ecpg/preproc'
(.text+0x3e): undefined reference to `strlcpy'
../../../../src/port/libpgport.a(path.o): In function `get_home_path':
path.c:(.text+0x127): undefined reference to `strlcpy'
../../../../src/port/libpgport.a(path.o): In function `join_path_components':
path.c:(.text+0x333): undefined reference to `strlcpy'
../../../../src/port/libpgport.a(path.o): In function `make_relative_path':
path.c:(.text+0xa44): undefined reference to `strlcpy'
path.c:(.text+0xa95): undefined reference to `strlcpy'
collect2: ld returned 1 exit status
make[4]: *** [ecpg] Error 1
make[3]: Leaving directory `/var/tmp/paludis/dev-db-postgresql-base-8.4.2-r1/wor                          k/postgresql-8.4.2/src/interfaces/ecpg'
make[3]: *** [all] Error 2
make[2]: Leaving directory `/var/tmp/paludis/dev-db-postgresql-base-8.4.2-r1/wor                          k/postgresql-8.4.2/src/interfaces'
make[1]: Leaving directory `/var/tmp/paludis/dev-db-postgresql-base-8.4.2-r1/wor                          k/postgresql-8.4.2/src'
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
/usr/libexec/paludis/utils/emake: emake returned error 2

!!! ERROR in dev-db/postgresql-base-8.4.2-r1::gentoo:
!!! In src_compile at line 4461
!!! emake failed

!!! Call stack:
!!!    * src_compile (/var/tmp/paludis/dev-db-postgresql-base-8.4.2-r1/temp/load                          saveenv:4461)
!!!    * ebuild_f_compile (/usr/libexec/paludis/1/src_compile.bash:49)
!!!    * ebuild_main (/usr/libexec/paludis/ebuild.bash:616)
!!!    * main (/usr/libexec/paludis/ebuild.bash:644)

diefunc: making ebuild PID 31102 exit with error
die trap: exiting with error.
Comment 6 Benjamin Lee 2010-03-22 02:48:44 UTC
I am having the same issue as Bob: postgresql-base-8.4.3 will not emerge with USE=kerberos and heimdal-1.2.1-r4.  emerge succeeds with USE=-kerberos.
Comment 7 zym 2010-03-30 14:11:18 UTC
please see the patch from bug 285953, I have tested postgresql-base-8.4.2-r1.ebuild  postgresql-base-8.4.3.ebuild with that patch works over USE kerberos(heimdal):
Installed versions:  8.4.3(8.4)!t{tbz2}[1](08:14:13 03/27/10)(kerberos ldap linguas_zh_CN nls pam readline ssl threads zlib -doc -linguas_af -linguas_cs -linguas_de -linguas_es -linguas_fa -linguas_fr -linguas_hr -linguas_hu -linguas_it -linguas_ko -linguas_nb -linguas_pl -linguas_pt_BR -linguas_ro -linguas_ru -linguas_sk -linguas_sl -linguas_sv -linguas_tr -linguas_zh_TW -pg_legacytimestamp)

Comment 8 Patrick Lauer gentoo-dev 2010-06-02 17:25:27 UTC
+  02 Jun 2010; Patrick Lauer <patrick@gentoo.org>
+  +postgresql-base-7.4.29-r1.ebuild, +postgresql-base-8.0.25-r1.ebuild,
+  +postgresql-base-8.1.21-r1.ebuild, +postgresql-base-8.2.17-r1.ebuild,
+  +postgresql-base-8.3.11-r1.ebuild,
+  +files/postgresql-base-8.4-9.0-heimdal_strlcpy.patch,
+  +postgresql-base-8.4.4-r1.ebuild, +postgresql-base-9.0_beta1-r1.ebuild:
+  Fixes for #313765, #251046, #294462, #300793, #274836, #296714, #238817,
+  #278228, #263096, #246397, #285953. Thanks to Aaron Swenson for collecting
+  the fixes and testing.