Cannot Find Oracle Library During Static Build
In an attempt to create a static Go executable with Oracle libraries on Ubuntu, errors were encountered while trying to link them. Despite successful dynamic builds, the static compiler reported an inability to find the Oracle library, despite the fact that the required files were present in the correct locations.
Resolution
/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
This command includes additional static libraries to resolve dependencies, including libippdcmerged.a and libippsmerged.a.
In summary, static linking requires manual resolution of all dependencies, which may necessitate the inclusion of additional libraries not typically included in dynamic linking.
The above is the detailed content of Why Can\'t I Statically Link My Go Application with Oracle Libraries, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!