For any program, such as program xhello implicit none print*,"hello world!" end program xhello Compiling with the -static option fails, as shown below. Compiling and running without -static works fine. Vivek Rao gfortran -v -static xhello.f90 Driving: gfortran -v -static xhello.f90 -l gfortran Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=c:/programs/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.6.0/lto-wrapper.exe Target: i586-pc-mingw32 Configured with: ../gcc-trunk/configure --prefix=/mingw --enable-languages=c,fortran --with-gmp=/home/brad/gfortran/dependencies --disable-werror --enable-threads --disable-nls --build=i586-pc-mingw32 --enable-libgomp --enable-shared --disable-win32-registry --with-dwarf2 --disable-sjlj-exceptions --enable-lto Thread model: win32 gcc version 4.6.0 20110209 (experimental) [trunk revision 169959] (GCC) COLLECT_GCC_OPTIONS='-v' '-static' '-mtune=pentium' '-march=pentium' c:/programs/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.6.0/f951.exe xhello.f90 -quiet -dumpbase xhello.f90 -mtune=pentium -march=pentium -auxbase xhello -version -fintrinsic-modules-path c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/finclude -o C:\DOCUME~1\Vivek\LOCALS~1\Temp\cc0RLq4i.s GNU Fortran (GCC) version 4.6.0 20110209 (experimental) [trunk revision 169959] (i586-pc-mingw32) compiled by GNU C version 4.6.0 20110209 (experimental) [trunk revision 169959], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran (GCC) version 4.6.0 20110209 (experimental) [trunk revision 169959] (i586-pc-mingw32) compiled by GNU C version 4.6.0 20110209 (experimental) [trunk revision 169959], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 COLLECT_GCC_OPTIONS='-v' '-static' '-mtune=pentium' '-march=pentium' as -o C:\DOCUME~1\Vivek\LOCALS~1\Temp\ccuaIfDx.o C:\DOCUME~1\Vivek\LOCALS~1\Temp\cc0RLq4i.s Reading specs from c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../../libgfortran.spec rename spec lib to liborig COLLECT_GCC_OPTIONS='-v' '-static' '-mtune=pentium' '-march=pentium' COMPILER_PATH=c:/programs/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.6.0/;c:/programs/gfortran/bin/../libexec/gcc/ LIBRARY_PATH=c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/;c:/programs/gfortran/bin/../lib/gcc/;C:/g95/lib/;c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../../ COLLECT_GCC_OPTIONS='-v' '-static' '-mtune=pentium' '-march=pentium' c:/programs/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.6.0/collect2.exe -Bstatic C:/g95/lib/crt2.o c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/crtbegin.o -Lc:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0 -Lc:/programs/gfortran/bin/../lib/gcc -LC:/g95/lib -Lc:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../.. C:\DOCUME~1\Vivek\LOCALS~1\Temp\ccuaIfDx.o -lgfortran -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/crtend.o C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (3262982616) greater than or equal to .debug_abbrev size (1301). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(transfer.o):transfer.c:(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (3663100) greater than or equal to .debug_abbrev size (615). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(main.o):main.c:(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (1656724012) greater than or equal to .debug_abbrev size (1266). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(unix.o):unix.c:(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (2588113216) greater than or equal to .debug_abbrev size (1148). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(format.o):format.c:(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (4154058048) greater than or equal to .debug_abbrev size (1323). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(list_read.o):list_read.c:(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' C:\programs\gfortran\bin/ld.exe: Dwarf Error: Offset (2260110148) greater than or equal to .debug_abbrev size (1399). c:/programs/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.6.0/../../..\libgfortran.a(write.o):write.c:(.text$sprintf+0x1b): more undefined references to `__mingw_vsprintf' follow collect2: ld returned 1 exit status
According to http://mingw-users.1079350.n2.nabble.com/mingw-vfprintf-question-td5445899.html, libmingwex.a should offer `__mingw_vsprintf'. However, that file is linked as "-lmingwex" shows for the collect (linking) command. Thus, it should work; it might be that the MinGW library is too old or not properly installed.
I was not able to confirm your problem as my installation using the same installer works perfectly. However, I do have a full mingw32 installed on that machine. A revised version of gfortran for mingw32 is now available via the gfortran wiki binaries link. This new install package includes the most recent versions of the mingw files, so hopefully this will correct your problem. I would appreciate a test and a report back regarding your success.
I can confirm having seen that in the past, which was due to the use of an older mingw runtime with newer mingw headers. Or, using a libgfortran that was compiled on a newer mingw, but is now running with an older version. Also, it does not happen for me on a clean install of a cross-compiler.
I would like to know if this problem remains with the currently available install package. I have updated all of the mingw binaries and header files, so I am hoping that for a fresh install, the problem is eliminated.
(In reply to comment #4) > I would like to know if this problem remains with the currently available > install package. I don't see it with your latest installer, so I'm closing. Vivek, please reopen if it's not gone for you with a fresh install of the latest build.