I'm just looking over the spkg-install of GPLK to

* Sort out the SAGE64 issue http://trac.sagemath.org/sage_trac/ticket/9312
* Update to the latest upstream code
* Clean it up a bit.
* Add spkg-check

There are a few things that seem a bit strange about how this is built in Sage.

1) GPLK is *NOT* configured with gmp, but the INSTALL file says:

--with-gmp           Enable using the GNU MP bignum library

   This feature allows the exact simplex solver to use the GNU MP
   bignum library. If it is disabled, the exact simplex solver uses the
   GLPK bignum module, which provides the same functionality as GNU MP,
   however, it is much less efficient.


That rather suggests to me it would be wise to link to this. (I tried adding that option, and it linked ok)

2) It it not configured with zlib support. the INSTALL file says this:

--with-zlib          Enable using the zlib data compression library

   This feature allows GLPK API routines and the stand-alone solver to
   read and write compressed data files performing compression and
   decompression "on the fly" (compressed data files are recognized by
   suffix `.gz' in the file name). It may be useful in case of large
   MPS files to save the disk space.


Again, that rather suggests to me this would be desirable given we have zlib anyway.

3) GPLK is linked with the 'dl' library. The spkg-install file seems to suffer from an excessive number of '&&'s. But this bit may be important

cd src &&
LIBS=-ldl ./configure --prefix=$SAGE_LOCAL &&
make prefix=$SAGE_LOCAL &&
make install &&
cd .. &&
python setup.py install &&

I don't know why the 'dl' library is being linked.

The only info I can find in the INSTALL file remotely related to that is these configure options.

--enable-dl          The same as --enable-dl=ltdl
--enable-dl=ltdl     Enable shared library support (GNU)
--enable-dl=dlfcn    Enable shared library support (POSIX)

   Currently this feature is only needed to provide dynamic linking to
   ODBC and MySQL shared libraries (see below).

This rather makes me think there is no point linking in -ldl.

4) There is this warning below in spkg-install. I can see the point of this as an optional package, but if GPLK is moved to standard, is this necessary/desirable?

echo "**************************************************************************
******" &&
echo "" &&
echo "    ATTENTION: YOU HAVE TO REBUILD THE SAGE LIBRARY TO GET THIS TO WORK" &
&
echo "    exit any running sage instances and call \"sage -b\"" &&
echo "" &&
echo "**************************************************************************
******"

(I intend removing all the excess &&'s)

5) A simple:

CPPFLAGS="-I $SAGE_LOCAL/include" && export CPPFLAGS
LDFLAGS="-L$SAGE_LOCAL/lib" &&  export LDFLAGS
./configure --prefix=$SAGE_LOCAL --with-gmp --with-zlib

builds and passes the self-tests if SAGE_CHECK is set to "yes".

I've not rebuilt the library yet, so I don't know how this works at that point.

The truth is, I would not have a clue how to test this.

6) setup.py has:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(
   cmdclass = {'build_ext': build_ext},
   ext_modules = [ Extension("sage.numerical.mipGlpk",
       ["patch/mipGlpk.pyx"],
include_dirs = ["../../../local/include/", "../../../devel/sage/c_lib/include/"],
       language = 'c++',
       libraries=["csage", "stdc++", "glpk"]) ]
   )

Does that lot look right? I don't know much about this, but given all the code is C, I'm not sure why the languages is set to c++, and stdc++ as a library.

Should the include directory not refer to $SAGE_LOCAL/include, rather than all these ../../../ stuff? (If so, can someone tell me what it should be. I'm not much of a python programmer yet, though this looks a bit odd to me).

7) There is a "patch" directory (not "patches") which contains two files (mipGlpk.pxd mipGlpk.pyx). Although patch/mipGlpk.pyx is referenced in setup.py, I can't find a reference to patch/mipGlpk.pxd anywhere. Is this to be expected?

8) Is there any tests I can run to verify this works in Sage? The SPKG test-suite passes ok, but that is only the C code.

Once I get these issues resolved, I'll produce a new .spkg which should be a lot cleaner and build properly 64-bit too. Hopefully it may be possible to improve the performance too, as the zlib and gmp options seems sensible to me given we have mpir and zlib.

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to