Re: Compiling C Extension Functions against PostgreSQL 12

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, TalGloz <glozmantal(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Compiling C Extension Functions against PostgreSQL 12
Date: 2020-05-02 21:23:43
Message-ID: 173180ca-67f8-b925-fe5c-7c08de5bb9c1@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/2/20 2:18 PM, Tom Lane wrote:
> TalGloz <glozmantal(at)gmail(dot)com> writes:
>> I dont understand why the output for Postgres 12
>> g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute
>> -Wformat-security -fno-strict-aliasing -fwrapv -O2 -o seal_diff_cpp.o -c
>> seal_diff_cpp.cpp
>> seal_diff_cpp.cpp:2:10: fatal error: postgres.h: No such file or directory
>> 2 | #include "postgres.h"
>> | ^~~~~~~~~~~~
>
>> looks different form the ones of Postgres 10
>
> Looking at your Makefile, it seems to be expecting that CXXFLAGS will
> be honored in the build, and it isn't being.
>
> As far as I can see from pgxs.mk, you're supposed to spell that
> PG_CXXFLAGS. Probably, it accidentally worked to do it the other
> way in v10, but no longer does, likely as a result of the fact that
> there's now some minimal amount of C++ code in core PG.

I was looking at that and was trying to figure out this from pgxs.mk:

# PG_CXXFLAGS -- will be appended to CXXFLAGS

...

ifdef PG_CXXFLAGS
override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS)

Was wondering if this might be culprit(from example in pgxs.mk):

# include $(PGXS)

The OP does not have that in their make file.

>
> I'm a little dubious about whether overriding CXX is a good idea now, too.
> (Likely the core setting is the same, but if it were pointing at a
> different compiler that could cause trouble.)
>
> regards, tom lane
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message TalGloz 2020-05-02 21:44:06 Re: Compiling C Extension Functions against PostgreSQL 12
Previous Message Tom Lane 2020-05-02 21:18:10 Re: Compiling C Extension Functions against PostgreSQL 12