Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:46:10+00:00 2026-05-27T18:46:10+00:00

I am modifying an old makefile in order to build a C extension for

  • 0

I am modifying an old makefile in order to build a C extension for postgreSQL. The Makefile currently looks like this:

PGLIB = /usr/lib/postgresql/8.4/lib
PQINC = /usr/include/postgresql/8.4/server        
CC=gcc

override CFLAGS+= $(CFLAGS_SL) -DPG_AGGREGATE 

SHLIB = pg_myextlib

SRC =  foo.c \
       foobar.c

OBJS = foo.o \       
       foobar.o

all: $(OBJS)
    $(CC) -shared -o $(SHLIB)$(DLSUFFIX) $(OBJS) -I$(PQINC)
    cp *.so $(PGLIB)

clean:
    rm -f $(SHLIB) $(OBJS) 

The error I get when I run make is:

common.h:58:22: error: postgres.h: No such file or directory

Which suggests that the include path is not being added (the file exists in $PQINC).
Its a long time since I wrote the Makefile – and I haven’t written many since. As an aside, I am pretty sure that ‘shared’ is not the gcc flag to build shared libs on Ubuntu (my current dev box) – I think the flag should be ‘fPIC’ – can someone confirm this?

I am runing gcc v4.4.3 on Ubuntu 10.0.4 and compiling for use with PG 8.4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:46:11+00:00Added an answer on May 27, 2026 at 6:46 pm

    Try moving the -I$(PQINC) from target all to the end of line that starts with override CFLAGS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I'm modifying code I like to comment out the old code, modify it,
I am modifying a Nant build script to run some unit tests. I have
Modifying working form with one spot per order to multiple spots per order I
The old value/reference things. Im getting ConcurrentModificationException for this adaptation of the Bron-Kerbosch. public
I'm working on re-writing an old build that was originally designed (or not, as
I am modifying the old source code written in F77 to F90. I suffer
I'm looking at modifying an old school WebMethod in ASMX and for the Oracle
I'm modifying a website made with osCommerce (I didn't make this website), and one
I'm knee deep in modifying some old logging code that i didn't write and
I'm currently maintaining some old code for a company. As it would happen, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.