public inbox for [email protected]  
help / color / mirror / Atom feed
Psqlodbc build fails on linux
9+ messages / 3 participants
[nested] [flat]

* Psqlodbc build fails on linux
@ 2023-08-31 01:28 Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Moazzum Ali @ 2023-08-31 01:28 UTC (permalink / raw)
  To: pgsql-odbc

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

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
@ 2023-09-03 23:45 ` Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Michael Paquier @ 2023-09-03 23:45 UTC (permalink / raw)
  To: Moazzum Ali <[email protected]>; +Cc: pgsql-odbc

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


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
@ 2023-09-04 14:23   ` Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Dave Cramer @ 2023-09-04 14:23 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Moazzum Ali <[email protected]>; pgsql-odbc

On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]> 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


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
@ 2023-09-04 16:07     ` Dave Cramer <[email protected]>
  2023-09-04 16:27       ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Dave Cramer @ 2023-09-04 16:07 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Moazzum Ali <[email protected]>; pgsql-odbc

On Mon, 4 Sept 2023 at 10:23, Dave Cramer <[email protected]> wrote:

>
>
> On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]> 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
>


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
@ 2023-09-04 16:27       ` Moazzum Ali <[email protected]>
  2023-09-04 17:53         ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Moazzum Ali @ 2023-09-04 16:27 UTC (permalink / raw)
  To: Dave Cramer <[email protected]>; +Cc: Michael Paquier <[email protected]>; pgsql-odbc

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 <[email protected]> wrote:

>
>
> On Mon, 4 Sept 2023 at 10:23, Dave Cramer <[email protected]>
> wrote:
>
>>
>>
>> On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]>
>> 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
>>
>


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:27       ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
@ 2023-09-04 17:53         ` Dave Cramer <[email protected]>
  2023-09-04 17:55           ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Dave Cramer @ 2023-09-04 17:53 UTC (permalink / raw)
  To: Moazzum Ali <[email protected]>; +Cc: Michael Paquier <[email protected]>; pgsql-odbc

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 <[email protected]>
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 <[email protected]>
> wrote:
>
>>
>>
>> On Mon, 4 Sept 2023 at 10:23, Dave Cramer <[email protected]>
>> wrote:
>>
>>>
>>>
>>> On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]>
>>> 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
>>>
>>


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:27       ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-04 17:53         ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
@ 2023-09-04 17:55           ` Moazzum Ali <[email protected]>
  2023-09-04 20:01             ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Moazzum Ali @ 2023-09-04 17:55 UTC (permalink / raw)
  To: Dave Cramer <[email protected]>; +Cc: Michael Paquier <[email protected]>; pgsql-odbc

Thanks Dave and Michael.

On Mon, Sep 4, 2023, 10:54 PM Dave Cramer <[email protected]> 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 <[email protected]>
> 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 <[email protected]>
>> wrote:
>>
>>>
>>>
>>> On Mon, 4 Sept 2023 at 10:23, Dave Cramer <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]>
>>>> 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
>>>>
>>>


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:27       ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-04 17:53         ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 17:55           ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
@ 2023-09-04 20:01             ` Dave Cramer <[email protected]>
  2023-09-05 04:11               ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Dave Cramer @ 2023-09-04 20:01 UTC (permalink / raw)
  To: Moazzum Ali <[email protected]>; +Cc: Michael Paquier <[email protected]>; pgsql-odbc

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 <[email protected]>
wrote:

> Thanks Dave and Michael.
>
> On Mon, Sep 4, 2023, 10:54 PM Dave Cramer <[email protected]>
> 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 <[email protected]>
>> 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 <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Mon, 4 Sept 2023 at 10:23, Dave Cramer <[email protected]>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Sun, 3 Sept 2023 at 19:46, Michael Paquier <[email protected]>
>>>>> 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
>>>>>
>>>>


Attachments:

  [application/octet-stream] 0001-Use-autoconf-to-check-for-stdbool.h.patch (1.9K, 3-0001-Use-autoconf-to-check-for-stdbool.h.patch)
  download | inline diff:
From 13da6d288e94a2331f2efde2bd850202ee9286c0 Mon Sep 17 00:00:00 2001
From: Ubuntu <[email protected]>
Date: Mon, 4 Sep 2023 19:57:41 +0000
Subject: [PATCH] Use autoconf to check for stdbool.h Committer: Dave Cramer
 <[email protected]>

---
 configure.ac | 14 ++++++++++++++
 psqlodbc.h   | 22 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/configure.ac b/configure.ac
index 6fd91cc..c20ffc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,19 @@ AC_CHECK_SIZEOF(void *)
 AC_CHECK_TYPES([long long])
 AC_CHECK_TYPES([signed char])
 AC_CHECK_TYPES([ssize_t])
+
+AC_CHECK_SIZEOF([bool], [],
+[#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif])
+
+dnl We use <stdbool.h> if we have it and it declares type bool as having
+dnl size 1.  Otherwise, c.h will fall back to declaring bool as unsigned char.
+if test "$ac_cv_header_stdbool_h" = yes -a "$ac_cv_sizeof_bool" = 1; then
+  AC_DEFINE([PG_USE_STDBOOL], 1,
+            [Define to 1 to use <stdbool.h> to define type bool.])
+fi
+
 AC_TYPE_SIZE_T
 
 # Check if "-Wall" is valid
@@ -240,6 +253,7 @@ AC_CHECK_LIB(pq, PQsetSingleRowMode, [],
 AC_CHECK_HEADERS(locale.h sys/time.h uchar.h)
 AC_CHECK_HEADER(libpq-fe.h,,[AC_MSG_ERROR([libpq header not found])])
 AC_HEADER_TIME
+AC_HEADER_STDBOOL
 
 
 # 4. Types(all members were moved to 0.)
diff --git a/psqlodbc.h b/psqlodbc.h
index ca8bab5..1677d0a 100644
--- a/psqlodbc.h
+++ b/psqlodbc.h
@@ -253,6 +253,28 @@ typedef double SDOUBLE;
 #endif /* CALLBACK */
 #endif /* WIN32 */
 
+#ifndef __cplusplus
+
+#ifdef PG_USE_STDBOOL
+#include <stdbool.h>
+#else
+
+#ifndef bool
+typedef unsigned char bool;
+#endif
+
+#ifndef true
+#define true	((bool) 1)
+#endif
+
+#ifndef false
+#define false	((bool) 0)
+#endif
+
+#endif							/* not PG_USE_STDBOOL */
+#endif							/* not C++ */
+
+
 #ifndef WIN32
 #define stricmp strcasecmp
 #define strnicmp strncasecmp
-- 
2.34.1



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Psqlodbc build fails on linux
  2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-03 23:45 ` Re: Psqlodbc build fails on linux Michael Paquier <[email protected]>
  2023-09-04 14:23   ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:07     ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 16:27       ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-04 17:53         ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
  2023-09-04 17:55           ` Re: Psqlodbc build fails on linux Moazzum Ali <[email protected]>
  2023-09-04 20:01             ` Re: Psqlodbc build fails on linux Dave Cramer <[email protected]>
@ 2023-09-05 04:11               ` Michael Paquier <[email protected]>
  0 siblings, 0 replies; 9+ messages in thread

From: Michael Paquier @ 2023-09-05 04:11 UTC (permalink / raw)
  To: Dave Cramer <[email protected]>; +Cc: Moazzum Ali <[email protected]>; pgsql-odbc

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


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2023-09-05 04:11 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 01:28 Psqlodbc build fails on linux Moazzum Ali <[email protected]>
2023-09-03 23:45 ` Michael Paquier <[email protected]>
2023-09-04 14:23   ` Dave Cramer <[email protected]>
2023-09-04 16:07     ` Dave Cramer <[email protected]>
2023-09-04 16:27       ` Moazzum Ali <[email protected]>
2023-09-04 17:53         ` Dave Cramer <[email protected]>
2023-09-04 17:55           ` Moazzum Ali <[email protected]>
2023-09-04 20:01             ` Dave Cramer <[email protected]>
2023-09-05 04:11               ` Michael Paquier <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox