Re: Compiling C Extension Functions against PostgreSQL 12 - Mailing list pgsql-general

From TalGloz
Subject Re: Compiling C Extension Functions against PostgreSQL 12
Date
Msg-id 1588452776591-0.post@n3.nabble.com
Whole thread Raw
In response to Re: Compiling C Extension Functions against PostgreSQL 12  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Compiling C Extension Functions against PostgreSQL 12  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Adrian Klaver-4 wrote
> On 5/2/20 1:09 PM, TalGloz wrote:
>> Adrian Klaver-4 wrote
> 
>> 
>> Yes, they were created when using make against Postgres 10 and I clean
>> them
>> every time when I try a different version of Postgres.
> 
> Well I'm reaching the end of what I can do. All I have left is that the 
> examples I have seen use:
> 
> #include "postgres.h"
> 
> not
> 
> #include 
> <postgres.h>
>> 
>> TalGloz
> 
> 
> 
> -- 
> Adrian Klaver

> adrian.klaver@

If it works for Postgres 10 it should also work for 12. I've changed from
#include <postgres.h> to #include "postgres.h" and I still get the same
error with Postgres 12 and it complies without any problem with Postgres 10

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
g++ -std=c++17 -fPIC -Wall -Werror -g -O0 -pthread
-I/usr/pgsql-10/include/server -I/usr/local/include
-I/usr/local/include/cppcodec -o seal_diff_cpp.o -c seal_diff_cpp.cpp
g++ -shared -o seal_diff_cpp.so seal_diff_cpp.o -L/usr/pgsql-12/lib  
-L/usr/lib64 -Wl,--as-needed
-Wl,-rpath,'/usr/pgsql-12/lib',--enable-new-dtags -L/usr/local/lib -lseal
-pthread

All the includes with "-I" and "-std=c++17 -fPIC" are from the first line
gone. I even tried to use fixed paths in my Makefiles: "PGXS =
/usr/pgsql-12/lib/pgxs/src/makefiles/pgxs.mk" and "INCLUDEDIR =
/usr/pgsql-12/include/server".

TalGloz



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Compiling C Extension Functions against PostgreSQL 12
Next
From: Tom Lane
Date:
Subject: Re: Compiling C Extension Functions against PostgreSQL 12