[Ipopt] missing -lmpi pkg-config with mumps

Ashutosh Mahajan asm4 at lehigh.edu
Mon Feb 27 17:48:39 EST 2012


Thanks for the previous inputs. I have one more question about pkg-config. I'm
compiling IPOPT with --enable-static --disable-shared, with MUMPS. pkg-config
on both coinmumps and ipopt contains gcc_s

pkg-config --libs-only-l ipopt
-lipopt -llapack -ldl -lcoinmumps -lpthread -lblas -lgfortranbegin -lgfortran -lm -lgcc_s

pkg-config --libs-only-l --static ipopt
-lipopt -llapack -ldl -lcoinmumps -lpthread -lblas -lgfortranbegin -lgfortran -lm -lgcc_s

It is usually not a problem. However, if I want to build a statically linked
binary (i.e. with -static flag), then I get the message '/usr/bin/ld: cannot
find -lgcc_s'. libgcc_s.so seems to be a dynamic version of libgcc.a. So it
doesn't work with -static. Do I have to manually change -lgcc_s to -lgcc to
make it work?

Cheers.
--
regards
Ashutosh Mahajan
http://coral.ie.lehigh.edu/~asm4

On Sun, Feb 26, 2012 at 02:01:24PM -0600, Andreas Waechter wrote:
> Hi Ashutosh,
> 
> 
> On 02/26/2012 01:24 PM, Ashutosh Mahajan wrote:
> >
> >Sorry, my bad, I didn't read nm output correctly. There was some other library
> >that needed mpi. Thanks for the prompt clarification.
> 
> I believe you have to be careful if you want to link MUMPS code in a
> program that uses MPI - at least that was true when I was involved
> in a project a few years ago where this was the case....
> 
> The problem is that MUMPS actually wants MPI, but only for the
> parallel version (which we do not use in Ipopt).  However, to make
> this work, the MUMPS package includes a dummy version of some of the
> MPI calls, and when you compile Ipopt, those will be linked to.  If
> you have Ipopt in a parallel program that uses MPI, you would want
> to use the true MPI functions, though, and not the dummy versions.
> On the other hand, MUMPS will not work with the true MPI functions.
> 
> So, what you might have to do is to replace all MPI_* called in the
> MUMPS code with MYMPI_* (or whatever you want) and make the same
> changes to the code in MUMPS' libseq subdirectory...
> 
> To know about this potential pitfall might save you a few days of
> frustrating debugging...
> 
> Regards,
> 
> Andreas
> 


More information about the Ipopt mailing list