Thread: Statically linking against libpq
I'll start off by saying that I am a compiling novice, so bear with me please. I have a library which is being plugged into a game server to provide extra functionality. The library is currently linked against libpq like so `gcc -shared -lpq`. It compiles and runs great as long as people have libpg installed. I'm trying to find a way to remove this dependency so I googled around and found that `-shared` needed to be `- static` and to add `-lcrypt` also. However, the linker is now failing and tossing me lots of "undefined reference" messages to things like "krb5_free_context" (I've attached the full log). I'd appreciate any suggestions on getting a statically linked library against libpq. I'm currently compiling on a Fedora Core 3 machine with gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. Thanks in advace, ~ Matthew
On Mon, 2005-01-17 at 14:10 -0500, Matthew Metnetsky wrote: > I'll start off by saying that I am a compiling novice, so bear with me > please. > > I have a library which is being plugged into a game server to provide > extra functionality. The library is currently linked against libpq like > so `gcc -shared -lpq`. It compiles and runs great as long as people > have libpg installed. I'm trying to find a way to remove this > dependency so I googled around and found that `-shared` needed to be `- > static` and to add `-lcrypt` also. However, the linker is now failing > and tossing me lots of "undefined reference" messages to things like > "krb5_free_context" (I've attached the full log). > > I'd appreciate any suggestions on getting a statically linked library > against libpq. I'm currently compiling on a Fedora Core 3 machine with > gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. > > Thanks in advace, > > ~ Matthew Forgot the attachment.... here it is inline. ========================================================================= /usr/local/gcc-2.95.3/bin/gcc -static -ggdb3 -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"debugging\" -DCVAR_DEBUG=1 debug.nix/api_info.o debug.nix/commands_meta.o debug.nix/dllapi.o debug.nix/metamod.o debug.nix/engine_api.o debug.nix/h_export.o debug.nix/linkent.o debug.nix/linkgame.o debug.nix/log_meta.o debug.nix/cmn.o debug.nix/cmn_player.o debug.nix/cmn_usermsg.o debug.nix/cmn_events.o debug.nix/cmn_team.o debug.nix/osdep.o debug.nix/sdk_util.o debug.nix/studioapi.o debug.nix/support_meta.o debug.nix/avl.o -o debug.nix/cmn_i386.so -ldl -lm -lpq -lcryptdebug.nix/metamod.o (.gnu.linkonce.t.DLOPEN(char const *)+0x21): In function `DLOPEN(char const *)': /home/mimetnet/Projects/CMN/hlds-plugin/src/osdep.h:133: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/libpq.a(thread.o)(.text+0x6b): In function `pqGetpwuid': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/thread.c:113: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/libpq.a(ip.o)(.text+0x9e): In function `getaddrinfo_all': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/ip.c:81: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/crt1.o(.text+0x18): In function `_start': : undefined reference to `main' /usr/lib/libpq.a(fe-misc.o)(.text+0x8ae): In function `pqSocketCheck': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-misc.c:973: undefined reference to `SSL_pending' /usr/lib/libpq.a(fe-secure.o)(.text+0xd9): In function `load_dh_file': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:575: undefined reference to `PEM_read_DHparams' /usr/lib/libpq.a(fe-secure.o)(.text+0xef):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:580: undefined reference to `DH_size' /usr/lib/libpq.a(fe-secure.o)(.text+0x11d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:586: undefined reference to `DH_check' /usr/lib/libpq.a(fe-secure.o)(.text+0x15e): In function `load_dh_buffer': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:611: undefined reference to `BIO_new_mem_buf' /usr/lib/libpq.a(fe-secure.o)(.text+0x186):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:614: undefined reference to `PEM_read_bio_DHparams' /usr/lib/libpq.a(fe-secure.o)(.text+0x190):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:615: undefined reference to `BIO_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x1e7): In function `tmp_dh_cb': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:684: undefined reference to `DH_size' /usr/lib/libpq.a(fe-secure.o)(.text+0x20e):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:685: undefined reference to `DH_generate_parameters' /usr/lib/libpq.a(fe-secure.o)(.text+0x362): In function `pqsecure_destroy': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:883: undefined reference to `SSL_CTX_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x3aa): In function `close_SSL': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1003: undefined reference to `SSL_shutdown' /usr/lib/libpq.a(fe-secure.o)(.text+0x3b8):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1004: undefined reference to `SSL_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x3d4):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1010: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x415): In function `SSLerrmessage': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1029: undefined reference to `ERR_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x430):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1032: undefined reference to `ERR_reason_error_string' /usr/lib/libpq.a(fe-secure.o)(.text+0x4b0): In function `pqsecure_write': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:357: undefined reference to `SSL_write' /usr/lib/libpq.a(fe-secure.o)(.text+0x4c7):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:358: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x67c): In function `pqsecure_read': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:284: undefined reference to `SSL_read' /usr/lib/libpq.a(fe-secure.o)(.text+0x690):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:285: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x81b): In function `pqsecure_open_client': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_new' /usr/lib/libpq.a(fe-secure.o)(.text+0x839):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_set_ex_data' /usr/lib/libpq.a(fe-secure.o)(.text+0x861):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_set_fd' /usr/lib/libpq.a(fe-secure.o)(.text+0x873):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:896: undefined reference to `SSL_connect' /usr/lib/libpq.a(fe-secure.o)(.text+0x88b):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:956: undefined reference to `SSL_get_peer_certificate' /usr/lib/libpq.a(fe-secure.o)(.text+0x8dc):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: undefined reference to `X509_get_subject_name' /usr/lib/libpq.a(fe-secure.o)(.text+0x8f6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: undefined reference to `X509_NAME_oneline' /usr/lib/libpq.a(fe-secure.o)(.text+0x90b):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: undefined reference to `X509_get_subject_name' /usr/lib/libpq.a(fe-secure.o)(.text+0x92d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: undefined reference to `X509_NAME_get_text_by_NID' /usr/lib/libpq.a(fe-secure.o)(.text+0x956):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:899: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0xa27): In function `pqsecure_initialize': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:821: undefined reference to `SSL_library_init' /usr/lib/libpq.a(fe-secure.o)(.text+0xa2c):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:822: undefined reference to `SSL_load_error_strings' /usr/lib/libpq.a(fe-secure.o)(.text+0xa31):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: undefined reference to `TLSv1_method' /usr/lib/libpq.a(fe-secure.o)(.text+0xa39):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: undefined reference to `SSL_CTX_new' /usr/lib/libpq.a(fe-secure.o)(.text+0xae7):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:851: undefined reference to `SSL_CTX_load_verify_locations' /usr/lib/libpq.a(fe-secure.o)(.text+0xb0f):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:860: undefined reference to `SSL_CTX_set_verify' /usr/lib/libpq.a(fe-secure.o)(.text+0xb25):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:862: undefined reference to `SSL_CTX_set_verify_depth' /usr/lib/libpq.a(fe-secure.o)(.text+0xb3d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:865: undefined reference to `SSL_CTX_set_tmp_dh_callback' /usr/lib/libpq.a(fe-secure.o)(.text+0xb63):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:866: undefined reference to `SSL_CTX_ctrl' /usr/lib/libpq.a(fe-secure.o)(.text+0xc2c): In function `client_cert_cb': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:710: undefined reference to `SSL_get_ex_data' /usr/lib/libpq.a(fe-secure.o)(.text+0xd06):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:734: undefined reference to `PEM_read_X509' /usr/lib/libpq.a(fe-secure.o)(.text+0xdb5):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:768: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xdfd):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:752: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xeac):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:779: undefined reference to `PEM_read_PrivateKey' /usr/lib/libpq.a(fe-secure.o)(.text+0xed2):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:791: undefined reference to `X509_check_private_key' /usr/lib/libpq.a(fe-secure.o)(.text+0xf20):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:796: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xf2d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:797: undefined reference to `EVP_PKEY_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x10bb):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:784: undefined reference to `X509_free' /usr/lib/libpq.a(fe-auth.o)(.text+0x32): In function `pg_krb5_init': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:291: undefined reference to `krb5_init_context' /usr/lib/libpq.a(fe-auth.o)(.text+0x52):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:300: undefined reference to `krb5_cc_default' /usr/lib/libpq.a(fe-auth.o)(.text+0x7c):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:310: undefined reference to `krb5_cc_get_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0xa6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:322: undefined reference to `krb5_unparse_name' /usr/lib/libpq.a(fe-auth.o)(.text+0x102):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:294: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x132):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:303: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x15e):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:330: undefined reference to `krb5_free_context' /usr/lib/libpq.a(fe-auth.o)(.text+0x170):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:314: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x1a6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:329: undefined reference to `krb5_cc_close' /usr/lib/libpq.a(fe-auth.o)(.text+0x1b0):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:325: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x1e6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:328: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x3a3): In function `fe_sendauth': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:373: undefined reference to `krb5_sname_to_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x450):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:395: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x477):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:377: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x5b9):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:399: undefined reference to `krb5_sendauth' /usr/lib/libpq.a(fe-auth.o)(.text+0x5da):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:424: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x626):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:434: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x6b6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:429: undefined reference to `krb5_free_error' collect2: ld returned 1 exit status make: *** [debug.nix/cmn_i386.so] Error 1
Did you add the path to where the libpq lives to your LD_LIBRARY_PATH? I haven't tried this, but that may be the problem. Alternatively you can add the path to the link command using -L (I think.) e.g. on my machine export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib or gcc -L/usr/local/pgsql/lib ... Rick Matthew Metnetsky <met@uberstats.com> To: Pgsql-General <pgsql-general@postgresql.org> Sent by: cc: pgsql-general-owner@pos Subject: Re: [GENERAL] Statically linking against libpq tgresql.org 01/17/2005 03:04 PM On Mon, 2005-01-17 at 14:10 -0500, Matthew Metnetsky wrote: > I'll start off by saying that I am a compiling novice, so bear with me > please. > > I have a library which is being plugged into a game server to provide > extra functionality. The library is currently linked against libpq like > so `gcc -shared -lpq`. It compiles and runs great as long as people > have libpg installed. I'm trying to find a way to remove this > dependency so I googled around and found that `-shared` needed to be `- > static` and to add `-lcrypt` also. However, the linker is now failing > and tossing me lots of "undefined reference" messages to things like > "krb5_free_context" (I've attached the full log). > > I'd appreciate any suggestions on getting a statically linked library > against libpq. I'm currently compiling on a Fedora Core 3 machine with > gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. > > Thanks in advace, > > ~ Matthew Forgot the attachment.... here it is inline. ========================================================================= /usr/local/gcc-2.95.3/bin/gcc -static -ggdb3 -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"debugging\" -DCVAR_DEBUG=1 debug.nix/api_info.o debug.nix/commands_meta.o debug.nix/dllapi.o debug.nix/metamod.o debug.nix/engine_api.o debug.nix/h_export.o debug.nix/linkent.o debug.nix/linkgame.o debug.nix/log_meta.o debug.nix/cmn.o debug.nix/cmn_player.o debug.nix/cmn_usermsg.o debug.nix/cmn_events.o debug.nix/cmn_team.o debug.nix/osdep.o debug.nix/sdk_util.o debug.nix/studioapi.o debug.nix/support_meta.o debug.nix/avl.o -o debug.nix/cmn_i386.so -ldl -lm -lpq -lcryptdebug.nix/metamod.o (.gnu.linkonce.t.DLOPEN(char const *)+0x21): In function `DLOPEN(char const *)': /home/mimetnet/Projects/CMN/hlds-plugin/src/osdep.h:133: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/libpq.a(thread.o)(.text+0x6b): In function `pqGetpwuid': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/thread.c:113: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/libpq.a(ip.o)(.text+0x9e): In function `getaddrinfo_all': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/ip.c:81: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/crt1.o(.text+0x18): In function `_start': : undefined reference to `main' /usr/lib/libpq.a(fe-misc.o)(.text+0x8ae): In function `pqSocketCheck': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-misc.c:973: undefined reference to `SSL_pending' /usr/lib/libpq.a(fe-secure.o)(.text+0xd9): In function `load_dh_file': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:575: undefined reference to `PEM_read_DHparams' /usr/lib/libpq.a(fe-secure.o)(.text+0xef):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:580: undefined reference to `DH_size' /usr/lib/libpq.a(fe-secure.o)(.text+0x11d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:586: undefined reference to `DH_check' /usr/lib/libpq.a(fe-secure.o)(.text+0x15e): In function `load_dh_buffer': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:611: undefined reference to `BIO_new_mem_buf' /usr/lib/libpq.a(fe-secure.o)(.text+0x186):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:614: undefined reference to `PEM_read_bio_DHparams' /usr/lib/libpq.a(fe-secure.o)(.text+0x190):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:615: undefined reference to `BIO_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x1e7): In function `tmp_dh_cb': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:684: undefined reference to `DH_size' /usr/lib/libpq.a(fe-secure.o)(.text+0x20e):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:685: undefined reference to `DH_generate_parameters' /usr/lib/libpq.a(fe-secure.o)(.text+0x362): In function `pqsecure_destroy': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:883: undefined reference to `SSL_CTX_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x3aa): In function `close_SSL': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1003: undefined reference to `SSL_shutdown' /usr/lib/libpq.a(fe-secure.o)(.text+0x3b8):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1004: undefined reference to `SSL_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x3d4):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1010: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x415): In function `SSLerrmessage': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1029: undefined reference to `ERR_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x430):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1032: undefined reference to `ERR_reason_error_string' /usr/lib/libpq.a(fe-secure.o)(.text+0x4b0): In function `pqsecure_write': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:357: undefined reference to `SSL_write' /usr/lib/libpq.a(fe-secure.o)(.text+0x4c7):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:358: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x67c): In function `pqsecure_read': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:284: undefined reference to `SSL_read' /usr/lib/libpq.a(fe-secure.o)(.text+0x690):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:285: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0x81b): In function `pqsecure_open_client': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_new' /usr/lib/libpq.a(fe-secure.o)(.text+0x839):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_set_ex_data' /usr/lib/libpq.a(fe-secure.o)(.text+0x861):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: undefined reference to `SSL_set_fd' /usr/lib/libpq.a(fe-secure.o)(.text+0x873):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:896: undefined reference to `SSL_connect' /usr/lib/libpq.a(fe-secure.o)(.text+0x88b):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:956: undefined reference to `SSL_get_peer_certificate' /usr/lib/libpq.a(fe-secure.o)(.text+0x8dc):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: undefined reference to `X509_get_subject_name' /usr/lib/libpq.a(fe-secure.o)(.text+0x8f6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: undefined reference to `X509_NAME_oneline' /usr/lib/libpq.a(fe-secure.o)(.text+0x90b):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: undefined reference to `X509_get_subject_name' /usr/lib/libpq.a(fe-secure.o)(.text+0x92d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: undefined reference to `X509_NAME_get_text_by_NID' /usr/lib/libpq.a(fe-secure.o)(.text+0x956):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:899: undefined reference to `SSL_get_error' /usr/lib/libpq.a(fe-secure.o)(.text+0xa27): In function `pqsecure_initialize': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:821: undefined reference to `SSL_library_init' /usr/lib/libpq.a(fe-secure.o)(.text+0xa2c):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:822: undefined reference to `SSL_load_error_strings' /usr/lib/libpq.a(fe-secure.o)(.text+0xa31):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: undefined reference to `TLSv1_method' /usr/lib/libpq.a(fe-secure.o)(.text+0xa39):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: undefined reference to `SSL_CTX_new' /usr/lib/libpq.a(fe-secure.o)(.text+0xae7):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:851: undefined reference to `SSL_CTX_load_verify_locations' /usr/lib/libpq.a(fe-secure.o)(.text+0xb0f):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:860: undefined reference to `SSL_CTX_set_verify' /usr/lib/libpq.a(fe-secure.o)(.text+0xb25):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:862: undefined reference to `SSL_CTX_set_verify_depth' /usr/lib/libpq.a(fe-secure.o)(.text+0xb3d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:865: undefined reference to `SSL_CTX_set_tmp_dh_callback' /usr/lib/libpq.a(fe-secure.o)(.text+0xb63):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:866: undefined reference to `SSL_CTX_ctrl' /usr/lib/libpq.a(fe-secure.o)(.text+0xc2c): In function `client_cert_cb': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:710: undefined reference to `SSL_get_ex_data' /usr/lib/libpq.a(fe-secure.o)(.text+0xd06):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:734: undefined reference to `PEM_read_X509' /usr/lib/libpq.a(fe-secure.o)(.text+0xdb5):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:768: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xdfd):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:752: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xeac):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:779: undefined reference to `PEM_read_PrivateKey' /usr/lib/libpq.a(fe-secure.o)(.text+0xed2):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:791: undefined reference to `X509_check_private_key' /usr/lib/libpq.a(fe-secure.o)(.text+0xf20):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:796: undefined reference to `X509_free' /usr/lib/libpq.a(fe-secure.o)(.text+0xf2d):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:797: undefined reference to `EVP_PKEY_free' /usr/lib/libpq.a(fe-secure.o)(.text+0x10bb):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:784: undefined reference to `X509_free' /usr/lib/libpq.a(fe-auth.o)(.text+0x32): In function `pg_krb5_init': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:291: undefined reference to `krb5_init_context' /usr/lib/libpq.a(fe-auth.o)(.text+0x52):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:300: undefined reference to `krb5_cc_default' /usr/lib/libpq.a(fe-auth.o)(.text+0x7c):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:310: undefined reference to `krb5_cc_get_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0xa6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:322: undefined reference to `krb5_unparse_name' /usr/lib/libpq.a(fe-auth.o)(.text+0x102):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:294: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x132):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:303: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x15e):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:330: undefined reference to `krb5_free_context' /usr/lib/libpq.a(fe-auth.o)(.text+0x170):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:314: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x1a6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:329: undefined reference to `krb5_cc_close' /usr/lib/libpq.a(fe-auth.o)(.text+0x1b0):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:325: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x1e6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:328: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x3a3): In function `fe_sendauth': /usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:373: undefined reference to `krb5_sname_to_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x450):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:395: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x477):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:377: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x5b9):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:399: undefined reference to `krb5_sendauth' /usr/lib/libpq.a(fe-auth.o)(.text+0x5da):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:424: undefined reference to `error_message' /usr/lib/libpq.a(fe-auth.o)(.text+0x626):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:434: undefined reference to `krb5_free_principal' /usr/lib/libpq.a(fe-auth.o)(.text+0x6b6):/usr/src/build/498045- i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:429: undefined reference to `krb5_free_error' collect2: ld returned 1 exit status make: *** [debug.nix/cmn_i386.so] Error 1 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org
On Jan 17, 2005, at 2:10 PM, Matthew Metnetsky wrote: > I'd appreciate any suggestions on getting a statically linked library > against libpq. I'm currently compiling on a Fedora Core 3 machine with > gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. This is what I'm using to create a version of psql on OS X with libpq statically linked: gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wendif-labels -fno-strict-aliasing command.o common.o help.o input.o stringutils.o mainloop.o copy.o startup.o prompt.o variables.o large_obj.o print.o describe.o psqlscan.o tab-complete.o mbprint.o ../../../src/interfaces/libpq/libpq.a -L../../../src/interfaces/libpq -L../../../src/port -lpgport -lz -lresolv -ldl -lm -o psql John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
John DeSoi <desoi@pgedit.com> writes: > On Jan 17, 2005, at 2:10 PM, Matthew Metnetsky wrote: >> I'd appreciate any suggestions on getting a statically linked library >> against libpq. I'm currently compiling on a Fedora Core 3 machine with >> gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. > This is what I'm using to create a version of psql on OS X with libpq > statically linked: > gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith > -Wendif-labels -fno-strict-aliasing command.o common.o help.o input.o > stringutils.o mainloop.o copy.o startup.o prompt.o variables.o > large_obj.o print.o describe.o psqlscan.o tab-complete.o mbprint.o > ../../../src/interfaces/libpq/libpq.a -L../../../src/interfaces/libpq > -L../../../src/port -lpgport -lz -lresolv -ldl -lm -o psql Presumably you are using a fairly vanilla set of configure options, too. Matthew's missing symbols are Kerberos subroutines, so evidently his problem is that he configured --with-krb5 but didn't bother to mention the Kerberos library(s) in his link command. What I would recommend if you want a plugin substitute for the RPM version of the library is to rebuild from the corresponding SRPM and look at the log output to determine what options were used and what libraries need to be mentioned while linking libpq. regards, tom lane
Hi, Looks to me like you have to add -lkrb5 and -lssl to your compile flags as well. Perhaps some more others (you can use nm in conjunction with grep to find which libraries define the missing symbols (On OpenBSD like so: 'cd /usr/lib && nm -o * | grep krb5_free_context' but that might differ on Fedora Core 3). Regards, Daniel Citing Matthew Metnetsky <met@uberstats.com>: > On Mon, 2005-01-17 at 14:10 -0500, Matthew Metnetsky wrote: > > The library is currently linked against libpq like > > so `gcc -shared -lpq`. It compiles and runs great as long as people > > have libpg installed. I'm trying to find a way to remove this > > dependency so I googled around and found that `-shared` needed to be `- > > static` and to add `-lcrypt` also. However, the linker is now failing > > and tossing me lots of "undefined reference" messages to things like > > "krb5_free_context" (I've attached the full log). > > > > I'd appreciate any suggestions on getting a statically linked library > > against libpq. I'm currently compiling on a Fedora Core 3 machine with > > gcc-2.95.3 against the postgresql-libs-7.4.6-1.FC3.2 package. [snipped] > /usr/local/gcc-2.95.3/bin/gcc -static -ggdb3 -Wall -Wno-unknown-pragmas > -DOPT_TYPE=\"debugging\" -DCVAR_DEBUG=1 debug.nix/api_info.o > debug.nix/commands_meta.o debug.nix/dllapi.o debug.nix/metamod.o > debug.nix/engine_api.o debug.nix/h_export.o debug.nix/linkent.o > debug.nix/linkgame.o debug.nix/log_meta.o debug.nix/cmn.o > debug.nix/cmn_player.o debug.nix/cmn_usermsg.o debug.nix/cmn_events.o > debug.nix/cmn_team.o debug.nix/osdep.o debug.nix/sdk_util.o > debug.nix/studioapi.o debug.nix/support_meta.o debug.nix/avl.o -o > debug.nix/cmn_i386.so -ldl -lm -lpq -lcryptdebug.nix/metamod.o > (.gnu.linkonce.t.DLOPEN(char const *)+0x21): In function `DLOPEN(char > const *)': > /home/mimetnet/Projects/CMN/hlds-plugin/src/osdep.h:133: warning: Using > 'dlopen' in statically linked applications requires at runtime the > shared libraries from the glibc version used for linking > /usr/lib/libpq.a(thread.o)(.text+0x6b): In function `pqGetpwuid': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/thread.c:113: warning: > Using 'getpwuid_r' in statically linked applications requires at runtime > the shared libraries from the glibc version used for linking > /usr/lib/libpq.a(ip.o)(.text+0x9e): In function `getaddrinfo_all': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/ip.c:81: warning: Using > 'getaddrinfo' in statically linked applications requires at runtime the > shared libraries from the glibc version used for linking > /usr/lib/crt1.o(.text+0x18): In function `_start': > : undefined reference to `main' > /usr/lib/libpq.a(fe-misc.o)(.text+0x8ae): In function `pqSocketCheck': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-misc.c:973: > undefined reference to `SSL_pending' > /usr/lib/libpq.a(fe-secure.o)(.text+0xd9): In function `load_dh_file': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:575: > undefined reference to `PEM_read_DHparams' > /usr/lib/libpq.a(fe-secure.o)(.text+0xef):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:580: > undefined reference to `DH_size' > /usr/lib/libpq.a(fe-secure.o)(.text+0x11d):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:586: > undefined reference to `DH_check' > /usr/lib/libpq.a(fe-secure.o)(.text+0x15e): In function > `load_dh_buffer': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:611: > undefined reference to `BIO_new_mem_buf' > /usr/lib/libpq.a(fe-secure.o)(.text+0x186):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:614: > undefined reference to `PEM_read_bio_DHparams' > /usr/lib/libpq.a(fe-secure.o)(.text+0x190):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:615: > undefined reference to `BIO_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0x1e7): In function `tmp_dh_cb': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:684: > undefined reference to `DH_size' > /usr/lib/libpq.a(fe-secure.o)(.text+0x20e):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:685: > undefined reference to `DH_generate_parameters' > /usr/lib/libpq.a(fe-secure.o)(.text+0x362): In function > `pqsecure_destroy': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:883: > undefined reference to `SSL_CTX_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0x3aa): In function `close_SSL': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1003: > undefined reference to `SSL_shutdown' > /usr/lib/libpq.a(fe-secure.o)(.text+0x3b8):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1004: > undefined reference to `SSL_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0x3d4):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1010: > undefined reference to `X509_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0x415): In function `SSLerrmessage': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1029: > undefined reference to `ERR_get_error' > /usr/lib/libpq.a(fe-secure.o)(.text+0x430):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:1032: > undefined reference to `ERR_reason_error_string' > /usr/lib/libpq.a(fe-secure.o)(.text+0x4b0): In function > `pqsecure_write': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:357: > undefined reference to `SSL_write' > /usr/lib/libpq.a(fe-secure.o)(.text+0x4c7):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:358: > undefined reference to `SSL_get_error' > /usr/lib/libpq.a(fe-secure.o)(.text+0x67c): In function `pqsecure_read': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:284: > undefined reference to `SSL_read' > /usr/lib/libpq.a(fe-secure.o)(.text+0x690):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:285: > undefined reference to `SSL_get_error' > /usr/lib/libpq.a(fe-secure.o)(.text+0x81b): In function > `pqsecure_open_client': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: > undefined reference to `SSL_new' > /usr/lib/libpq.a(fe-secure.o)(.text+0x839):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: > undefined reference to `SSL_set_ex_data' > /usr/lib/libpq.a(fe-secure.o)(.text+0x861):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:241: > undefined reference to `SSL_set_fd' > /usr/lib/libpq.a(fe-secure.o)(.text+0x873):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:896: > undefined reference to `SSL_connect' > /usr/lib/libpq.a(fe-secure.o)(.text+0x88b):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:956: > undefined reference to `SSL_get_peer_certificate' > /usr/lib/libpq.a(fe-secure.o)(.text+0x8dc):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: > undefined reference to `X509_get_subject_name' > /usr/lib/libpq.a(fe-secure.o)(.text+0x8f6):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:966: > undefined reference to `X509_NAME_oneline' > /usr/lib/libpq.a(fe-secure.o)(.text+0x90b):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: > undefined reference to `X509_get_subject_name' > /usr/lib/libpq.a(fe-secure.o)(.text+0x92d):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:970: > undefined reference to `X509_NAME_get_text_by_NID' > /usr/lib/libpq.a(fe-secure.o)(.text+0x956):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:899: > undefined reference to `SSL_get_error' > /usr/lib/libpq.a(fe-secure.o)(.text+0xa27): In function > `pqsecure_initialize': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:821: > undefined reference to `SSL_library_init' > /usr/lib/libpq.a(fe-secure.o)(.text+0xa2c):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:822: > undefined reference to `SSL_load_error_strings' > /usr/lib/libpq.a(fe-secure.o)(.text+0xa31):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: > undefined reference to `TLSv1_method' > /usr/lib/libpq.a(fe-secure.o)(.text+0xa39):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:823: > undefined reference to `SSL_CTX_new' > /usr/lib/libpq.a(fe-secure.o)(.text+0xae7):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:851: > undefined reference to `SSL_CTX_load_verify_locations' > /usr/lib/libpq.a(fe-secure.o)(.text+0xb0f):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:860: > undefined reference to `SSL_CTX_set_verify' > /usr/lib/libpq.a(fe-secure.o)(.text+0xb25):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:862: > undefined reference to `SSL_CTX_set_verify_depth' > /usr/lib/libpq.a(fe-secure.o)(.text+0xb3d):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:865: > undefined reference to `SSL_CTX_set_tmp_dh_callback' > /usr/lib/libpq.a(fe-secure.o)(.text+0xb63):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:866: > undefined reference to `SSL_CTX_ctrl' > /usr/lib/libpq.a(fe-secure.o)(.text+0xc2c): In function > `client_cert_cb': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:710: > undefined reference to `SSL_get_ex_data' > /usr/lib/libpq.a(fe-secure.o)(.text+0xd06):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:734: > undefined reference to `PEM_read_X509' > /usr/lib/libpq.a(fe-secure.o)(.text+0xdb5):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:768: > undefined reference to `X509_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0xdfd):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:752: > undefined reference to `X509_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0xeac):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:779: > undefined reference to `PEM_read_PrivateKey' > /usr/lib/libpq.a(fe-secure.o)(.text+0xed2):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:791: > undefined reference to `X509_check_private_key' > /usr/lib/libpq.a(fe-secure.o)(.text+0xf20):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:796: > undefined reference to `X509_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0xf2d):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:797: > undefined reference to `EVP_PKEY_free' > /usr/lib/libpq.a(fe-secure.o)(.text+0x10bb):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-secure.c:784: > undefined reference to `X509_free' > /usr/lib/libpq.a(fe-auth.o)(.text+0x32): In function `pg_krb5_init': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:291: > undefined reference to `krb5_init_context' > /usr/lib/libpq.a(fe-auth.o)(.text+0x52):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:300: > undefined reference to `krb5_cc_default' > /usr/lib/libpq.a(fe-auth.o)(.text+0x7c):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:310: > undefined reference to `krb5_cc_get_principal' > /usr/lib/libpq.a(fe-auth.o)(.text+0xa6):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:322: > undefined reference to `krb5_unparse_name' > /usr/lib/libpq.a(fe-auth.o)(.text+0x102):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:294: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x132):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:303: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x15e):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:330: > undefined reference to `krb5_free_context' > /usr/lib/libpq.a(fe-auth.o)(.text+0x170):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:314: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x1a6):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:329: > undefined reference to `krb5_cc_close' > /usr/lib/libpq.a(fe-auth.o)(.text+0x1b0):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:325: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x1e6):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:328: > undefined reference to `krb5_free_principal' > /usr/lib/libpq.a(fe-auth.o)(.text+0x3a3): In function `fe_sendauth': > /usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:373: > undefined reference to `krb5_sname_to_principal' > /usr/lib/libpq.a(fe-auth.o)(.text+0x450):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:395: > undefined reference to `krb5_free_principal' > /usr/lib/libpq.a(fe-auth.o)(.text+0x477):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:377: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x5b9):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:399: > undefined reference to `krb5_sendauth' > /usr/lib/libpq.a(fe-auth.o)(.text+0x5da):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:424: > undefined reference to `error_message' > /usr/lib/libpq.a(fe-auth.o)(.text+0x626):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:434: > undefined reference to `krb5_free_principal' > /usr/lib/libpq.a(fe-auth.o)(.text+0x6b6):/usr/src/build/498045- > i386/BUILD/postgresql-7.4.6/src/interfaces/libpq/fe-auth.c:429: > undefined reference to `krb5_free_error' > collect2: ld returned 1 exit status > make: *** [debug.nix/cmn_i386.so] Error 1 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
On Mon, 2005-01-17 at 17:52 -0500, Tom Lane wrote: > John DeSoi <desoi@pgedit.com> writes: > Presumably you are using a fairly vanilla set of configure options, too. > Matthew's missing symbols are Kerberos subroutines, so evidently his > problem is that he configured --with-krb5 but didn't bother to mention > the Kerberos library(s) in his link command. > > What I would recommend if you want a plugin substitute for the RPM > version of the library is to rebuild from the corresponding SRPM > and look at the log output to determine what options were used and what > libraries need to be mentioned while linking libpq. By combining a bunch of the suggestions I've finally gotten it to work! Thanks everyone! Essentially, I had to recompile libpq so that when I compiled against it everything was included. Just setting the `-lpq - lssl -lkrb5` to my linker wasn't enough. I had to compile libpq as such, which then worked when I passed the same parameters to my linker. ~ Matthew P.S. Still linking against crypt.so, so one more to kill!