Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODBC driver build fails on Mac OS X due to a conflicting types for the SQLColAttribute with the unixODBC library #3452

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working Client interfaces normal

Comments

@monetdb-team
Copy link

Date: 2014-03-05 13:14:06 +0100
From: @dnedev
To: clients devs <>
Version: 11.17.9 (Jan2014)

Last updated: 2014-03-11 09:19:35 +0100

Comment 19671

Date: 2014-03-05 13:14:06 +0100
From: @dnedev

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.74.9 (KHTML, like Gecko) Version/7.0.2 Safari/537.74.9
Build Identifier:

ODBC driver build fails on OS X Mavericks due to a conflicting types for the SQLColAttribute in the UnixODBC library.
The error is the following:
ibtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../../clients/odbc/driver -I../../.. -I../../../../clients/odbc/driver -I../../mapilib -I../../../../clients/odbc/driver/../../mapilib -I../../../common/options -I../../../../clients/odbc/driver/../../../common/options -I/opt/local/include -DLIBMONETODBC -g -O2 -I/opt/local/include -c ../../../../clients/odbc/driver/SQLColAttributes.c -fno-common -DPIC -o .libs/libMonetODBC_la-SQLColAttributes.o
../../../../clients/odbc/driver/SQLColAttribute.c:243:1: error: conflicting types for 'SQLColAttribute'
SQLColAttribute(SQLHSTMT StatementHandle,
^
/opt/local/include/sql.h:609:24: note: previous declaration is here
SQLRETURN SQL_API SQLColAttribute(SQLHSTMT StatementHandle,
^
../../../../clients/odbc/driver/SQLColAttribute.c:272:1: error: conflicting types for 'SQLColAttributeA'
SQLColAttributeA(SQLHSTMT StatementHandle,
^
/opt/local/include/sqlucode.h:377:19: note: previous declaration is here
SQLRETURN SQL_API SQLColAttributeA(
^
../../../../clients/odbc/driver/SQLColAttribute.c:290:1: error: conflicting types for 'SQLColAttributeW'
SQLColAttributeW(SQLHSTMT StatementHandle,
^
/opt/local/include/sqlucode.h:29:19: note: previous declaration is here
SQLRETURN SQL_API SQLColAttributeW(
^
3 errors generated.
make[7]: *** [libMonetODBC_la-SQLColAttribute.lo] Error 1

Reproducible: Always

Steps to Reproduce:

  1. Download latest sources
  2. Configure
  3. Make

Actual Results:

Build succeeds

Expected Results:

Build fails

The error was eventually traced to an API change in the unixODBC library:
In the MonetDB/clients/odbc/driver/SQLColAttribute.c for the SQLColAttribute, SQLColAttributeA, SQLColAttributeW functions, the last parameter (NumericAttributePtr) is of type LENP_OR_POINTER_T.
In the latest unixODBC that parameter is of type (SQLLEN *).

I am running (Mac) OS X 10.6
Xcode 5.0.2 (Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn))
unixODBC 2.3.1_0 installed from MacPorts 2.2.1

Comment 19672

Date: 2014-03-05 13:14:56 +0100
From: @dnedev

I'll try to identify in which version of the unixODBC library was the change introduced.

Comment 19673

Date: 2014-03-05 13:18:46 +0100
From: @sjoerdmullender

There is a check in configure.ag for just this thing. The type LENP_OR_POINTER_T doesn't actually exist but is defined to be either SQLLEN * or SQLPOINTER depending on the configure test. It seems the test doesn't work as expected.
Can you check your config.log file for the relevant test, or else attach the file here?

Comment 19674

Date: 2014-03-05 13:24:51 +0100
From: @dnedev

Created attachment 276
config.log

Attaching the config.log

Attached file: config.log (application/octet-stream, 411925 bytes)
Description: config.log

Comment 19675

Date: 2014-03-05 13:52:27 +0100
From: @dnedev

There is indeed an error for this test in the config.log

configure:21028: checking checking whether SQLColAttribute uses SQLLEN * or SQLPOINTER
configure:21053: gcc -c -g -O2 conftest.c >&5
conftest.c:68:14: fatal error: 'sql.h' file not found
include <sql.h>
^
1 error generated.

Comment 19676

Date: 2014-03-05 14:14:16 +0100
From: MonetDB Mercurial Repository <>

Changeset 0c281aca4f71 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=0c281aca4f71

Changeset description:

Set CPPFLAGS before running the compiler.
This hopefully fixes bug #3452.

Comment 19677

Date: 2014-03-05 14:15:10 +0100
From: @sjoerdmullender

Can you try out the latest version in Mercurial?

Comment 19678

Date: 2014-03-05 14:35:49 +0100
From: @dnedev

Unfortunately I cannot currently build the default branch on OS X, due to another issue:
clang: error: argument unused during compilation: '-pthread'

But applied the change over the MonetDB-11.17.11 build I used originally. After cleaning, it still failed with the same error and the 'sql.h' file not found is still present in the config.log.

Comment 19679

Date: 2014-03-05 15:00:19 +0100
From: @sjoerdmullender

Did you recreate configure after changing configure.ag?

Comment 19680

Date: 2014-03-05 15:06:22 +0100
From: @dnedev

Yep. Executed in that order:
make clean
patch
../configure --prefix=/Users/dnedev/monetdb/installation --with-unixodbc=/opt/local --with-sphinxclient=/opt/local --with-readline=/opt/local
make -j4

Comment 19681

Date: 2014-03-05 15:12:32 +0100
From: @sjoerdmullender

Sorry, that doesn't patch configure, just configure.ag. You need to run bootstrap to create configure.ac from configure.ag, and configure from configure.ac. Whether bootstrap actually works when using the tar ball sources, I don't know.

I'd recommend trying:
hg clone -u Jan2014 http://dev.monetdb.org/MonetDB
cd MonetDB
./bootstrap
./configure ...
make ...

Comment 19682

Date: 2014-03-05 15:15:39 +0100
From: @sjoerdmullender

./bootstrap does work from the tar ball.

Comment 19683

Date: 2014-03-05 15:28:32 +0100
From: @dnedev

Got it. Cleaning the build, re-running bootstrap, re-configuring does it. The ODBC driver now builds successfully.

Just to note - the clang -pthread issue is also present on the Jan2014 branch.

Comment 19695

Date: 2014-03-11 09:19:35 +0100
From: @sjoerdmullender

Jan2014-SP1 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client interfaces normal
Projects
None yet
Development

No branches or pull requests

2 participants