Cannot Statically Link libpq.a

Поиск
Список
Период
Сортировка
От Emilio Recio
Тема Cannot Statically Link libpq.a
Дата
Msg-id 3D91B97F.6090002@storm.jmc.tju.edu
обсуждение исходный текст
Список pgsql-interfaces
(sorry if you get this twice, but the email kept getting 'deffered' 
because of a bad hello or something last night)

I try to statically link the testpq.c program via:

gcc -o testpq -lpq -static testpq.c

and get the following error:
[erecio@moz postgres]$ gcc -o testpq -static -lpq testpq.c
/tmp/ccIp5I09.o: In function `exit_nicely':
/tmp/ccIp5I09.o(.text+0xd): undefined reference to `PQfinish'
/tmp/ccIp5I09.o: In function `main':
/tmp/ccIp5I09.o(.text+0x60): undefined reference to `PQsetdbLogin'
/tmp/ccIp5I09.o(.text+0x73): undefined reference to `PQstatus'
/tmp/ccIp5I09.o(.text+0xa4): undefined reference to `PQerrorMessage'
<MORE OF THE SAME>
/tmp/ccIp5I09.o(.text+0x35d): undefined reference to `PQfinish'
collect2: ld returned 1 exit status

While dynamically linking it works fine:

$ gcc -o testpq -lpq testpq.c
$ ldd testpq         libpq.so.2 => /usr/lib/libpq.so.2 (0x4002c000)         libc.so.6 => /lib/i686/libc.so.6
(0x42000000)        libssl.so.2 => /lib/libssl.so.2 (0x4003f000)         libcrypto.so.2 => /lib/libcrypto.so.2
(0x4006c000)        libkrb5.so.3 => /usr/kerberos/lib/libkrb5.so.3 (0x40130000)         libk5crypto.so.3 =>
/usr/kerberos/lib/libk5crypto.so.3
 
(0x40187000)         libcom_err.so.3 => /usr/kerberos/lib/libcom_err.so.3 (0x40197000)         libcrypt.so.1 =>
/lib/libcrypt.so.1(0x4019a000)         libresolv.so.2 => /lib/libresolv.so.2 (0x401c7000)         libnsl.so.1 =>
/lib/libnsl.so.1(0x401d8000)         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)         libdl.so.2 =>
/lib/libdl.so.2(0x401ed000)
 

libpq.a is in /usr/lib, but it's only about 93k. For the object files
that seems alot. I need to statically link the library because I am
going to be using a custom program in an embedded device where none of
the above libraries mentioned in the ldd works. All the the programs
statically link fine, except for libpq. I am using the redhat 7.3 rpms.

-Elmo





В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Brett Schwarz
Дата:
Сообщение: Re: question on pgaccess installation
Следующее
От: Emilio Recio
Дата:
Сообщение: Re: Cannot Statically Link libpq.a