link esql/c libraries dynamically
Posted in 1997
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Internationalization & Character Sets
Hi, My problem is similar to teresa's.We are porting our application to solaris 2.5 and we the problem with shared librarie for esql/c application. The following gives a brief description as applied to demo1.ec in the demo files which comes with the product. When I compile the demo1.ec using : esql -o demo1 demo1.ec and run demo1, I get the error ld.so.1:demo1:fatal: libixsql.so: can't open file: errno=2 Killed I assumed the problem is that it is not linking the libraries dynamically. To link the libraries statically: esql -static -o demo1 demo1.ec and running demo1 works just fine. But in our application we need to first preprocess it first and compile and link using gcc or g++. To do this we did the following in our makefile (for demo1.ec program): 1)esql -e demo1.ec 2)g++ -o demo1 demo1.c -L${INFORMIXDIR}/lib/esql -L${INFORMIXDIR}/lib -Xlinker -B -Xlinker static -lixos -lixgen -lixsql -lixasf -lixos -lixgen -lixgls -Xlinker -B -Xlinker dynamic -lnsl -lsocket -laio -lm -Xlinker -B -Xlinker static lixglx -I${INFORMIXDIR}/incl/esql and got the following error(undefined symbol) anitha@sunbgs3>g++ -o demo1 demo1.c -L${INFORMIXDIR}/lib/esql -L${INFORMIXDIR}/lib -Xlinker -B -Xlinker static -lixos -lixgen -lixsql -lixasf -lixos -lixgen -lixgls -Xlinker -B -Xlinker dynamic -lnsl -lsocket -laio -lm -Xlinker -B -Xlinker static lixglx -I${INFORMIXDIR}/incl/esql demo1.ec: In function `int main()': demo1.ec:26: warning: implicit declaration of function `int strncmp(...)' Undefined first referenced symbol in file dlclose /usr/lib/libc.a(nss_deffinder.o) (symbol belongs to implicit dependency /usr/lib/libdl.so.1) dlsym /usr/lib/libc.a(nss_deffinder.o) (symbol belongs to implicit dependency /usr/lib/libdl.so.1) dlopen /usr/lib/libc.a(nss_deffinder.o) (symbol belongs to implicit dependency /usr/lib/libdl.so.1) ld: fatal: Symbol referencing errors. No output written to demo1 gmake: *** [demo1] Error 1 I appreciate if you could help us regarding this error. Any idea what the problem is. I hope there is nothing wrong with the syntax in specifying to link the libraries statically. We have listed the libraries as specified in the esql script. Thanks, Anitha anitha@bgs.com