bug-glpk
[Top][All Lists]
Advanced

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

[Bug-glpk] configure/build/dynamic link problems with 4.28


From: Robbie Morrison
Subject: [Bug-glpk] configure/build/dynamic link problems with 4.28
Date: Sat, 7 Jun 2008 00:12:27 +0400

Hello Andrew and fellow API users (posted to bugs list only)

My transition from 4.25 to 4.28 has, thus far, not been successful.

I apologize for the very long post, but it seemed that more detail was
better than less.

My suspicions currently lie with the new 'configure' script or with
<dlfch.h> usage or perhaps both.

  |  STOP PRESS: I just read posts by Antonello Lobianco
  |  <address@hidden> regarding:
  |
  |      make LDFLAGS+=-ldl
  |
  |  It will be a day or so before I can try this.
  |  But I am not sure it will solve problem in any
  |  case.

---------------------------------
 Context
---------------------------------

First up, my system is Linux 2.6.17 / i686 (Intel Celeron) / Ubuntu
GNU/Linux 6.10 (edgy) x86 released Oct-2006.  The compiler is g++
(GCC) 4.1.2.  My last routine upgrade (via APT) was 14-Apr-2008.

I write C/C++ most days, using a range of low (POSIX) and high level
(STL and Boost) calls, and it is quite some time since I had trouble
with system libraries.

So, although my system is admittedly a little old, it is relatively
standard and in reasonable shape.

I have <dlfch.h> (programming interface to dynamic linking loader)
present as follows:

  $ find -L /usr/include -iname "*dlfcn*" -type f -printf ...
  2007-01-24 17:25:11      2593  /usr/include/bits/dlfcn.h
  2007-01-24 17:25:11      7124  /usr/include/dlfcn.h

The principle (second) header is copyright 2006.

My copy of 'glpk-4.28.tar.gz' was downloaded on 27-May-2008 from the
Technical University of Berlin GNU mirror.

---------------------------------
 GLPK 4.25 build
---------------------------------

Normally I link my application to 'libglpk.a' in order to minimize
run-time dependencies (for my potential users).  Thus, when building
GLPK, I use:

  $ ./configure --disable-shared         # 4.27 and lower

And then (skipping some steps for brevity):

  $ make check                           # after building
  $ glpsol --version                     # after installing under sudo

My application 'makefile' runs the following linker call (edited):

  $ g++ -o xeona main.o ... -lboost_date_time-gcc41 ... -lglpk

The following commands, not surprisingly, yield nothing:

  $ ldd $(which glpsol) | grep libglpk   # blank
  $ ldd xeona           | grep libglpk   # blank

For the record (also 'libglpk.la' is listed at the end):

  $ find -L /usr -iname "*glpk*" -type f -printf ...
  2008-06-06 13:05:06       766  /usr/local/lib/libglpk.la
  2008-06-06 13:05:06     42349  /usr/local/include/glpk.h
  2008-06-06 13:05:06   2243072  /usr/local/lib/libglpk.a

---------------------------------
 GLPK 4.28 build
---------------------------------

I tried the same approach, using the new GLPK 'configure'
implementation:

  $ ./configure  --disable-dl            # and also --enable-dl=no

configure reports, somewhat puzzlingly and in contrast to 4.25:

  ...
  checking if libtool supports shared libraries... yes
  checking whether to build shared libraries... yes
  checking whether to build static libraries... yes
  configure: creating libtool
  ...

The GLPK build and install is clean.  And "make check" and
"glpsol --version" work as expected.  But I get:

  $ ldd $(which glpsol) | grep libglpk
  libglpk.so.0 => /usr/local/lib/libglpk.so.0 (0xb7e4c000)

Again, for the record (and again, 'libglpk.la' is listed below):

  $ find -L /usr -iname "*glpk*" -type f -printf ...
  2008-06-06 13:27:46     42228  /usr/local/include/glpk.h
  2008-06-06 13:27:47       823  /usr/local/lib/libglpk.la
  2008-06-06 13:27:47   1803533  /usr/local/lib/libglpk.so
  2008-06-06 13:27:47   1803533  /usr/local/lib/libglpk.so.0
  2008-06-06 13:27:47   1803533  /usr/local/lib/libglpk.so.0.13.0
  2008-06-06 13:27:47   2456012  /usr/local/lib/libglpk.a

My application build is also clean (with every useful compiler warning
turned on) but chokes on execution (note my linewraps marked thus \):

  $ /usr/bin/time --portability ./xeona
  ./xeona: error while loading shared libraries: libglpk.so.0: cannot open      
\
  shared object file: No such file or directory
  Command exited with non-zero status 127
  real 0.09
  user 0.00
  sys 0.00

And, not surprisingly:

  $ ldd xeona | grep libglpk
  libglpk.so.0 => not found

So I tried building GLPK without the "no shared" option:

  $ make distclean
  $ ./configure            # the defaults please
  $ make

And get the following:

  ...
  glpscg.o glpspm.o glpspx01.o glpspx02.o glpsql.o glpssx01.o glpssx02.o 
glptsp.o
  ranlib .libs/libglpk.a
  creating libglpk.la
  (cd .libs && rm -f libglpk.la && ln -s ../libglpk.la libglpk.la)
  make[2]: Leaving directory `/home/robbie/synk/xeona/code_glpk/glpk-4.28/src'
  Making all in examples
  make[2]: Entering directory 
`/home/robbie/synk/xeona/code_glpk/glpk-4.28/examples'
  gcc -DHAVE_CONFIG_H -I. -I.. -I../include    -g -O2 -MT glpsol.o -MD -MP -MF  
\
  .deps/glpsol.Tpo -c -o glpsol.o glpsol.c
  mv -f .deps/glpsol.Tpo .deps/glpsol.Po
  /bin/bash ../libtool --tag=CC   --mode=link gcc  -g -O2   -o glpsol glpsol.o  
\
  ../src/libglpk.la -lz -lgmp -lm
  mkdir .libs
  gcc -g -O2 -o .libs/glpsol glpsol.o  ../src/.libs/libglpk.so                  
\
  -lz /usr/lib/libgmp.so -lm  -Wl,--rpath -Wl,/usr/local/lib
  ../src/.libs/libglpk.so: undefined reference to `dlerror'
  ../src/.libs/libglpk.so: undefined reference to `dlclose'
  ../src/.libs/libglpk.so: undefined reference to `dlopen'
  ../src/.libs/libglpk.so: undefined reference to `dlsym'
  collect2: ld returned 1 exit status
  make[2]: *** [glpsol] Error 1
  make[2]: Leaving directory 
`/home/robbie/synk/xeona/code_glpk/glpk-4.28/examples'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/home/robbie/synk/xeona/code_glpk/glpk-4.28'
  make: *** [all] Error 2

Moreover "make check" also fails with similar output to that above.

As an experiment, I tried modifying the 4.28 'libglpk.la' file to see
if I could link to the static archive in preference -- but that didn't
work.

Finally, (as a check on myself) I uninstalled 4.28 and reinstalled
4.25 and then rebuilt and ran my application without incident.

---------------------------------
 Summary
---------------------------------

This is not a link-time issue because '/usr/bin/ld' finds '-lglpk'.
Hence, setting the 'LIBRARY_PATH' (or similar) is not the problem.

My sole change has been to uninstall 4.25 and try to build and install
4.28 in a similar manner.  All other system issues have remained
invariant, as indicated by the easy retreat back to 4.25.

Any assistance would be much appreciated!  In addition, I am more than
happy to help with further testing or provide more information.

cheers, Robbie

---------------------------------
 4.25 + ./configure --disable-shared
---------------------------------

# libglpk.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.23a (1.1220.2.412 2006/10/13 
14:13:30)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=''

# Names of this library.
library_names=''

# The name of the static archive.
old_library='libglpk.a'

# Libraries that this one depends upon.
dependency_libs=' /usr/lib/libgmp.la -lm'

# Version information for libglpk.
current=10
age=10
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

---------------------------------
 4.28 + ./configure --disable-dl
---------------------------------

# libglpk.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.23a (1.1220.2.412 2006/10/13 
14:13:30)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libglpk.so.0'

# Names of this library.
library_names='libglpk.so.0.13.0 libglpk.so.0 libglpk.so'

# The name of the static archive.
old_library='libglpk.a'

# Libraries that this one depends upon.
dependency_libs=' -lz /usr/lib/libgmp.la -lm'

# Version information for libglpk.
current=13
age=13
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : address@hidden
Webmail (preferred)           : address@hidden
[from IMAP client]









reply via email to

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