Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CBEC147678D for ; Wed, 25 Sep 2002 09:26:20 -0400 (EDT) Received: from storm.jmc.tju.edu (storm.jmc.tju.edu [147.140.155.140]) by postgresql.org (Postfix) with ESMTP id 261B6476687 for ; Wed, 25 Sep 2002 09:26:20 -0400 (EDT) Received: from storm.jmc.tju.edu (noir.jmc.tju.edu [147.140.160.249]) by storm.jmc.tju.edu (8.11.6/8.11.2) with ESMTP id g8PDKFw14497; Wed, 25 Sep 2002 09:20:15 -0400 Message-ID: <3D91B97F.6090002@storm.jmc.tju.edu> Date: Wed, 25 Sep 2002 09:26:23 -0400 From: Emilio Recio Organization: Polywog Systems ( http://polywog.philtered.net ) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Cc: erecio@storm.jmc.tju.edu, emrecio@netscape.net Subject: Cannot Statically Link libpq.a Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/76 X-Sequence-Number: 3137 (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' /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