agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Vincent Schenkelaars <schenkel@cs.few.eur.nl>
To: Postgres@postgres.Berkeley.EDU
Subject: Undefined symbol in user function
Date: Fri, 2 Sep 94 13:02:38 +0200
Message-ID: <9409021102.AA18370@argon.cs.few.eur.nl> (raw)

Dear Postgres Group,


I'm using postgres 4.2 on sunos4.3.1. I'm getting a undefined symbol _sin error
when using a simple test function with postgres.

I created the database test.
my c-function is:

#include "tmp/postgres.h"
#include <math.h>

float4 *
test(f)
  float4 *f;
{
  float4 *result;

  result = (float4 *) palloc(sizeof(float4));

  *result = sin(*f);
  return (result);
}


I compiled it with
cc -I$POSTGRESHOME/include -c test.c 
ld -dc -dp -Bdynamic -o test.so test.o

and I defined the function with:
define function test (language="c", returntype = float4) as
 "/export/local/geo-geo-ext/test.so"


when I do a retrieve (t = test(1::float4)) directly in the backend I get
ld.so: Undefined symbol: _sin.


What went wrong?  Shouldn't the backend have linked the libm.a file? 
Surely it didn't do it right.  When I remove the sin function in my c-source.
everything goes fine.


Please give me some clues?

Regards,
     ____________________   Vincent F. Schenkelaars
 \  / . _   _  _   _  |	    E-mail: Schenkelaars@cs.few.eur.nl
  \/ ( ( \ (_ (-' ( \ |     
			    "We apologize for the inconvenience"

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: schenkel@cs.few.eur.nl
  Subject: Re: Undefined symbol in user function
  In-Reply-To: <9409021102.AA18370@argon.cs.few.eur.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox