help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] GLPK 4.38 for Java under Linux


From: Sylvain Fournier
Subject: Re: [Help-glpk] GLPK 4.38 for Java under Linux
Date: Mon, 25 May 2009 09:36:08 -0300

Many thanks Xypron for the way to compile the library. I will try it and get back to you if something is going wrong.

Sylvain
 
Date: Sat, 23 May 2009 10:04:09 -0700 (PDT)
From: xypron <address@hidden>
Subject: Re: [Help-glpk] GLPK 4.38 for Java under Linux
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=us-ascii


Hello Sylvain,

Sylvain Fournier wrote:
>
> I then saw that there is a glpk_4_38_java library available (
> http://winglpk.sourceforge.net/), I tried it on Windows and it seems to
> work
> fine. But there is a problem of organization in my code, as I use a
> different Java interface when running on Linux and when running on
> Windows.
> So finally, my question on this subject is: is there a Java interface
> equivalent as the one found at http://winglpk.sourceforge.net/, but for
> Linux? In other words, has the glpk_4_38_java.dll also been compiled under
> Linux as a .so?
>

The commands below can be used to create the libraries.
Currently I am puzzled because the call to GLPK.glp_create_prob() works
fine, while
GLPK.glp_mpl_alloc_wksp() fails with
java: symbol lookup error: /usr/local/lib/libglpk_4_38_java.so: undefined
symbol: glp_mpl_alloc_wksp

Best regards

Xypron


# download and unzip
wget ftp://ftp.gnu.org/gnu/glpk/glpk-4.38.tar.gz
tar -xzf glpk-4.38.tar.gz
wget
http://freefr.dl.sourceforge.net/sourceforge/winglpk/glpsol_dll-4.38-32bit.zip
unzip -o glpsol_dll-4.38-32bit.zip

# make and install glpk
cd glpk-4.38
./configure --enable-dl --enable-odbc
sudo make install

# create libraries with swig
cd swig
mkdir src
mkdir src/java
mkdir java
mkdir java/org
mkdir java/org/gnu
mkdir java/org/gnu/glpk
swig -c++ -java -package org.gnu.glpk -o src/java/glpk_wrap.c -outdir
java/org/gnu/glpk glpk.i
g++ -c -fpic src/java/glpk_wrap.c -I../include
-I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux
g++ -shared glpk_wrap.o -lglpk -lltdl -lgmp -o libglpk_4_38_java.so
sudo cp libglpk_4_38_java.so /usr/local/lib
cd java/org/gnu/glpk
javac *.java
cd ../../..
jar cf glpk.jar *

# make and try example
cd ../../examples
javac -cp ../swig/java/glpk.jar GLPKSwig.java
java --cp ../swig/java/glpk.jar:. GLPKSwig


reply via email to

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