cancel
Showing results for 
Search instead for 
Did you mean: 

Error with ECPG

SOLVED
Silver Adventurer

Error with ECPG

hi all, i have a problem with ecpg program.

 

when i execute, i got : 

make pro
ecpg  -c -I/opt/edb/as10/include pro.pgc
cc -I/opt/edb/as10/include -g   -c -o pro.o pro.c
cc -g  pro.o  -L /opt/edb/as10/lib -lecpg -lpq -o pro
/usr/bin/ld: warning: libpgtypes.so.3, needed by /opt/edb/as10/lib/libecpg.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libssl.so.1.0.0, needed by /opt/edb/as10/lib/libpq.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /opt/edb/as10/lib/libpq.so, not found (try using -rpath or -rpath-link)
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_set_ex_data'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_connect'
/opt/edb/as10/lib/libpq.so: undefined reference to `BIO_s_socket'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_set_bio'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_STORE_load_locations'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA224_Final'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPEStimestamp_from_asc'
/opt/edb/as10/lib/libpq.so: undefined reference to `sk_free'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESdate_to_asc'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA512_Final'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_get_current_compression'
/opt/edb/as10/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback'
/opt/edb/as10/lib/libpq.so: undefined reference to `ASN1_STRING_length'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA512_Init'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_NAME_get_index_by_NID'
/opt/edb/as10/lib/libpq.so: undefined reference to `sk_value'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_ctrl'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_load_error_strings'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CIPHER_get_bits'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_check_private_key'
/opt/edb/as10/lib/libpq.so: undefined reference to `CRYPTO_get_id_callback'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_STORE_set_flags'
/opt/edb/as10/lib/libpq.so: undefined reference to `BIO_clear_flags'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESinterval_copy'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_use_PrivateKey_file'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_get_peer_certificate'
/opt/edb/as10/lib/libpq.so: undefined reference to `BIO_new'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_get_subject_name'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_free'
/opt/edb/as10/lib/libpq.so: undefined reference to `ERR_clear_error'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_NAME_get_entry'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA256_Init'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_to_asc'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_copy'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_get_ext_d2i'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESdate_from_asc'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_from_asc'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_new'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA512_Update'
/opt/edb/as10/lib/libpq.so: undefined reference to `BIO_set_flags'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_read'
/opt/edb/as10/lib/libpq.so: undefined reference to `RAND_bytes'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESinterval_to_asc'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_pending'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_get_current_cipher'
/opt/edb/as10/lib/libpq.so: undefined reference to `ENGINE_load_private_key'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_new'
/opt/edb/as10/lib/libpq.so: undefined reference to `CRYPTO_num_locks'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA384_Final'
/opt/edb/as10/lib/libpq.so: undefined reference to `ENGINE_finish'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CIPHER_get_name'
/opt/edb/as10/lib/libpq.so: undefined reference to `ERR_get_error'
/opt/edb/as10/lib/libpq.so: undefined reference to `ERR_reason_error_string'
/opt/edb/as10/lib/libpq.so: undefined reference to `sk_num'
/opt/edb/as10/lib/libpq.so: undefined reference to `ASN1_STRING_data'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA256_Update'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_library_init'
/opt/edb/as10/lib/libpq.so: undefined reference to `CRYPTO_get_locking_callback'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA256_Final'
/opt/edb/as10/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_new'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_write'
/opt/edb/as10/lib/libpq.so: undefined reference to `OPENSSL_config'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_from_decimal'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_to_decimal'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA224_Update'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_free'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_set_verify'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPEStimestamp_to_asc'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA224_Init'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_shutdown'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA384_Init'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_get_version'
/opt/edb/as10/lib/libpq.so: undefined reference to `ENGINE_free'
/opt/edb/as10/lib/libpq.so: undefined reference to `BIO_int_ctrl'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_use_PrivateKey'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_ctrl'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESinterval_from_asc'
/opt/edb/as10/lib/libecpg.so: undefined reference to `PGTYPESnumeric_free'
/opt/edb/as10/lib/libpq.so: undefined reference to `SHA384_Update'
/opt/edb/as10/lib/libpq.so: undefined reference to `X509_NAME_ENTRY_get_data'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_get_error'
/opt/edb/as10/lib/libpq.so: undefined reference to `ENGINE_by_id'
/opt/edb/as10/lib/libpq.so: undefined reference to `ERR_put_error'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSL_CTX_free'
/opt/edb/as10/lib/libpq.so: undefined reference to `ENGINE_init'
/opt/edb/as10/lib/libpq.so: undefined reference to `SSLv23_method'
collect2: error: ld returned 1 exit status
make: *** [pro] Error 1
rm pro.o pro.c

my makefile:

INCLUDES = -I$(shell pg_config --includedir)
LIBPATH = -L $(shell pg_config --libdir)
CFLAGS += $(INCLUDES) -g
LDFLAGS += -g
LDLIBS += $(LIBPATH) -lecpg -lpq

.SUFFIXES: .pgc
.pgc.c:
       	ecpg  -c $(INCLUDES) $?

 

pg_config

 pg_config
BINDIR = /opt/edb/as10/bin
DOCDIR = /opt/edb/as10/doc
HTMLDIR = /opt/edb/as10/doc
INCLUDEDIR = /opt/edb/as10/include
PKGINCLUDEDIR = /opt/edb/as10/include
INCLUDEDIR-SERVER = /opt/edb/as10/include/server
LIBDIR = /opt/edb/as10/lib
PKGLIBDIR = /opt/edb/as10/lib
LOCALEDIR = /opt/edb/as10/share/locale
MANDIR = /opt/edb/as10/share/man
SHAREDIR = /opt/edb/as10/share
SYSCONFDIR = /opt/edb/as10/etc
PGXS = /opt/edb/as10/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-icu' '--enable-debug' '--with-libs=/opt/local/Current/lib:/mnt/hgfs/edb-postgres.auto/server/source/libmm-edb.linux-x64/inst/lib' '--with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/mnt/hgfs/edb-postgres.auto/server/source/libmm-edb.linux-x64/inst/include' '--prefix=/mnt/hgfs/edb-postgres.auto/server/staging/linux-x64.build/server' '--with-libcurl' '--with-ldap' '--with-openssl' '--with-perl' '--with-python' '--with-tcl' '--with-libmemcached' '--with-tclconfig=/opt/local/edb/languagepack-10/Tcl-8.6/lib' '--with-pam' '--with-krb5' '--enable-thread-safety' '--with-libxml' '--with-ossp-uuid' '--with-oci=/opt/oracle_10.2/include' '--with-odbc=/opt/local/Current/include' '--docdir=/mnt/hgfs/edb-postgres.auto/server/staging/linux-x64.build/server/doc' '--with-libxslt' '--with-libedit-preferred' '--with-gssapi' '--with-pgport=5444' '--enable-nls' 'LD_LIBRARY_PATH=/opt/local/Current/lib' 'CFLAGS=-DLINUX_OOM_ADJ=0 -O2 -DMAP_HUGETLB=0x40000' 'ICU_CFLAGS=-I/opt/local/Current/include' 'ICU_LIBS=-L/opt/local/Current/lib -licuuc -licudata -licui18n'
CC = gcc
CPPFLAGS = -DFRONTEND -I/opt/local/Current/include -D_GNU_SOURCE -I/opt/local/20160428/649c6f94-f2c0-4703-b065-99d58ae4acc6/include/libxml2 -I/opt/local/20160428/649c6f94-f2c0-4703-b065-99d58ae4acc6/include -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include -I/mnt/hgfs/edb-postgres.auto/server/source/libmm-edb.linux-x64/inst/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -g -DLINUX_OOM_ADJ=0 -O2 -DMAP_HUGETLB=0x40000
CFLAGS_SL = -fPIC
LDFLAGS = -L../../src/common -L/opt/local/20160428/649c6f94-f2c0-4703-b065-99d58ae4acc6/lib -L/opt/local/20160428/649c6f94-f2c0-4703-b065-99d58ae4acc6/lib -L/opt/local/Current/lib -L/mnt/hgfs/edb-postgres.auto/server/source/libmm-edb.linux-x64/inst/lib -Wl,--as-needed -Wl,-rpath,'/mnt/hgfs/edb-postgres.auto/server/staging/linux-x64.build/server/lib',--enable-new-dtags
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lmemcached -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -lxml2 -lm  
VERSION = EnterpriseDB 10.4.9

ecpg version 

ecpg --version
ecpg 10.4.9

and my simple program pro.pgc:

 

/************************************************************
* print_emp.pgc
*
*/
#include <stdio.h>
int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int v_empno;
char v_ename[40];
double v_sal;
double v_comm;
short v_comm_ind;
char* dbname = "testutf8";
char* db     = "testutf8@localhost:5444";
char* user   = "enterprisedb";
char* passwd = "pass";
const char *target = "testutf8@localhost:5444";
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER SQLERROR sqlprint;
/*EXEC SQL CONNECT :user IDENTIFIED BY Smiley Tongueasswd AT :dbname USING :db;
*/
EXEC SQL CONNECT TO :target USER :user USING Smiley Tongueasswd;


EXEC SQL
SELECT empno, ename, sal, comm INTO
:v_empno, :v_ename, :v_sal, :v_comm INDICATOR:v_comm_ind
FROM public.emp WHERE empno = 7369;
if (v_comm_ind)
printf("empno(%d), ename(%s), sal(%.2f) comm(NULL)\n",
v_empno, v_ename, v_sal);
else
printf("empno(%d), ename(%s), sal(%.2f) comm(%.2f)\n",
v_empno, v_ename, v_sal, v_comm);
EXEC SQL DISCONNECT;
}

i am missing something? 

 

regards!!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
EDB Team Member

Re: Error with ECPG

Hi Asotolongo,

 

Thank you for sharing the information with us, we are able to reproduce the error you are facing while compile the program with ecpg.

 

The issue here is that it is unable to find the libraries libssl and libscrypto.

 

To resolve this issue, we need to set the LD_LIBRARY_PATH to the EPAS 10 library location. Please refer below steps and retry at your end.

 

1) Set the LD_LIBRARY_PATH

 

[root@localhost ecpg]# export LD_LIBRARY_PATH=/opt/edb/as10/lib

 

2) Execute the program 

 

[root@localhost ecpg]# make pro

ecpg  -c -I/opt/edb/as10/include pro.pgc

gcc -Wall -I/opt/edb/as10/include -g -DFRONTEND  -c -o pro.o pro.c

gcc -L../../src/common -g  pro.o  -L /opt/edb/as10/lib -lecpg -lpq -o pro

rm pro.o pro.c

 

3) It will create the executable file 

 

[root@localhost ecpg]# ls -lrth

total 20K

-rw-r--r--. 1 root root 208 Nov 19 07:09 makefile

-rw-r--r--. 1 root root 959 Nov 19 07:15 pro.pgc

-rwxr-xr-x. 1 root root 11K Nov 19 07:18 pro

 

4) Run this executable file (pro)

 

[root@localhost ecpg]# ./pro 

empno(7369), ename(abc), sal(1000.50) comm(20.60)

 

Please let us know in case of any issues/queries.

 

Regards,

Sudhir

4 REPLIES
Silver Adventurer

Re: Error with ECPG

aadditional information the SO:

cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
Highlighted
EDB Team Member

Re: Error with ECPG

Hi asotolongo,

 

We will get back to you regarding your query.

EDB Team Member

Re: Error with ECPG

Hi Asotolongo,

 

Thank you for sharing the information with us, we are able to reproduce the error you are facing while compile the program with ecpg.

 

The issue here is that it is unable to find the libraries libssl and libscrypto.

 

To resolve this issue, we need to set the LD_LIBRARY_PATH to the EPAS 10 library location. Please refer below steps and retry at your end.

 

1) Set the LD_LIBRARY_PATH

 

[root@localhost ecpg]# export LD_LIBRARY_PATH=/opt/edb/as10/lib

 

2) Execute the program 

 

[root@localhost ecpg]# make pro

ecpg  -c -I/opt/edb/as10/include pro.pgc

gcc -Wall -I/opt/edb/as10/include -g -DFRONTEND  -c -o pro.o pro.c

gcc -L../../src/common -g  pro.o  -L /opt/edb/as10/lib -lecpg -lpq -o pro

rm pro.o pro.c

 

3) It will create the executable file 

 

[root@localhost ecpg]# ls -lrth

total 20K

-rw-r--r--. 1 root root 208 Nov 19 07:09 makefile

-rw-r--r--. 1 root root 959 Nov 19 07:15 pro.pgc

-rwxr-xr-x. 1 root root 11K Nov 19 07:18 pro

 

4) Run this executable file (pro)

 

[root@localhost ecpg]# ./pro 

empno(7369), ename(abc), sal(1000.50) comm(20.60)

 

Please let us know in case of any issues/queries.

 

Regards,

Sudhir

Silver Adventurer

Re: Error with ECPG

hi @slonkar thanks for response , your solution is correct,
my LD_LIBRARY_PATH was value "/usr/lib/oracle/11.2/client64/lib" previously, because i was used dblink to ORACLE

with the new set work for me ;-) 

 

thanks again!!!

regards