trying to build a shared library using GCC on Solaris

Srinivasan,Sudesh sudesh.srinivasan@dhs.state.tx.us
Tue Jul 30 16:36:00 GMT 2002


Hi,

I am trying to build a shared library using GCC on Solaris, whose functions
would be invoked from a Java application. This library in turn invokes
functions from the Open Client DB- library for C. Could any of you pls. give
me the exact options of gcc that I need to use to build this library.

Currently I am using the following steps for building the library.

# Make the TIERSBOP Library
#
echo "Java env variables.."
JAVA_HOME=usr/java1.2
echo $JAVA_HOME
JAVA_INCLUDE_DIR=$JAVA_HOME/include
echo $JAVA_INCLUDE_DIR
JAVA_INCLUDE=-I/$JAVA_INCLUDE_DIR
echo $JAVA_INCLUDE
JAVA_SOL_INCLUDE_DIR=$JAVA_INCLUDE_DIR/solaris
JAVA_SOL_INCLUDE=-I/$JAVA_SOL_INCLUDE_DIR
echo $JAVA_SOL_INCLUDE

echo "Sybase env variables.."
SYBASE=usr/local/sybase
echo $SYBASE
SYBASE_OCS=OCS-12_5
echo $SYBASE_OCS
SYBASE_INCLUDE_DIR=$SYBASE/$SYBASE_OCS/include
echo $SYBASE_INCLUDE_DIR
LIBDIR=$SYBASE/$SYBASE_OCS/lib 
echo $LIBDIR
SYBASE_INCLUDE=-I/$SYBASE_INCLUDE_DIR
echo $SYBASE_INCLUDE
SYBASE_LIB=-L/$LIBDIR
echo "Sybase Library Location :" $SYBASE_LIB
SYBASE_LIB_NAME=-lsybdb
echo "Sybase Library Name :" $SYBASE_LIB_NAME
TIERS_BOP_LIB=-L/.


gcc -g -fPIC -c $JAVA_INCLUDE $JAVA_SOL_INCLUDE $SYBASE_INCLUDE
./BiBOPServerImpl.c -o libTIERSBOPLibrary.o 
echo "Done step 1.."
gcc -g -shared -Wl,-soname,libTIERSBOPLibrary.so -o
libTIERSBOPLibrary.so.1.0.0 ./libTIERSBOPLibrary.o $SYBASE_LIB
$SYBASE_LIB_NAME
echo "Done step 2.."
ln -s libTIERSBOPLibrary.so.1.0.0 libTIERSBOPLibrary.so.1
echo "Done step 3.."
ln -s libTIERSBOPLibrary.so.1.0.0 libTIERSBOPLibrary.so
echo "Done step 4..."

Pls. let me know what I am doing wrong.

thanks in advance,
sudesh




More information about the Gcc-bugs mailing list