I have already searched for some days, tried several suggestions but none helped. At the moment I just want to create a small Go snippet which connects to an Oracle Database
libclntst.a
The st
stands for static library. Oracle client is not usually shipped with this file. The In case of 11gR2 this command worked for me:
/usr/bin/c++ -Wall -ggdb3 -fPIC \
CMakeFiles/opassgen.dir/opassgen.cpp.o \
CMakeFiles/opassgen.dir/dbutils.cpp.o \
CMakeFiles/opassgen.dir/common.cpp.o \
CMakeFiles/opassgen.dir/crypto.cpp.o \
n.o -o opassgen \
-rdynamic -static-libgcc -L. -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic \
/home/oracle/ivan/openssl-1.0.1t/libcrypto.a \
/oracle/u01/db/11.2.0.4/lib/libclntst11.a \
/oracle/u01/db/11.2.0.4/lib/libippdcmerged.a \
/oracle/u01/db/11.2.0.4/lib/libippsmerged.a \
-Wl,--whole-archive libtrotl.a -Wl,--no-whole-archive \
-lpthread -ldl
Static linking requires, that you resolve all the dependencies manually. In this example libclntst11.a depends on symbols from libippdcmerged.a and libippsmerged.a.
On older Oracle version the whole database was build and linked using Intel's ICC compiler. So when linking Oracle's client lib statically you also had to add some static libs from ICC's runtime.