abit_oik wrote:
Thanks for the reply. Now solved the problem.
When stating the path to the libraries/includes for DB2 I'd
incorrectly stated the path so no wonder it could't find anything. I
went back to basics and typed everything at the command line instead
of in my Makefile. It still took ages to spot what the difference was.
The path that now works for me is -
/home/db2inst1/sqllib
which I include in the -I and -L options to g++.
Thanks
I guess I solved it a different way that seems simpler to me.
I happen to use GNOME and X Window System most of the time, but compile in
an xterm. That probably does not matter much. I tend to compile programs
as myself and not as the instance name. I use C++, not plain C.
In my .bash_profile are (among other things) the lines:
# These are for IBM's DB2 dbms.
IBM_DB2_ROOT=/dataA/db2inst1
.. $IBM_DB2_ROOT/sqllib/db2profile
In my makefiles are lines like this near the beginning:
CXX = /usr/bin/g++296
IBM_DB2_PATH = ${IBM_DB2_ROOT}/sqllib
IBM_DB2_BIN = ${IBM_DB2_PATH}/bin
IBM_DB2_DB2 = ${IBM_DB2_BIN}/db2
IBM_DB2_HEADERS = ${IBM_DB2_PATH}/include
IBM_DB2_LIB = ${IBM_DB2_PATH}/lib
MY_ROOT = /home/me
MY_BIN = ${MY_ROOT}/bin
MY_HEADERS = ${MY_ROOT}/include
MY_LIB = ${MY_ROOT}/lib
MY_STOCKS = ${MY_ROOT}/stocks
MY_STOCK_HEADERS = ${MY_STOCKS}/include
MY_STOCK_LIB = ${MY_STOCKS}/lib
SYS_LIB = /usr/lib
(CXX is to use a compatibility compiler because DB2 does not like the
current one with RHEL 3 ES)
so that in compile steps, I have:
enter_vl: ${OBJS} ${MY_STOCK_LIB}/libstock.a ${MY_LIB}/libmine.a
${CXX} ${DEBUG_FLAG} ${CXX_LIBS} \
-Wl,-L,${IBM_DB2_LIB},-L${SYS_LIB} \
-Wl,-rpath,${IBM_DB2_LIB},-rpath,${SYS_LIB} \
-o $@ ${OBJS} \
-lstock -lmine \
-ldb2 ${SYS_LIB}/libc.so
While setting stuff like that up took some time, it permits me to tweak
just what goes into things as my Linux distributions update out of step
with the releases of DB2 change. It got this way when I upgraded from Red
Hat Linux 6.2 to 7.3 when I was still running DB2 V6.1. V6.1 needed old
libraries which were in a compatibility library somewhere, and an old
ldd.so (I think it was). It took a while to figure that out, and I am glad
I did, because recently I installed RHEL 3 ES and DB2 V8.1.5, and 8.1.5 is
already considered behind the times by Red Hat and must use a
compatability compiler (though the libraries this time are OK).
--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ Registered Machine 241939.
/( )\ Shrewsbury, New Jersey
http://counter.li.org
^^-^^ 07:00:00 up 2 days, 15:59, 5 users, load average: 2.09, 2.14, 2.09