openlink / iODBC

An open-source ODBC driver manager and SDK that facilitates the development of database-independent applications on linux, freebsd, unix and MacOS X platforms.
http://www.iodbc.org/
Other
162 stars 52 forks source link

macOS installed headers include non-existing files (e.g. <iODBC/sqltypes.h>) #92

Open PerMildner opened 12 months ago

PerMildner commented 12 months ago

Running the installer ODBC-SDK-3.52.16-macOS11.dmg (on macOS 12.7 Intel) creates header files in /Library/Frameworks/iODBC.framework/Versions/3.52/Headers/.

The installed headers, e.g. sql.h contain include statements like: #include <iODBC/sqltypes.h> This will not work, since there is no iODBC directory.

The effect is that it is not possible to compile against the installed header files, making the macOS installer unusable.

Since the including files and the files they attempt to include are all in the same directory, one possible fix is to replace any occurrence of #include <iODBC/some_file.h> with #include "some_file.h", i.e. without "system-brackets" and without referring to the missing directory iODBC.

This is an old bug, and has been reported before.

PerMildner commented 12 months ago

Update: I now notice that the headers installed in /usr/local/iODBC/include/ does not use the indirection via iODBC (but still use the "system-brackets", which seems fishy unless it is intentional that /usr/local/iODBC/include/sqlext.h should be able to include some other "system version" of sql.h than the one in /usr/local/iODBC/include/).

PerMildner commented 12 months ago

(I looked for details about how to use the headers in Developing ODBC Compliant Applications but it does not provide any such details and seems quite dated.)

pkleef commented 12 months ago

I will have a look and report back to you...

PerMildner commented 12 months ago

The workaround we used before to be able to use cc ... -I /Library/Frameworks/iODBC.framework/Versions/3.52/Headers was to do the following after installation:

cd /Library/Frameworks/iODBC.framework/Versions/3.52/Headers && sudo ln -s . iODBC

i.e. create a symbolic link so iODBC/*.h can be found. I think we could also use cc ... -I/usr/local/iODBC/include since those headers does not try to use a iODBC directory.

PerMildner commented 12 months ago

This is more or less a duplicate of issue #17. As a result of that the /usr/local/iODBC/include files have been fixed (to avoid iODBC), so they can be used which makes them the proper include files for a UNIX-style build on macOS.

(Some documentation on how to build against the installed iODBC on macOS would be nice, though).