Обсуждение: Psqlodbc build fails on linux

Поиск
Список
Период
Сортировка

Psqlodbc build fails on linux

От
Moazzum Ali
Дата:
Hi,

I am trying to build psqlodbc 15.00.0000 with PostgreSQL 16. Here are my commands:

./configure --with-libpq=/usr/pgsql-16/ --with-unixodbc=/usr/bin/odbc_config LD_LIBRARY_PATH=/usr/pgsql-16/lib/  --prefix=$PWD/out
make

 make command fails with the following error:

In file included from connection.h:14,
                 from info.c:34:
/usr/pgsql-16/include/internal/pqexpbuffer.h:168:8: error: unknown type name 'bool'
 extern bool appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2, 0);

One way to fix the error is to include the following line before #include "pqexpbuffer.h" in connection.h and statement.h
#include <stdbool.h>

Regards,
Moazzum

Re: Psqlodbc build fails on linux

От
Michael Paquier
Дата:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.
--
Michael

Вложения

Re: Psqlodbc build fails on linux

От
Dave Cramer
Дата:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

Dave

Re: Psqlodbc build fails on linux

От
Dave Cramer
Дата:


On Mon, 4 Sept 2023 at 10:23, Dave Cramer <davecramer@postgres.rocks> wrote:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

It pays to read all of the above before trying to replicate. I was building against 15, not 16
I see the failure now 

Dave

Re: Psqlodbc build fails on linux

От
Moazzum Ali
Дата:
Dave,

Is it something that can be fixed on PG or psqlodbc side or you would also suggest what Michael suggested? I have tried that environment rule though and it works.

Thanks,
Moazzum

On Mon, Sep 4, 2023, 9:07 PM Dave Cramer <davecramer@postgres.rocks> wrote:


On Mon, 4 Sept 2023 at 10:23, Dave Cramer <davecramer@postgres.rocks> wrote:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

It pays to read all of the above before trying to replicate. I was building against 15, not 16
I see the failure now 

Dave

Re: Psqlodbc build fails on linux

От
Dave Cramer
Дата:
Seems like the better solution is to use Michael's suggestion as that is what PG does.

Dave Cramer
www.postgres.rocks


On Mon, 4 Sept 2023 at 12:28, Moazzum Ali <moazzum.ali@enterprisedb.com> wrote:
Dave,

Is it something that can be fixed on PG or psqlodbc side or you would also suggest what Michael suggested? I have tried that environment rule though and it works.

Thanks,
Moazzum

On Mon, Sep 4, 2023, 9:07 PM Dave Cramer <davecramer@postgres.rocks> wrote:


On Mon, 4 Sept 2023 at 10:23, Dave Cramer <davecramer@postgres.rocks> wrote:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

It pays to read all of the above before trying to replicate. I was building against 15, not 16
I see the failure now 

Dave

Re: Psqlodbc build fails on linux

От
Moazzum Ali
Дата:
Thanks Dave and Michael.

On Mon, Sep 4, 2023, 10:54 PM Dave Cramer <davecramer@postgres.rocks> wrote:
Seems like the better solution is to use Michael's suggestion as that is what PG does.

Dave Cramer
www.postgres.rocks


On Mon, 4 Sept 2023 at 12:28, Moazzum Ali <moazzum.ali@enterprisedb.com> wrote:
Dave,

Is it something that can be fixed on PG or psqlodbc side or you would also suggest what Michael suggested? I have tried that environment rule though and it works.

Thanks,
Moazzum

On Mon, Sep 4, 2023, 9:07 PM Dave Cramer <davecramer@postgres.rocks> wrote:


On Mon, 4 Sept 2023 at 10:23, Dave Cramer <davecramer@postgres.rocks> wrote:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

It pays to read all of the above before trying to replicate. I was building against 15, not 16
I see the failure now 

Dave

Re: Psqlodbc build fails on linux

От
Dave Cramer
Дата:
Please see attached patch to use autoconf to detect and use stdbool.h 

I have to admit to having no idea if this is correct or if the style is correct, much was copied from postgresql.

I have tested it on ubuntu, and it compiles. 

Dave Cramer
www.postgres.rocks


On Mon, 4 Sept 2023 at 13:56, Moazzum Ali <moazzum.ali@enterprisedb.com> wrote:
Thanks Dave and Michael.

On Mon, Sep 4, 2023, 10:54 PM Dave Cramer <davecramer@postgres.rocks> wrote:
Seems like the better solution is to use Michael's suggestion as that is what PG does.

Dave Cramer
www.postgres.rocks


On Mon, 4 Sept 2023 at 12:28, Moazzum Ali <moazzum.ali@enterprisedb.com> wrote:
Dave,

Is it something that can be fixed on PG or psqlodbc side or you would also suggest what Michael suggested? I have tried that environment rule though and it works.

Thanks,
Moazzum

On Mon, Sep 4, 2023, 9:07 PM Dave Cramer <davecramer@postgres.rocks> wrote:


On Mon, 4 Sept 2023 at 10:23, Dave Cramer <davecramer@postgres.rocks> wrote:


On Sun, 3 Sept 2023 at 19:46, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Aug 31, 2023 at 06:28:06AM +0500, Moazzum Ali wrote:
> One way to fix the error is to include the following line before
> #include "pqexpbuffer.h" in connection.h and statement.h
> #include <stdbool.h>

Wouldn't it be better to enforce an environment rule in psqlodbc.h
instead?  PostgreSQL enforces PG_USE_STDBOOL already on Windows, and
I am pretty sure that it would be OK to do the same in other *nix
places where anybody cares about ODBC.

I'm guessing this is a debian thing as I just built this successfully on a redhat (ish) system 

It pays to read all of the above before trying to replicate. I was building against 15, not 16
I see the failure now 

Dave
Вложения

Re: Psqlodbc build fails on linux

От
Michael Paquier
Дата:
On Mon, Sep 04, 2023 at 04:01:35PM -0400, Dave Cramer wrote:
> Please see attached patch to use autoconf to detect and use stdbool.h
>
> I have to admit to having no idea if this is correct or if the style is
> correct, much was copied from postgresql.

Hmm.  This patch is a copy of what PostgreSQL's c.h does.  This may be
OK in the short-term, but I think that we should try to include back
postgres_fe.h in the long-term and figure out what's happening with
b8ca812b, so as this code would be able to fetch what Postgres itself
does.
--
Michael

Вложения