Compiling a user C function in 7.2.1 - Mailing list pgsql-novice

From John Gunther
Subject Compiling a user C function in 7.2.1
Date
Msg-id 3D3FF28F.1070304@bucksvsbytes.com
Whole thread Raw
In response to Add value in an Array  ("Jerome Chochon" <jerome.chochon@ensma.fr>)
Responses Re: Compiling a user C function in 7.2.1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
I'm writing additional C functions to extend PostgreSQL 7.2.1 on Red Hat
Linux 7.3, a process whose details are apparently not well documented.

I've got my first function written, using the functions in the source file
numeric.c as a model. I tried compiling it using the advice offered by Bruce
Momjian in his book (highly recommended), PostgreSQL: Introduction and
Concepts:


 The next step is to compile the C file into an object file that contains
CPU instructions. As part of this step, you must create a special
object file that can be dynamically linked  into
the POSTGRESQL server. Many operating systems require special
flags to create an object file that can be dynamically linked. The best way
to find the required flags is to go to pgsql/src/test/regress and
type make clean and then make regress.so. <a
 name="tex2html247"
 href="http://www.ca.postgresql.org/docs/aw_pgsql_book/footnode.html#foot21643">24.1
This command will display the compile commands used to generate the dynamically
linkable object file regress.so. The -I compile
flags allow searching for include files. Other flags are used for generating
dynamic object files; use them to compile your C code into a dynamically
linkable object file. You may need to consult your operating system documentation
for assistance in locating the proper flags.

This is where I'm stumped. make clean yields the error message "GNUmakefile:16:
../../../src/Makefile.global: No such file or directory". I then tried
renaming the file Makefile.global.in to Makefile.global
and running make clean again. This got a little farther but resulted
in the message "../../../src/Makefile.global:269: ../../../src/Makefile.port:
No such file or directory". I can't find a Makefile.port file
anywhere. Any idea what I'm doing wrong?

Thanks in advance for your guidance.

pgsql-novice by date:

Previous
From: Ludwig Lim
Date:
Subject: Re: Advantage of using cursors...
Next
From: "J.T. Hartzler"
Date:
Subject: ...