Received: from mail.xnet.com (quake.xnet.com [198.147.221.35]) by hub.org (8.9.1/8.9.1) with ESMTP id VAA14055 for ; Mon, 18 Jan 1999 21:45:33 -0500 (EST) (envelope-from selkovjr@mcs.anl.gov) Received: from mcs.anl.gov (selkovjr@selkovjr.xnet.com [205.243.141.67]) by mail.xnet.com (8.8.6/XNet-3.0R) with ESMTP id UAA00925; Mon, 18 Jan 1999 20:45:20 -0600 (CST) Message-Id: <199901190245.UAA00925@mail.xnet.com> To: Michael Olivier , pgsql-sql@postgresql.org Subject: Re: [SQL] binary operators / C func getting "invalid ELF header" In-Reply-To: Your message of "Mon, 18 Jan 1999 16:51:30 PST." <19990119005130.1209.rocketmail@send105.yahoomail.com> Date: Mon, 18 Jan 1999 20:47:25 -0500 From: "Gene Selkov Jr." > > I've gone down the path of trying to write a C function to > do this... and am getting this error: > > db=3D> select not_a_and__a_xor_b(1,1); > ERROR: Load of file /home/michael/sql/funcs.so failed: > =A8=B8t@=A8=B8t@chael/sql/funcs.so: invalid ELF header > > I'm compiling with the -fpic option for Linux (under gcc) > > cc -c -O2 -fpic -g -I. -I./include -I. -I./include -c funcs.c -o > funcs.o > /bin/rm -f funcs.so > /usr/bin/ar cr funcs.so funcs.o =20 Try to adapt the Makefile from src/tutorial to your purposes. Make sure it includes the right rules by changing SRCDIR= .. include ../Makefile.global to: SRCDIR= /path/to/your/postgres/source/tree/src include $(SRCDIR)/Makefile.global Then name your target files in $(DLOBJS). You may also want to note the sed rules that substitute anchors such as _OBJWD_ with the absolute path. They make your sql scripts more portable (see funcs.source for example. --Gene