Re: [GENERAL] Using different GCC, CFLAGS, CCFLAGS and CPPFLAGS to compile Postgres and PostGIS? - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Using different GCC, CFLAGS, CCFLAGS and CPPFLAGS to compile Postgres and PostGIS?
Date
Msg-id 345.1486010897@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] Using different GCC, CFLAGS, CCFLAGS and CPPFLAGS to compile Postgresand PostGIS?  (postgres user <postgresuser1989@gmail.com>)
List pgsql-general
postgres user <postgresuser1989@gmail.com> writes:
> What can go wrong or is it acceptable if I build Postgres from source with
> let's say GCC 4.x.y and some specific CFLAGS, CPPFLAGS and CCFLAGS and when
> I try to install an extension for Postgres such as PostGIS using a
> different version of GCC lets say GCC 4.x.z with varying CFLAGS, CCFLAGS
> and CPPFLAGS and if I follow the same process for other non-contrib
> extensions? I want to know the theory behind this and it would serve me a
> great help to understand the systems aspect of the process as well.

You could certainly break things that way if you tried hard enough.
"Hard enough" would involve, say, selecting compiler flags that alter
ABI details like function calling conventions or struct packing rules.
Then the code in the extension would expect to call or be called
differently than the code in the core server expects to do it, or
would believe that structs declared in core server header files are
laid out differently than the code in the core server thinks, etc.

Using a different compiler would matter if it wasn't ABI-compatible with
the compiler used for the core code.  Usually, vendor-supplied compilers
for different C variants are all configured to be ABI-compatible on a
given platform; but again you could break it if you tried hard enough,
like say using a home-built compiler that you'd configured randomly
differently from the platform's default compiler.

It would be more useful to ask about specific changes you want to make
in the compiler and flag choices (and explaining why you want to make
those specific changes wouldn't be a bad thing either).

            regards, tom lane


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: [GENERAL] Using different GCC, CFLAGS, CCFLAGS and CPPFLAGS tocompile Postgres and PostGIS?
Next
From: postgres user
Date:
Subject: [GENERAL] Re: Using different GCC, CFLAGS, CCFLAGS and CPPFLAGS to compilePostgres and PostGIS?