psqlodbc: HEAD fails to build with recent clang

Started by Alex Dunnalmost 11 years ago5 messagesbugs
Jump to latest
#1Alex Dunn
dunn.alex@gmail.com

Beginning (I think) in Mavericks, Clang has begun taking functions and
defining them as macros; they then conflict with declarations via
headers. I think this is what's happening with `strlcat` in the most
recent psqlodbc, since it builds fine with GCC.

Here are the build logs with system info (errors start at L15 of 03.make):
https://gist.github.com/dunn/f6ed7ac29a23aa06ba65#file-03-make-L15

Clang is: Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)

—Alex Dunn

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Alex Dunn (#1)
Re: psqlodbc: HEAD fails to build with recent clang

On 5/6/15 12:07 AM, Alex Dunn wrote:

Beginning (I think) in Mavericks, Clang has begun taking functions and
defining them as macros; they then conflict with declarations via
headers. I think this is what's happening with `strlcat` in the most
recent psqlodbc, since it builds fine with GCC.

I think you want this mailing list:
http://www.postgresql.org/list/pgsql-odbc/

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Alex Dunn (#1)
Re: psqlodbc: HEAD fails to build with recent clang

On 05/06/2015 07:07 AM, Alex Dunn wrote:

Beginning (I think) in Mavericks, Clang has begun taking functions and
defining them as macros; they then conflict with declarations via
headers. I think this is what's happening with `strlcat` in the most
recent psqlodbc, since it builds fine with GCC.

Here are the build logs with system info (errors start at L15 of 03.make):
https://gist.github.com/dunn/f6ed7ac29a23aa06ba65#file-03-make-L15

Clang is: Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)

Hmm, I think this is because there's a typo in our misc.h header file
(it was checking HAVE_STRLCPY instead of HAVE_STRLCAT), and because of
the typo it always defines a prototype for strlcat(), even when the
system provides that function. And that prototype then conflicts with
the one from the system headers.

I've pushed a fix to that, I hope it fixed the build for you.

- Heikki

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#4Alex Dunn
dunn.alex@gmail.com
In reply to: Heikki Linnakangas (#3)
Re: psqlodbc: HEAD fails to build with recent clang

That fixes it, at least on my system. Thanks!

On Thu, May 07, 2015 at 02:25:49AM +0300, Heikki Linnakangas wrote:

On 05/06/2015 07:07 AM, Alex Dunn wrote:

Beginning (I think) in Mavericks, Clang has begun taking functions and
defining them as macros; they then conflict with declarations via
headers. I think this is what's happening with `strlcat` in the most
recent psqlodbc, since it builds fine with GCC.

Here are the build logs with system info (errors start at L15 of 03.make):
https://gist.github.com/dunn/f6ed7ac29a23aa06ba65#file-03-make-L15

Clang is: Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)

Hmm, I think this is because there's a typo in our misc.h header file (it
was checking HAVE_STRLCPY instead of HAVE_STRLCAT), and because of the typo
it always defines a prototype for strlcat(), even when the system provides
that function. And that prototype then conflicts with the one from the
system headers.

I've pushed a fix to that, I hope it fixed the build for you.

- Heikki

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#5Bruce Momjian
bruce@momjian.us
In reply to: Heikki Linnakangas (#3)
Re: psqlodbc: HEAD fails to build with recent clang

On Thu, May 7, 2015 at 02:25:49AM +0300, Heikki Linnakangas wrote:

On 05/06/2015 07:07 AM, Alex Dunn wrote:

Beginning (I think) in Mavericks, Clang has begun taking functions and
defining them as macros; they then conflict with declarations via
headers. I think this is what's happening with `strlcat` in the most
recent psqlodbc, since it builds fine with GCC.

Here are the build logs with system info (errors start at L15 of 03.make):
https://gist.github.com/dunn/f6ed7ac29a23aa06ba65#file-03-make-L15

Clang is: Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)

Hmm, I think this is because there's a typo in our misc.h header
file (it was checking HAVE_STRLCPY instead of HAVE_STRLCAT), and
because of the typo it always defines a prototype for strlcat(),
even when the system provides that function. And that prototype then
conflicts with the one from the system headers.

I've pushed a fix to that, I hope it fixed the build for you.

Offlist, I didn't know you were working on ODBC --- very good.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs