0

My current use case is installing PyODBC via poetry in a Jenkins job build, which is failing because sql.h can't be found.

For background, I have two servers, one RHEL 6, one RHEL 7; the RHEL 6 server has unixODBC installed and working with (among other things) odbc.ini in /etc/, sql.h and other headers in /usr/include/.

On the non-working RHEL 7 server helpdesk personnel just installed the same version of unixODBC-dev, and all the files seem to instead be in /usr/local/unixODBC/.

I believe I correctly understand that /usr/local is for manually installed packages, which I suppose this is, but I'm not clear why these two installs would be done differently, and ultimately if there's a way to make things work on the RHEL server(, or failing that, a phrase I can give back to helpdesk to get this installed the right way.)

Edit: Following @Stephen Kitt's suggestion, I went back to HD and they supposedly installed it with yum.

Now the error is different (and quite a bit more lengthy, some seemingly repetitive lines have been clipped to fit the post length):

[EnvCommandError]                                                
Command ['/var/lib/jenkins/.cache/pypoetry/virtualenvs/ds-ops-tools-py3.6/bi  
n/python', '-m', 'pip', 'install', '--no-deps', 'pyodbc==4.0.26'] errored wi  
th the following output:                                                      
Collecting pyodbc==4.0.26                                                     
  Using cached https://files.pythonhosted.org/packages/b4/41/f3eb5e56af207a8  
fcc02f1f84cc3fed9fcf315565e65f418ae815e399929/pyodbc-4.0.26.tar.gz            
Installing collected packages: pyodbc                                         
  Running setup.py install for pyodbc: started                                
    Running setup.py install for pyodbc: finished with status 'error'         
    Complete output from command /var/lib/jenkins/.cache/pypoetry/virtualenv  
s/ds-ops-tools-py3.6/bin/python -u -c "import setuptools, tokenize;__file__=  
'/tmp/pip-build-i2_4l6cq/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 /tmp/pip-oqv50di8-record/install-record.  
txt --single-version-externally-managed --compile --install-headers /var/lib  
/jenkins/.cache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include/site/python3  
.6/pyodbc:                                                                    
    running install                                                           
    running build                                                             
    running build_ext                                                         
    building 'pyodbc' extension                                               
    creating build                                                            
    creating build/temp.linux-x86_64-3.6                                      
    creating build/temp.linux-x86_64-3.6/src                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/buffer.cpp -o build/temp.linux-x86_64-3.6/src/buffer.o -Wno-  
write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LO  
NG -DSIZEOF_LONG_INT=8 -I/usr/include                                         
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/cnxninfo.cpp -o build/temp.linux-x86_64-3.6/src/cnxninfo.o -  
Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LON  
G_LONG -DSIZEOF_LONG_INT=8 -I/usr/include                                     
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/connection.cpp -o build/temp.linux-x86_64-3.6/src/connection  
.o -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE  
_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include                                 
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    src/connection.cpp: In function ‘PyObject* Connection_getinfo(PyObject*,  
 PyObject*)’:                                                                 
    src/connection.cpp:835:40: warning: dereferencing type-punned pointer wi  
ll break strict-aliasing rules [-Wstrict-aliasing]                            
             SQLUINTEGER n = *(SQLUINTEGER*)szBuffer; // Does this work on P  
PC or do we need a union?                                                     
                                            ^                                 
    src/connection.cpp:848:49: warning: dereferencing type-punned pointer wi  
ll break strict-aliasing rules [-Wstrict-aliasing]                            
             result = PyInt_FromLong(*(SQLUSMALLINT*)szBuffer);               
                                                     ^                        
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/cursor.cpp -o build/temp.linux-x86_64-3.6/src/cursor.o -Wno-  
write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LO  
NG -DSIZEOF_LONG_INT=8 -I/usr/include                                         
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/errors.cpp -o build/temp.linux-x86_64-3.6/src/errors.o -Wno-  
write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LO  
NG -DSIZEOF_LONG_INT=8 -I/usr/include                                         
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/getdata.cpp -o build/temp.linux-x86_64-3.6/src/getdata.o -Wn  
o-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_  
LONG -DSIZEOF_LONG_INT=8 -I/usr/include                                       
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/params.cpp -o build/temp.linux-x86_64-3.6/src/params.o -Wno-  
write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LO  
NG -DSIZEOF_LONG_INT=8 -I/usr/include                                         
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/pyodbccompat.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcco  
mpat.o -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -D  
HAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include                             
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/pyodbcdbg.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcdbg.o  
 -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_L  
ONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include                                   
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcmo  
dule.o -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -D  
HAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include                             
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/row.cpp -o build/temp.linux-x86_64-3.6/src/row.o -Wno-write-  
strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DS  
IZEOF_LONG_INT=8 -I/usr/include                                               
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -  
Wall -Wstrict-prototypes -fPIC -DPYODBC_VERSION=4.0.26 -I/var/lib/jenkins/.c  
ache/pypoetry/virtualenvs/ds-ops-tools-py3.6/include -I/usr/local/include/py  
thon3.6m -c src/textenc.cpp -o build/temp.linux-x86_64-3.6/src/textenc.o -Wn  
o-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_  
LONG -DSIZEOF_LONG_INT=8 -I/usr/include                                       
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for  
 C/ObjC but not for C++ [enabled by default]                                  
    creating build/lib.linux-x86_64-3.6                                       
    g++ -pthread -shared -Wl,-rpath /usr/local/lib build/temp.linux-x86_64-3  
.6/src/buffer.o build/temp.linux-x86_64-3.6/src/cnxninfo.o build/temp.linux-  
x86_64-3.6/src/connection.o build/temp.linux-x86_64-3.6/src/cursor.o build/t  
emp.linux-x86_64-3.6/src/errors.o build/temp.linux-x86_64-3.6/src/getdata.o   
build/temp.linux-x86_64-3.6/src/params.o build/temp.linux-x86_64-3.6/src/pyo  
dbccompat.o build/temp.linux-x86_64-3.6/src/pyodbcdbg.o build/temp.linux-x86  
_64-3.6/src/pyodbcmodule.o build/temp.linux-x86_64-3.6/src/row.o build/temp.  
linux-x86_64-3.6/src/textenc.o -L/usr/lib -L/usr/local/lib -L/usr/local/lib   
-lodbc -lpython3.6m -o build/lib.linux-x86_64-3.6/pyodbc.cpython-36m-x86_64-  
linux-gnu.so -L/usr/lib64 -lodbc                                              
    /bin/ld: /usr/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32S a  
gainst symbol `_Py_NotImplementedStruct' can not be used when making a share  
d object; recompile with -fPIC                                                
    /bin/ld: /usr/lib/libpython3.6m.a(boolobject.o): relocation R_X86_64_32   
against `.data' can not be used when making a shared object; recompile with   
-fPIC                                                                         

[...]

    /bin/ld: /usr/lib/libpython3.6m.a(parser.o): relocation R_X86_64_32 agai  
nst `.rodata.str1.8' can not be used when making a shared object; recompile   
with -fPIC                                                                    
    /bin/ld: /usr/lib/libpython3.6m.a(getcompiler.o): relocation R_X86_64_32  
 against `.rodata.str1.8' can not be used when making a shared object; recom  
pile with -fPIC                                                               
    /bin/ld: final link failed: Nonrepresentable section on output            
    collect2: error: ld returned 1 exit status                                
    error: command 'g++' failed with exit status 1     

Edit: I think this is because my libpython*.so files are in /usr/local/lib rather than /usr/lib; I've added /usr/local/lib to ld.so.conf and run ldconfig but that doesn't seem to do anything.

Edit 2: I found a suggestion that renaming /usr/lib/libpython3.6m.a would allow the .so files to be 'found' and this seems to have worked! But I'm still puzzled as this exhibited symptoms first of unixODBC not being installed with the package manager (which it wasn't) and then of python not having --shared-packages enabled, which it did, but other files were overriding those packages somehow. It would be great if someone could shed light on that but I realize that it's hard to say without knowing exactly how the system was set up and manipulated by the helpdesk folks who work on it.

0
0

The installation on your RHEL 6 server was probably done using the RHEL package of UnixODBC. This is easy to replicate on your RHEL 7 server:

yum install unixODBC-devel

will install the headers, development files and all their dependencies.

We won’t be able to tell you why the two installations were performed differently; only your helpdesk can do that.

1
  • Thanks Stephen, I had helpdesk reinstall the package and the error I'm getting is different, edited in above.
    – Azide
    Jun 12 '19 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.