help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Always running time error : " error while loading shared lib


From: Guanyao Huang
Subject: [Help-glpk] Always running time error : " error while loading shared libraries: libglpk.so.0:"
Date: Mon, 22 Feb 2010 21:37:42 -0800

Hi
Sorry to bother us. I am a newbie to glpk. I am calling glpk lib from
my own c++ file. The c++ code is actually a test code copied from page
15 of glpk.pdf.

I already configure to support dynamic lib. The commands I use are:
sudo ./configure --enable-dl=dlfcn --prefix /usr
sudo make install LDFLAGS+=-ldl prefix=/usr/
If I donot use LDFLAGS+=-ldl, there will be errors like:
../src/.libs/libglpk.so: undefined reference to `dlsym'

sudo make check shows it is correctly installed.

sudo ./glpsol can also work

I also follow instructions below:
"If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf' "

Now
declare -x LD_LIBRARY_PATH="/usr/lib"
declare -x LD_RUN_PATH="/usr/lib"
declare -x LIBDIR="/usr/lib"

The Makefile is:
g++ -lglpk -LLIBDIR -I /home/myname/glpk-4.43/glpk-4.43/include
/usr/lib/libglpk.so.0  -o TestLP TestLP.o BasicFunction.o CIDR.o

The source code gets compiled, but there is always a running time error:
address@hidden TestLP]$ ./TestLP
./TestLP: error while loading shared libraries: libglpk.so.0: cannot
open shared object file: No such file or directory

Under /usr/lib directory:
address@hidden lib]$ ls libglpk.so -al
lrwxrwxrwx 1 root root 17 2010-02-22 21:36 libglpk.so -> libglpk.so.0.28.0


I really donot know what's wrong with my program. I got to make me crazy.....

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]