Skip site navigation (1) Skip section navigation (2)

Re: Cannot Statically Link libpq.a

From: Emilio Recio <erecio(at)storm(dot)jmc(dot)tju(dot)edu>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Cannot Statically Link libpq.a
Date: 2002-09-25 13:57:28
Message-ID: 3D91C0C8.7050900@storm.jmc.tju.edu (view raw or flat)
Thread:
Lists: pgsql-interfaces
Patrick Welche wrote:
> Very long shot: what if you move the -lpq to the end?
> 
> gcc -o testpq -static testpq.c -lpq

YOU ROCK!

erecio(at)datacollector1:$ make
gcc -static -o testpg -L. testpg.o -lpq
./libpq.a(fe-auth.o): In function `pg_password_sendauth':
fe-auth.o(.text+0x148): undefined reference to `crypt'
collect2: ld returned 1 exit status
make: *** [pgconn] Error 1

-- after editing the makefile

$ make
gcc -static -o testpg -L. testpg.o -lpq -lcrypt
strip testpg && size testpg
    text    data     bss     dec     hex filename
  437341   11488  165800  614629   960e5 pgconn

$ ldd testpg
         not a dynamic executable

I've been away from C for too long... QT has pampered me and PHP has 
made me lazy. Java well... has made me take everything for granted. :) 
Hopefully this list is archived so someone else doesn't make that same 
'oops'. Thanks a lot.

~Elmo


In response to

pgsql-interfaces by date

Next:From: Gary KnoppDate: 2002-09-25 16:58:55
Subject: ecpg help
Previous:From: Emilio RecioDate: 2002-09-25 13:46:49
Subject: Re: Cannot Statically Link libpq.a

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group