UnixODBC-devは/usr/local/にインストールされ、gccでsql.hが見つからないことを報告します。

UnixODBC-devは/usr/local/にインストールされ、gccでsql.hが見つからないことを報告します。

現在のユースケースはJenkinsタスクビルドを介してPyODBCインストールpoetryすることですが、見つからないためsql.h失敗します。

背景として、RHEL 6とRHEL 7という2つのサーバーがあります。 RHEL 6サーバーにはunixODBCがインストールされており、odbc.ini何よりも/etc/sql.h/usr/include/

動作しないRHEL 7サーバーでは、ヘルプデスク担当者が同じバージョンのunixODBC-devをインストールし、すべてのファイルが/usr/local/unixODBC/

私はこれが/usr/local手動でインストールされたパッケージのものであることを正しく理解していると思います。そうですが、両方のインストールが異なる方法で行われる理由はわかりません。最終的にRHELサーバーで作業を実行する方法はありますか?または、これが不可能な場合は、ヘルプデスクにフィードバックして正しい方法でインストールできます。)

編集:@Stephen Kittの提案に従ってHDに戻ってyum

これでエラーが変わりました(非常に長くて繰り返されるように見えるいくつかの行が投稿の長さに合うように切り捨てられました)。

[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     

編集:私考えるこれは私のファイルが代わりに配置さlibpython*.soれるためです。追加して実行しましたが、何もしないようです。/usr/local/lib/usr/lib/usr/local/libld.so.confldconfig

編集2:名前を変更すると、.soファイルを「発見」できるという提案が見つかりました。/usr/lib/libpython3.6m.a動作しているようです!しかし、最初はunixODBCパッケージマネージャとしてインストールされていないという症状が表示され(そうではありません)、Pythonはアクティブになってい--shared-packagesませんが、他のファイルが何らかの方法でパッケージを上書きするため、まだ混乱しています。誰かがこれを明らかにしてくれたらとても嬉しいですが、ヘルプデスクの従業員がシステムをどのように設定して運営しているかを正確に知らないと言うのは難しいことに気づきました。

ベストアンサー1

RHEL 6サーバーのインストールは、おそらくUnixODBC用のRHELパッケージを使用して行われた可能性があります。これはRHEL 7サーバー上で簡単に複製されます。

yum install unixODBC-devel

ヘッダー、開発ファイル、およびすべての依存関係がインストールされます。

これら2つのインストールが異なる方法で行われる理由は説明できません。サポートセンターでのみ対応できます。

おすすめ記事