database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 10447 게시물 읽기
No. 10447
create extension oracle_fdw; undefined symbol 관련 에러
작성자
chaney(cy0804bamboo)
작성일
2023-11-03 09:20
조회수
1,304

Oracle에서 PostgreSQL로 마이그레이션 하는 과정에서 아래와 같이 환경정보와 파일설치, 환경변수 설정까지 완료한 상태입니다.

  • 환경정보

    • Red Hat Enterprise Linux release 8.4 (Ootpa)
    • PostgreSQL 15.0
    • Oracle Database 12c Enterprise Edition Release 12.2.0.1.0

  • 설치자료 및 다운로드 정보

    • Oracle Instant Client for Linux x86-64 (64-bit) 다운로드

      • https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

    • Postgresql 15 관련 LIbrary 파일 다운로드

      • https://download.postgresql.org/pub/reps/yum/15/redhat/rhel-8-x86_64/

    • oracle_fdw-ORACLE_FDW_2_6_0 다운로드

      • https://github.com/laurenz/oracle_fdw/releases/tag/ORACLE_FDW_2_6_0

  • 환경변수 설정

    • export PG_HOME=/usr/pgsql-15
    • export ORACLE_HOME=/usr/lib/oracle/12.2/client64
    • export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LB_LIBRARY_PATH
    • export PATH=$LD_LIBRARY_PATH:$PG_HOME/lib:$PG_HOME/bin:$ORACLE_HOME/bin:$PATH

 

 



아래부터 에러 항목입니다.


1. make를 실행했을 때,


[postgres@...oracle_fdw-ORACLE_FDW_2_6_0]$ make

oracle_fdw.c: In function 'oraclePlanForeignModify':

oracle_fdw.c:1589:18: warning: implicit declaration of function 'get_rel_all_updated_cols'; did you mean 'get_rel_tablespace'? [-Wimplicit-function-declaration]

oracle_fdw.c:1589:16: warning: assignment to 'Bitmapset *' {aka 'struct Bitmapset *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]


위와 같은 경고가 뜹니다.


2. psql에서 CREATE EXTENSION oracle_fdw; 실행


postgres=# CREATE EXTENSION oracle_fdw;

ERROR: could not load library "/usr/pgsql-15/lib/oracle_fdw.so": /usr/pgsql-15/lib/oracle_fdw.so: undefined symbol: get_rel_all_updated_cols


위와 같은 에러가 뜹니다.


비슷한 상황은 겪어보신 분들 도움 부탁드립니다.

이 글에 대한 댓글이 총 8건 있습니다.

15버전 해더를 사용하지 않은 것 같습니다.

(아니면, 15.0 버전의 버그이거나)

먼저 postgresql15-devel 패키지가 설치 되어있는지 확인해보시고,


make 하기전


type pg_config


명령으로

그 결과 /usr/pgsql-15/bin/pg_config

가 나오는지 확인하셔야 할 것 같습니다.

이렇게 나오지 않는다면,

PATH=/usr/pgsql-15/bin:$PATH

로 바꿔 pg_config 를 /usr/pgsql-15 안에 있는 것을 쓰게 만들고,

pg_config --includedir

/usr/pgsql-15/include 가 나오는지 확인해보시고,

이 모든게 정확함에도 불구하고, 이 문제가 계속 나온다면,


oracle_fdw.c 를 컴파일 할 때 소스의 include 부분에서 왜

#include "optimizer/inherit.h"

이 줄이 건너뛰었는지 원인을 찾아야 할 것 같네요.



 

김상기(ioseph)님이 2023-11-03 14:27에 작성한 댓글입니다.

type pg_config 결과, /usr/pgsql-15/bin/pg_config로 정확하게 나오네요.


#include "optimizer/inherit.h" 부분도 확인해보겠습니다.

chaney님이 2023-11-06 09:48에 작성한 댓글입니다. Edit

김상기(ioseph) 선생님, 헤더파일 부분도 확인해봤는데 건너뛸 이유가 전혀없는데(조건문 만족) 어떤게 문제일까요?

chaney님이 2023-11-07 10:57에 작성한 댓글입니다. Edit

make 전과정 로그를 올려주세요.

제가 빌드한거라 어떤 차이가 있는지 확인해보게요.


rpm -qa | grep postgresql

결과도 함께 알려주셔야 문제를 찾는데 도움이 될 것 같습니다.

김상기(ioseph)님이 2023-11-08 16:16에 작성한 댓글입니다.

도움주셔서 너무 감사 드립니다.

make 과정 내용 및 rpm -qa 결과 첨부합니다.


[ rpm -qa  결과 ]

[postgres@10-100-12-70 oracle_fdw-ORACLE_FDW_2_6_0]$ rpm -qa | grep postgresql

postgresql15-devel-15.0-1PGDG.rhel8.x86_64

postgresql15-server-15.0-1PGDG.rhel8.x86_64

postgresql15-contrib-15.0-1PGDG.rhel8.x86_64

postgresql15-15.0-1PGDG.rhel8.x86_64

postgresql15-libs-15.0-1PGDG.rhel8.x86_64

postgresql-server-devel-10.21-2.module+el8.4.0+15341+25c9f2fe.x86_64


[ make 실행결과 ]

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I"/usr/lib/oracle/12.2/client64/sdk/include" -I"/usr/lib/oracle/12.2/client64/oci/include" -I"/usr/lib/oracle/12.2/client64/rdbms/public" -I"/usr/lib/oracle/12.2/client64/" -I/usr/include/oracle/12.2/client64 -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o oracle_fdw.o oracle_fdw.c

oracle_fdw.c: In function ‘oraclePlanForeignModify’:

oracle_fdw.c:1589:18: warning: implicit declaration of function ‘get_rel_all_updated_cols’; did you mean ‘get_rel_tablespace’? [-Wimplicit-function-declaration]

   updated_cols = get_rel_all_updated_cols(root, roi);

                  ^~~~~~~~~~~~~~~~~~~~~~~~

                  get_rel_tablespace

oracle_fdw.c:1589:16: warning: assignment to ‘Bitmapset *’ {aka ‘struct Bitmapset *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]

   updated_cols = get_rel_all_updated_cols(root, roi);

                ^

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I"/usr/lib/oracle/12.2/client64/sdk/include" -I"/usr/lib/oracle/12.2/client64/oci/include" -I"/usr/lib/oracle/12.2/client64/rdbms/public" -I"/usr/lib/oracle/12.2/client64/" -I/usr/include/oracle/12.2/client64 -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o oracle_utils.o oracle_utils.c

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I"/usr/lib/oracle/12.2/client64/sdk/include" -I"/usr/lib/oracle/12.2/client64/oci/include" -I"/usr/lib/oracle/12.2/client64/rdbms/public" -I"/usr/lib/oracle/12.2/client64/" -I/usr/include/oracle/12.2/client64 -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o oracle_gis.o oracle_gis.c

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -shared -o oracle_fdw.so oracle_fdw.o oracle_utils.o oracle_gis.o -L/usr/pgsql-15/lib  -Wl,--as-needed -L/usr/lib64 -L/usr/lib  -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-15/lib',--enable-new-dtags  -L"/usr/lib/oracle/12.2/client64/" -L"/usr/lib/oracle/12.2/client64/bin" -L"/usr/lib/oracle/12.2/client64/lib" -L"/usr/lib/oracle/12.2/client64/lib/amd64" -L/usr/lib/oracle/12.2/client64/lib -lclntsh


 

chaney님이 2023-11-09 10:18에 작성한 댓글입니다.
이 댓글은 2023-11-09 10:22에 마지막으로 수정되었습니다. Edit

예상했던 대로네요.


rpm -e postgresql-server-devel-10.21-2.module+el8.4.0+15341+25c9f2fe.x86_64


로 해당 패키지를 지우셔야해요.


컴파일에 필요한 header 파일들이 /usr/include 에도 있고,

/usr/pgsql-15/include 에도 있는데, /usr/include 것을 먼저 읽어 저런 문제가 발생한 것 같네요.

 

김상기(ioseph)님이 2023-11-09 10:25에 작성한 댓글입니다.

말씀해 주신 패키지 제거 후 

make clean 후

make 재실행 했지만 결과는 동일하게 나타납니다.

혹 확인해야할 다른 패키지들이 있을까요?



 

chaney님이 2023-11-09 13:42에 작성한 댓글입니다. Edit

제가 만든 것 올려드립니다. 


OS : Rocky Linux 8 

아키텍처: x86_64

PostgreSQL 버전: 15.4 (15 버전은 아무거나 될 것 것으로 예상합니다.)

Oracle client 버전: 12.2



curl -OLJ https://github.com/i0seph/oracle_fdw/raw/master/binary/rhel8/x86_64/oracle_fdw-2.6.0.pg15.rhel8.x86_64.tar.gz


cd /


tar xf 받은파일경로


 dnf install -y libnsl.x86_64

 dnf install -y libaio.x86_64


cd $ORACLE_HOME

ln -s libclntsh.so.12.1 libclntsh.so


su - postgres

export LD_LIBRARY_PATH=오라클라이브러리있는디렉터리

pg_ctl stop

pg_ctl start


DB 기동 관련을 해서는 알아서 잘 설정하시고.... (systemctl 로 처리할 계획이라면, 그 시작 스크립트에 LD_LIBRARY_PATH 설정이 있어야 할 것 같네요.)

김상기(ioseph)님이 2023-11-09 20:08에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
10453분단위 시계열 데이터의 empty 값 처리 [2]
전성용
2023-12-08
892
10452DB 계정 잠금 설정 질문입니다 [3]
소라77
2023-12-08
1002
10449인덱스걸면 제일빠른 데이타 타입 순서가 어떻게되나요? [3]
이기자
2023-11-28
940
10447create extension oracle_fdw; undefined symbol 관련 에러 [8]
chaney
2023-11-03
1304
10446쿼리 실행 계획 buffers [1]
신현근
2023-10-27
1193
10445한자(중국어) 저장시 일부 문자가 깨집니다 ㅜ.ㅜ [8]
이기자
2023-10-24
1301
10443세로로 조회된 성적 데이타를 날짜별로 가로로 나타내고 싶습니다. 날짜별로 과목 수 다를수있음.. [1]
이기자
2023-10-19
1248
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다