[Ipopt] Build error "error: linking to Fortran libraries from C fails"

John Pye john.pye at anu.edu.au
Wed Aug 14 20:02:53 EDT 2013

Hi all

I am trying to build IPOPT 3.11.3 on the MinGW-w64 platform. I set up a 
new environment as carefully detailed here:

This is using latest GCC 4.8.0 packaged by rubenvb from the MinGW-w64 
project. I get the following error from the IPOPT configure scripts:

checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
configure: Fortran compiler options are: -O3 -pipe
checking how to get verbose linking output from gfortran... -v
checking for Fortran libraries of gfortran...  -lstdc++*-lm'*  -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0 -Lc:/mingw/64/b
in/../lib/gcc -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/lib/../lib -Lc:/mingw/64/bin/..
/lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../lib -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-min
gw32/lib -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../.. -lgfortran -lmingw32 -lgcc_s -lmoldname -lmingwex -lmsvcrt
  -lquadmath -lm -ladvapi32 -lshell32 -luser32 -lkernel32
*checking for dummy main to link with Fortran libraries... unknown**
**configure: error: linking to Fortran libraries from C fails**
**See `config.log' for more details.**
**configure: error: /bin/sh './configure' failed for ThirdParty/Lapack*

The config.log file contains a clue:

configure:4471: gcc -o conftest.exe -O3 -pipe -DNDEBUG -pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -W
cast-qual -Wall -Wno-unknown-pragmas -Wno-long-long   -DLAPACK_BUILD   conftest.c   -lstdc++ -lm' -Lc:/mingw/64/bin/../lib/gcc/x86
_64-w64-mingw32/4.8.0 -Lc:/mingw/64/bin/../lib/gcc -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mi
ngw32/lib/../lib -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../lib -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-min
gw32/4.8.0/../../../../x86_64-w64-mingw32/lib -Lc:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../.. -lgfortran -lmingw32
-lgcc_s -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -ladvapi32 -lshell32 -luser32 -lkernel32 >&5
*c:/mingw/64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lm'**
*collect2.exe: error: ld returned 1 exit status
configure:4477: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "ThirdPartyLapack"
| #define PACKAGE_TARNAME "thirdpartylapack"
| #define PACKAGE_VERSION "1.4.3"

So it looks to me that somewhere in the current configuration scripts 
used by (provided by) IPOPT, something is failing to correctly detect 
library linking flags, and a stray apostrophe is being inserted at the 
end of *-lm'*. This could be perhaps because config.guess returns 
"i686-pc-mingw32" on this platform, ie the 64-bit nature of this 
environment is not correctly identified. Or it could be because of 
something unusual being present in my PATH. I'm not sure why this would 
be happening. Although looking at the output from *gcc -v*, I wonder if 
it could be that the IPOPT configure script is mis-handling some strings 
in the following:

$ gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: /home/ruben/mingw-w64/src/gcc/configure --host=x86_64-w64-mingw32 --build=x86_64-linux-gnu --target=x86_64-w64-mi
ngw32 --with-sysroot=/home/ruben/mingw-w64/mingw64mingw64/mingw64 --prefix=/home/ruben/mingw-w64/mingw64mingw64/mingw64 --with-gmp
=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install --with-mpfr=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install --wit
h-mpc=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install --with-cloog=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install
  --disable-cloog-version-check --with-isl=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install --enable-cloog-backend=isl*--wit**
**h-host-libstdcxx='-static -lstdc++ -lm'*  --enable-shared --enable-static --enable-threads=win32 --enable-plugins --disable-multilib
  --enable-languages=c,lto,c++,objc,obj-c++,fortran,java --enable-libgomp --enable-fully-dynamic-string --enable-libstdcxx-time --d
isable-nls --disable-werror --enable-checking=release --with-gnu-as --with-gnu-ld --disable-win32-registry --disable-rpath --disab
le-werror --with-libiconv-prefix=/home/ruben/mingw-w64/prereq/x86_64-w64-mingw32/install --with-pkgversion=rubenvb-4.8.0 --with-bu
gurl=mingw-w64-public at lists.sourceforge.net CC= CFLAGS='-O2 -march=nocona -mtune=core2 -fomit-frame-pointer -momit-leaf-frame-poin
ter' CXXFLAGS='-O2 -march=nocona -mtune=core2 -fomit-frame-pointer -momit-leaf-frame-pointer' LDFLAGS= 'BOOT_CFLAGS=-O2 -march=noc
ona -mtune=core2 -fomit-frame-pointer -momit-leaf-frame-pointer' 'BOOT_CXXFLAGS=-O2 -march=nocona -mtune=core2 -fomit-frame-pointe
r -momit-leaf-frame-pointer' BOOT_LDFLAGS= 'CFLAGS_FOR_TARGET= -O2 -march=nocona -mtune=core2 -fgraphite-identity -floop-interchan
ge -floop-block -floop-parallelize-all' 'CXXFLAGS_FOR_TARGET= -O2 -march=nocona -mtune=core2 -fgraphite-identity -floop-interchang
e -floop-block -floop-parallelize-all' LDFLAGS_FOR_TARGET=
Thread model: win32
gcc version 4.8.0 (rubenvb-4.8.0)

I have tried specifying "--build=x86_64-w64-mingw32" to the Configure 
line. I have tried IPOPT 3.10.1, 3.10.4 and 3.11.3 and I get the same 
error in each case. I have also tried using earlier versions of the 
MinGW-w64 compiler package (ie GCC 4.7.0 and 4.7.4). I have tried 
intalling OpenBLAS, and that removed the problem with BLAS, but the 
problem just pops up again with LAPACK (and I presume it will pop up 
again with MUMPS).

Can anyone please give me some suggestions on what I can try next? I am 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20130815/f7becbf2/attachment.html>

More information about the Ipopt mailing list