mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.93k stars 562 forks source link

Compilation error on 4.0.26 #533

Closed juanfcocontreras closed 3 years ago

juanfcocontreras commented 5 years ago

Environment

Clang: 9.0 build 900
Git: 2.20.1 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_202
macOS: 10.12.6-x86_64
CLT: 9.2.0.0.1.1510905681
Xcode: 9.2
XQuartz: 2.7.11 => /opt/X11

Issue

This is my first time using pyodbc, but I can't compile it. I've also tried previous version (4.0.25) with the same error. I have unixodbc installed (Homebrew). Any idea?

> clang -I/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/include/darwin -DPYODBC_VERSION=4.0.26 -UMAC_OS_X_VERSION_10_7 -I/usr/local/include -I/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/buffer.cpp -o build/temp.macosx-10.12-x86_64-3.7/src/buffer.o

In file included from src/buffer.cpp:12:
src/pyodbc.h:151:21: error: unknown type name 'BYTE'
bool pyodbc_realloc(BYTE** pp, size_t newlen);
                    ^
1 error generated.
v-makouz commented 5 years ago

Are you using setup.py to compile it?

juanfcocontreras commented 5 years ago

Hello @v-makouz

Thanks for your prompt answer. Actually, I'm trying to compile another app which depends on pyodbc, and that is the command invocation that uses:

https://github.com/OSGeo/homebrew-osgeo4mac/issues/732

Installing collected packages: pyodbc
  Created temporary directory: /private/tmp/pip-record-l39_7s7t
  Running setup.py install for pyodbc: started
    Running command /usr/local/Cellar/qgis-res/3.4.4/libexec/vendor/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-2dxzty3a/pyodbc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-l39_7s7t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/qgis-res/3.4.4/libexec/vendor/bin/../include/site/python3.7/pyodbc
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.macosx-10.12-x86_64-3.7
    creating build/temp.macosx-10.12-x86_64-3.7/src
    clang -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/include/darwin -DPYODBC_VERSION=4.0.26 -UMAC_OS_X_VERSION_10_7 -I/usr/local/include -I/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/buffer.cpp -o build/temp.macosx-10.12-x86_64-3.7/src/buffer.o -Wno-write-strings -Wno-deprecated-declarations
    In file included from src/buffer.cpp:12:
    src/pyodbc.h:151:21: error: unknown type name 'BYTE'
    bool pyodbc_realloc(BYTE** pp, size_t newlen);
                        ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    Running setup.py install for pyodbc: finished with status 'error'

Now I was trying to compile only pyodbc with the same command invocation to test if I got the same error, and the result is the same.

v-makouz commented 5 years ago

Normally BYTE is defined in /usr/local/include/sqltypes.h, which I believe installs as part of unixODBC, can you check if the definition is there?

juanfcocontreras commented 5 years ago

Yes, definition is missing!

sqltypes.h.zip

That file belongs to libiodbc-3.52.12. Actually unixodbc-2.3.7, which I have installed, contains the BYTE definition!

I'm going to remove libiodbc and try again.

Thank you so much! Please, close this issue.