UnixODBC-dev는 /usr/local/에 설치되어 gcc에서 sql.h를 찾을 수 없다고 보고합니다.

UnixODBC-dev는 /usr/local/에 설치되어 gcc에서 sql.h를 찾을 수 없다고 보고합니다.

현재 사용 사례는 Jenkins 작업 빌드를 PyODBC통해 poetry설치하는 것이지만 sql.h찾을 수 없어 실패합니다.

배경으로 RHEL 6과 RHEL 7이라는 두 개의 서버가 있습니다. 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

헤더, 개발 파일 및 모든 종속성이 설치됩니다.

이 두 가지 설치가 다르게 수행되는 이유는 설명할 수 없습니다. 지원 센터에서만 해당 작업을 수행할 수 있습니다.

관련 정보