Re: Cannot Statically Link libpq.a - Mailing list pgsql-interfaces

From Emilio Recio
Subject Re: Cannot Statically Link libpq.a
Date
Msg-id 3D91C0C8.7050900@storm.jmc.tju.edu
Whole thread Raw
In response to Cannot Statically Link libpq.a  (Emilio Recio <erecio@storm.jmc.tju.edu>)
List 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@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



pgsql-interfaces by date:

Previous
From: Emilio Recio
Date:
Subject: Re: Cannot Statically Link libpq.a
Next
From: "William West"
Date:
Subject: Meaning of/ handling of ECPG_NOTICE_* ??