Thread: Compiling .pgc programs gives error

Compiling .pgc programs gives error

From
"mike stanton"
Date:
I have a problem compiling pgc programs with ecpg.
I always get the following error:
 
/usr/local/pgsql/lib/libpgtypes.a(timestamp.o): In function `timestamp2tm':
timestamp.c:(.text+0x2fc): undefined reference to `rint'
Version: PostgreSQL 8.3.6 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.4
 
Is this a known problem?
Any help will be useful.
 
Michael Stanton W.

Re: Compiling .pgc programs gives error

From
Tom Lane
Date:
"mike stanton" <mstanton@acsa.cl> writes:
> I have a problem compiling pgc programs with ecpg.
> I always get the following error:

> /usr/local/pgsql/lib/libpgtypes.a(timestamp.o): In function `timestamp2tm':
> timestamp.c:(.text+0x2fc): undefined reference to `rint'

Seems like you need to add "-lm" to your link command.  Or consider
linking to libpgtypes.so instead of libpgtypes.a --- .so's generally
carry information about libraries they depend on, which .a's don't.

            regards, tom lane