Sunday, January 24, 2010

SDPA 7.3.1 installation problem in Cygwin

So you've managed to construct a 40000x40000 linear programming constraint matrix, hoping to solve it with a revised simplex function you coded in c++. Then after a week of research and programming, you find out that the usefulness of your lp solver depends wholly on its numerical stability.

Fortunately, the folks at sdpa.indsys.chuo-u.ac.jp did all the hard work for you, so that you can enjoy the favourable numerical properties of an optimised interior point algorithm.

For some reason however, you still just love working and coding in Windows. So you opt for a Cygwin installation to further that amazing piece of software you have tapped your blood for the past couple of weeks.

After following the reasonable SDPA 7.3.1 installation instructions you are greeted with one of those wonderful compile fail messages:

/usr/lib/gcc/i686-pc-cygwin/4.3.4/libgcc_s.dll.a(_chkstk.o):/gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/libgcc/../gcc/config/i386/cygwin.asm:48: multiple definition of `__alloca'
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../libcygwin.a(t-d000121.o):(.text+0x0): first defined here

/usr/local/gfortran/lib/gcc/i686-pc-cygwin/4.5.0/libgcc.a(unwind-sjlj.o): In function `_Unwind_SetGR':
/home/jerry/gcc/objdir/i686-pc-cygwin/libgcc/../../../trunk/libgcc/../gcc/unwind-sjlj.c:204: multiple definition of `__Unwind_SetGR'

sdpa-sdpa_exe.o:sdpa_exe.cpp:(.eh_frame+0x12): undefined reference to `___gxx_personality_v0'
./libsdpa.a(libsdpa_a-sdpa_call.o):sdpa_call.cpp:(.eh_frame+0x12): undefined reference to `___gxx_personality_v0'

Don't stress, be calm. First extract libgfortran.a with

ln -s /usr/local/gfortran/lib/gcc/i686-pc-cygwin/4.5.0/libgfortran.a /usr/local/gfortran/lib/libgfortran.a

Then simply edit $HOME/sdpa/sdpa/sdpa.7.3.1.src/Makefile by changing

FLIBS = -L/usr/local/gfortran/lib/gcc/i686-pc-cygwin/4.5.0 -L/usr/local/gfortran/lib/gcc/i686-pc-cygwin/4.5.0/../../.. -lgfortran -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32

to

FLIBS = -L/usr/local/gfortran/lib -lgfortran -luser32 -lkernel32 -ladvapi32 -lshell32

and make again. All should be well in winux land.

No comments:

Post a Comment