Bug 83924 - figure out ODBC ABI story on MacOS X
Summary: figure out ODBC ABI story on MacOS X
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Mac OS X (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-16 10:40 UTC by Lionel Elie Mamane
Modified: 2014-09-19 04:21 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2014-09-16 10:40:57 UTC
The ODBC API comes in two flavours, namely:
 - SQLWCHAR is 16 bit integer / UTF-16
 - SQLWCHAR is wchar_t

On Microsoft Windows, these two flavours coincide, but on most (all?) Unices, wchar_t is 32 bits (I presume UCS4).

On Unix, there are two "main" FLOSS implementations of ODBC:
 - unixodbc
 - iodbc

unixodbc defaults to "SQLWCHAR is 16 bits", but supports the 32 bits case (#define SQL_WCHART_CONVERT).
iodbc seems to support only (?) the wchar_t case.

UnixODBC in GNU/Linux distributions, by and large, AFAIK follow the UnixODBC default of 16 bit SQLWCHAR.

On MacOS X, though, older versions ship iodbc (and 32 bit SQLWCHAR); newer versions do not ship the iodbc development headers anymore.

Need to find out what the ODBC story is for newer versions of MacOS X. The crucial question is: what ABI are ODBC drivers (for MacOS X) that people will use with LibreOffice compiled for? Should find out and align. E.g.: MySQL driver, PostgreSQL driver, etc.
Comment 1 Lionel Elie Mamane 2014-09-17 02:55:51 UTC
http://www.opensource.apple.com/source/iodbc/iodbc-42.5/ (linked from http://www.opensource.apple.com/release/os-x-1094/) shows that the iODBC *libraries* are still provided by Apple, just not the headers. Thus, I expect that the standard of the iODBC ABI stays on MacOS X.

http://www.easysoft.com/developer/interfaces/odbc/64-bit.html#odbc-mac-os-x contains useful information, in particular that iODBC "upstream" distributes ODBC SDKs for MacOS X. Maybe we should just add this as an external to the LibreOffice build system and use it for MacOS X builds (instead of UnixODBC). Alternatively, we could just set SQL_WCHART_CONVERT for UnixODBC, it could work / is supposed to.
Comment 2 Alex Thurgood 2014-09-17 18:01:13 UTC
Fwiw ODBC access to my mysql local instance now works on OSX with stock TDF 4.3.1.2 and mysql 5.1 odbc connector
Comment 3 Commit Notification 2014-09-19 04:01:06 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a46bede8eebcf08c180572268e9fb5e52d0935bd

fdo#83924 align with system ODBC ABI on MacOSX: SQL_WCHAR is wchar_t



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Lionel Elie Mamane 2014-09-19 04:21:51 UTC
(In reply to comment #1)
> Alternatively, we could just set SQL_WCHART_CONVERT for UnixODBC,
> it could work / is supposed to.

I did that: on MacOS X without system ODBC headers, use our UnixODBC headers but set SQL_WCHART_CONVERT. This should work.

(plus follow-up fix: http://cgit.freedesktop.org/libreoffice/core/commit/?id=beed6cb8add346c017de212c5ee18fa786caed8b )