[Ipopt] missing -lmpi pkg-config with mumps

Stefan Vigerske stefan at math.hu-berlin.de
Mon Feb 27 19:08:36 EST 2012


Hi,

> 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?

Yes, unfortunately. It should also work if you just drop the -lgcc_s.
The fortran libraries dependencies are setup automatically form the 
output of the fortran compiler and we do not filter out -lgcc_s (yet?).

Stefan

>
> 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
>>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>



More information about the Ipopt mailing list