This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
help with dynamic library
- From: "Gong, Richard" <richard dot gong at glenayre dot com>
- To: "'gcc at gnu dot org'" <gcc at gnu dot org>
- Date: Mon, 26 May 2003 05:38:34 -0400
- Subject: help with dynamic library
Hi,
I think the dynamic library (.so) shall be "dynamic", as long as I define
the path at LD_LIBRARY_PATH, the target program shall be able to find it.
But I find it may not be sure.
Please take a look at the following sample, I compile the program at Linux,
using GNU g++:
// compile
g++ -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT
-DACE_HAS_AIO_CALLS -DEXCLUDE_TAM -O3 -W -Wall -Wpointer-arith -pipe
-Wno-uninitialized -march=i686 -I. -I../../../SNMP/src/snmp++
-I../../apis/cppapi/include -I/home/xxx/ACE+TAO-1.2a/ACE_wrappers
-I/home/xxx/ACE+TAO-1.2a/ACE_wrappers/TAO
-I/home/xxx/ACE+TAO-1.2a/ACE_wrappers/TAO/orbsvcs
-I/home/xxx/ACE+TAO-1.2a/ACE_wrappers -I.corba -o .obj/EventListenerS_T.o -c
.corba/EventListenerS_T.cpp
...
...
// make the binary file
g++ -o ../../target/bin/asu_server .obj/ActionTable.o
.obj/alarm_card_interface.o .obj/alarm_controller.o .obj/AlarmTable.o
.obj/AppIDDescTable.o .obj/asu_threads.o .obj/CommandExecutionInterface.o
.obj/ConfigLoader.o .obj/CorbaMain.o .obj/EventClassificationTable.o
.obj/EventListener.o .obj/gui.o .obj/IEventListener_i.o .obj/log_file.o
.obj/main.o .obj/RemoteASUInterface.o .obj/SNMPInterface.o .obj/SnmpUI.o
.obj/user_interface.o .obj/EventListenerS.o .obj/EventListenerS_T.o
-L/home/xxx/ACE+TAO-1.2a/ACE_wrappers/ace -lACE -lTAO -lTAO_CosNaming
-lTAO_Svc_Utils -lTAO_IORTable -lTAO_PortableServer -ldl -lpthread -lrt
-L../../../SNMP/lib -L../../apis/cppapi/lib -lsnmp++ -lcppapi
I run it at the same machine without any problem. But when I try to run this
program at another machine, which the ACE/TAO .so libraries are not
installed at the same directory, it complains that the "libTAO.so cannot be
found", although I set the correct path to the LD_LIBRARY_PATH.
Much appreciated if you could help me to solve the program.
Thanks.