lurcher / unixODBC

The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
GNU Lesser General Public License v2.1
100 stars 52 forks source link

unixodbc_dev package is missing unixodbc.h #134

Closed steve962 closed 1 year ago

steve962 commented 1 year ago

I was trying to build the SQLSRV and PDO_SQLSRV drivers for PHP (https://github.com/microsoft/msphpsql) for a custom ubuntu Docker image I've been maintaining for a while which includes the unixodbc and unixodbc_dev packages, and got the following error during the build:

In file included from /usr/include/sql.h:19,
from /tmp/pear/temp/sqlsrv/shared/xplat.h:30,
from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
from /tmp/pear/temp/sqlsrv/php_sqlsrv_int.h:25,
from /tmp/pear/temp/sqlsrv/conn.cpp:24:
/usr/include/sqltypes.h:56:10: fatal error: unixodbc.h: No such file or directory
56 | #include "unixodbc.h"
     |          ^~~~~~~~~~~~
compilation terminated.

I had to go back to loading an older version of the packages that I knew worked, then started digging into this both here and in the msphpsql Github, looking for the problem. I couldn't find any issues about this and the code in both places looked good, until I finally decided to go look at contents of the actual package files being pulled into the build: unixodbc_2.3.11_amd64.deb and unixodbc-dev_2.3.11_amd64.deb.

At that point it became obvious -- when unixodbc_conf.h was broken into two files, the new file, unixodbc.h, was not added into the package build process, and is missing in newer versions of the packages.

jubalh commented 1 year ago

which includes the unixodbc and unixodbc_dev packages

AFAIK no distro has a package called unixodbc_dev only unixodbc-dev.

I had to go back to loading an older version of the packages

And older version of which package. Are you talking about deb packages from Ubuntu? If yes then why don't you open this in their bugtracker but upstream?

rpm -ql unixODBC-devel
...
/usr/include/unixODBC/config.h
/usr/include/unixODBC/unixodbc_conf.h
/usr/include/unixodbc.h
...

This is on openSUSE with unixODBC 2.3.11 and as we can see the files are there.

So I'm assuming you are reporting a downstream bug on the usptream bugtracker?

kndale commented 1 year ago

Also encountered this issue when trying to install php extensions sqlsrv and pdo_sqlsrv in Ubuntu 18.04 and Ubuntu 20.04.

Edit: Using unixodbc-dev 2.3.11

steve962 commented 1 year ago

Sorry, I did indeed mean unixodbc-dev, and hadn't realized the packages were built downstream (upstream? Not sure of the terms) from here.

Figuring out exactly which package provider was a bit of a pain, but once I did, I discovered it was Microsoft, not Ubuntu, which has the issue. Microsoft is providing their own repositories for the msodbcsql18 and mssql-tools packages, which are needed by sqlsrv and pdo_sqlsrv, and that repository is now providing the 2.3.11 version of unixodbc and unixodbc-dev... but it seems clear they're using those versions from Debian, which were initially missing the header. Ubuntu is providing 2.3.7, which doesn't have the problem, and Debian is now on 2.3.11-2, which fixed the missing header last May.

I've commented on a related thread in the msphpsql repository, which is the closest thing to this on GitHub since msodbcsql isn't here.

Closing the issue since it's not your problem. Again, sorry about that.