[Lemon-user] Problem with GLPK
Kaveh Azizian (Dr)
kazizian at ntu.edu.sg
Mon Oct 3 05:58:31 CEST 2016
Dea Alpar thank you for your email.
I checked the directory of libglpk.so.0, and it is located at :
/usr/local/lib
but I could not find ld.so.conf file. So does it mean I have to reinstal GLPK? If yes, then I will haave to reinstall lemon after as well?
Regards,
Kaveh
________________________________________
From: Alpár Jüttner [alpar.juttner at gmail.com] on behalf of Alpar Juttner [alpar at cs.elte.hu]
Sent: September 30, 2016 11:51 PM
To: Kaveh Azizian (Dr); Kovács Péter; lemon-user at lemon.cs.elte.hu
Subject: Re: [Lemon-user] Problem with GLPK
Hi,
This problem is independent from LEMON, but it seems that GLPK is not
installed properly.
When you installed GLPK it should put it's shared library
(libglpk.so.0) somewhere in the shared library search path.
First try to locate libglpk.so.0 (for example with the find command:
find / -name libglpk.so.0
) then check if its directory is in /etc/ld.so.conf (it may contain
included files as well)
If you have to modify /etc/ld.so.conf, then you may want to run the
ldconfig command after that (as root)
Regards,
Alpár
On Fri, 2016-09-30 at 14:51 +0000, Kaveh Azizian (Dr) wrote:
> I used it and did not get any error. However, I am using
> g++ -O3 -o lp_demo lp_demo.cc -lemon -lglpk
> to build an executable file and lp_demo is created. But when I run it
> on the consul:
> ./lp_demo
> I got the following error:
>
> ./lp_demo: error while loading shared libraries: libglpk.so.0: cannot
> open shared object file: No such file or directory
>
> This time problem encounters with shared libraries!
> How I can link them to this code?
> Regards,
> Kaveh
> ________________________________________
> From: Kovács Péter [kpeter at inf.elte.hu]
> Sent: September 30, 2016 6:51 PM
> To: Kaveh Azizian (Dr); Alpar Juttner; lemon-user at lemon.cs.elte.hu
> Subject: Re: [Lemon-user] Problem with GLPK
>
> Hi Kaveh,
>
> This one works for me (provided that both LEMON and GLPK are
> installed
> correctly):
>
> g++ -O3 lp_demo.cc -lemon -lglpk
>
> Could you try this?
>
> Regards,
> Péter
>
>
>
> 2016.09.30. 10:17 keltezéssel, Kaveh Azizian (Dr) írta:
> > none of them works!! Problem still insists. I think the problem is
> > linking between GLPK and Lemon. Any idea?
> > ________________________________________
> > From: Alpár Jüttner [alpar.juttner at gmail.com] on behalf of Alpar
> > Juttner [alpar at cs.elte.hu]
> > Sent: September 30, 2016 4:01 PM
> > To: Kaveh Azizian (Dr); lemon-user at lemon.cs.elte.hu
> > Subject: Re: [Lemon-user] Problem with GLPK
> >
> > Oh, sorry, I missed that you should also link to LEMON itself:
> >
> > g++ -lglpk -lemon lp_demo.cc
> >
> > (Or
> > g++ -lemon -lglpk lp_demo.cc
> > if the command above does not work. GCC is sensitive to the order
> > of
> > the linked libraries, and I'm always confused about the right
> > order.)
> >
> > Regads,
> > Alpár
> >
> >
> > On Fri, 2016-09-30 at 06:54 +0000, Kaveh Azizian (Dr) wrote:
> > > Dear Alpar,
> > > So many thanks for your email. I used ur provided command to
> > > compile
> > > it but the problem still insist.
> > >
> > > kaveh at kaveh-K501UX:/media/kaveh/DATA/lemon-1.3.1$ g++ -lglpk
> > > lp_demo.cc
> > > /tmp/cc3gGHdQ.o: In function `main':
> > > lp_demo.cc:(.text+0x26): undefined reference to
> > > `lemon::GlpkLp::GlpkLp()'
> > > /tmp/cc3gGHdQ.o: In function
> > > `lemon::LpBase::Constr::lowerBounded()
> > > const':
> > > lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12lowerBoundedEv[_ZNK5l
> > > emon
> > > 6LpBase6Constr12lowerBoundedEv]+0x19): undefined reference to
> > > `lemon::LpBase::INF'
> > > /tmp/cc3gGHdQ.o: In function
> > > `lemon::LpBase::Constr::upperBounded()
> > > const':
> > > lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12upperBoundedEv[_ZNK5l
> > > emon
> > > 6LpBase6Constr12upperBoundedEv]+0x19): undefined reference to
> > > `lemon::LpBase::INF'
> > > /tmp/cc3gGHdQ.o: In function
> > > `lemon::LpBase::addRow(lemon::LpBase::Constr const&)':
> > > lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5lemo
> > > n6Lp
> > > Base6addRowERKNS0_6ConstrE]+0xd4): undefined reference to
> > > `lemon::LpBase::INF'
> > > lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5lemo
> > > n6Lp
> > > Base6addRowERKNS0_6ConstrE]+0x1b7): undefined reference to
> > > `lemon::LpBase::INF'
> > > /tmp/cc3gGHdQ.o: In function
> > > `lemon::operator<=(lemon::LpBase::Expr
> > > const&, lemon::LpBase::Expr const&)':
> > > lp_demo.cc:(.text._ZN5lemonleERKNS_6LpBase4ExprES3_[_ZN5lemonleER
> > > KNS_
> > > 6LpBase4ExprES3_]+0x27): undefined reference to
> > > `lemon::LpBase::NaN'
> > > /tmp/cc3gGHdQ.o: In function `lemon::operator<=(double const&,
> > > lemon::LpBase::Expr const&)':
> > > lp_demo.cc:(.text._ZN5lemonleERKdRKNS_6LpBase4ExprE[_ZN5lemonleER
> > > KdRK
> > > NS_6LpBase4ExprE]+0x17): undefined reference to
> > > `lemon::LpBase::NaN'
> > > /tmp/cc3gGHdQ.o: In function `lemon::GlpkLp::~GlpkLp()':
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xe)
> > > :
> > > undefined reference to `vtable for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x26
> > > ):
> > > undefined reference to `vtable for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x2e
> > > ):
> > > undefined reference to `vtable for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x5b
> > > ):
> > > undefined reference to `VTT for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x6e
> > > ):
> > > undefined reference to `lemon::GlpkBase::~GlpkBase()'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x73
> > > ):
> > > undefined reference to `VTT for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xd3
> > > ):
> > > undefined reference to `VTT for lemon::GlpkLp'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xe6
> > > ):
> > > undefined reference to `lemon::GlpkBase::~GlpkBase()'
> > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xf0
> > > ):
> > > undefined reference to `VTT for lemon::GlpkLp'
> > > collect2: error: ld returned 1 exit status
> > >
> > > So is there something wrong linking lemon to GLPK?
> > > Regards,
> > > Kaveh
> > >
> > >
> > >
> > >
> > >
> > >
> > > ________________________________________
> > > From: Alpár Jüttner [alpar.juttner at gmail.com] on behalf of Alpar
> > > Juttner [alpar at cs.elte.hu]
> > > Sent: September 30, 2016 2:22 PM
> > > To: Kaveh Azizian (Dr); lemon-user at lemon.cs.elte.hu
> > > Subject: Re: [Lemon-user] Problem with GLPK
> > >
> > > Hi,
> > >
> > > LEMON itself does not provide an LP/MIP solver just an interface
> > > existing third party solvers. It's GLPK in your case. Thus,
> > >
> > > 1. you must have GLPK installed on your system
> > > 2. you must link it together with your code:
> > >
> > > g++ -lglpk lp_demo.cc
> > >
> > > In addition, using LEMON, it is of crucial importance to turn on
> > > compiler optimization, whenever running time matters(*). So, you
> > > are
> > > better of compiling with
> > >
> > > g++ -O3 -lglpk lp_demo.cc
> > >
> > > Regards,
> > > Alpar
> > >
> > > (*) In fact, it is true for everything written in C++, especially
> > > if
> > > it uses STL.
> > >
> > >
> > >
> > >
> > > On Fri, 2016-09-30 at 05:14 +0000, Kaveh Azizian (Dr) wrote:
> > > > Hi,
> > > > I have installed lemon and I could compile and run hello_world
> > > > sample, which means Lemon installed correctly. However, when I
> > > > wan
> > > > to
> > > > compile lp and MIP examples I encounter with the following
> > > > error:
> > > >
> > > > kaveh at kaveh-K501UX:/media/kaveh/DATA/lemon-1.3.1$ g++
> > > > lp_demo.cc
> > > > /tmp/ccd0qUUn.o: In function `main':
> > > > lp_demo.cc:(.text+0x26): undefined reference to
> > > > `lemon::GlpkLp::GlpkLp()'
> > > > /tmp/ccd0qUUn.o: In function
> > > > `lemon::LpBase::Constr::lowerBounded()
> > > > const':
> > > > lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12lowerBoundedEv[_ZNK
> > > > 5lem
> > > > on
> > > > 6LpBase6Constr12lowerBoundedEv]+0x19): undefined reference to
> > > > `lemon::LpBase::INF'
> > > > /tmp/ccd0qUUn.o: In function
> > > > `lemon::LpBase::Constr::upperBounded()
> > > > const':
> > > > lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12upperBoundedEv[_ZNK
> > > > 5lem
> > > > on
> > > > 6LpBase6Constr12upperBoundedEv]+0x19): undefined reference to
> > > > `lemon::LpBase::INF'
> > > > /tmp/ccd0qUUn.o: In function
> > > > `lemon::LpBase::addRow(lemon::LpBase::Constr const&)':
> > > > lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5le
> > > > mon6
> > > > Lp
> > > > Base6addRowERKNS0_6ConstrE]+0xd4): undefined reference to
> > > > `lemon::LpBase::INF'
> > > > lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5le
> > > > mon6
> > > > Lp
> > > > Base6addRowERKNS0_6ConstrE]+0x1b7): undefined reference to
> > > > `lemon::LpBase::INF'
> > > > /tmp/ccd0qUUn.o: In function
> > > > `lemon::operator<=(lemon::LpBase::Expr
> > > > const&, lemon::LpBase::Expr const&)':
> > > > lp_demo.cc:(.text._ZN5lemonleERKNS_6LpBase4ExprES3_[_ZN5lemonle
> > > > ERKN
> > > > S_
> > > > 6LpBase4ExprES3_]+0x27): undefined reference to
> > > > `lemon::LpBase::NaN'
> > > > /tmp/ccd0qUUn.o: In function `lemon::operator<=(double const&,
> > > > lemon::LpBase::Expr const&)':
> > > > lp_demo.cc:(.text._ZN5lemonleERKdRKNS_6LpBase4ExprE[_ZN5lemonle
> > > > ERKd
> > > > RK
> > > > NS_6LpBase4ExprE]+0x17): undefined reference to
> > > > `lemon::LpBase::NaN'
> > > > /tmp/ccd0qUUn.o: In function `lemon::GlpkLp::~GlpkLp()':
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > e):
> > > > undefined reference to `vtable for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > 26):
> > > > undefined reference to `vtable for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > 2e):
> > > > undefined reference to `vtable for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > 5b):
> > > > undefined reference to `VTT for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > 6e):
> > > > undefined reference to `lemon::GlpkBase::~GlpkBase()'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > 73):
> > > > undefined reference to `VTT for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > d3):
> > > > undefined reference to `VTT for lemon::GlpkLp'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > e6):
> > > > undefined reference to `lemon::GlpkBase::~GlpkBase()'
> > > > lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x
> > > > f0):
> > > > undefined reference to `VTT for lemon::GlpkLp'
> > > > collect2: error: ld returned 1 exit status
> > > >
> > > >
> > > >
> > > > Any help, advice?
> > > > Thanks in advance.
> > > > ________________________________
> > > > CONFIDENTIALITY: This email is intended solely for the
> > > > person(s)
> > > > named and may be confidential and/or privileged. If you are not
> > > > the
> > > > intended recipient, please delete it, notify us and do not
> > > > copy,
> > > > use,
> > > > or disclose its contents.
> > > > Towards a sustainable earth: Print only when necessary. Thank
> > > > you.
> > > > _______________________________________________
> > > > Lemon-user mailing list
> > > > Lemon-user at lemon.cs.elte.hu
> > > > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
> > > >
> > >
> > _______________________________________________
> > Lemon-user mailing list
> > Lemon-user at lemon.cs.elte.hu
> > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
> >
>
>
More information about the Lemon-user
mailing list