Gavan McGrath
2011-Oct-14 12:07 UTC
[R] Compiling R extension: undefined reference to `__mingw_vsprintf'
I'm trying to link a hydrological model in FORTRAN with R. I have a subroutine inside wetall.f90 which calls two contained functions. When I try rcmd SHLIB -o wetall.dll wetall.f90 I get a bunch of errors stating undefined reference to `__mingw_vsprintf' from dos (see below). When the same is run from cygwin the dll is compiled but hangs R when dyn.load(ed) The code does not do any I/O so the errors seem unusual. Any suggestions? Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C: \wetland_test>rcmd SHLIB -o wetall2.dll wetall.f90 gfortran -shared -s -static-libgcc -o wetall2.dll tmp.def wetall.o -LC:/PROGRA~1/R/R-212~1.1/bin/i386 -lR c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(unix.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(main.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(format.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(transfer.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_read_obj.clone.1+0x199): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_read_obj.clone.1+0x345): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x4ab): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x56b): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x602): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x69c): more undefined references to `__mingw_snprintf' follow c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$output_float.clone.5+0x536): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0xf9): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0x18d): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0x36e): undefined reference to `__mingw_snprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(open.o):(.text$sprintf+0x1b): undefined reference to `__mingw_vsprintf' c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(open.o):(.text$__gfortrani_new_unit+0x560): undefined reference to `__mingw_snprintf' collect2: ld returned 1 exit status [[alternative HTML version deleted]]