Re: [Rd] FORTRAN compilation error

From: David L Lorenz <lorenz_at_usgs.gov>
Date: Thu, 09 Feb 2012 09:48:13 -0600

Simon,
  It was not clear that I needed any makefiles in src. I have seen no documentation anywhere that I needed a makefile in src.   The FORTRAN source compiles just fine by hand, so the error is not in the code. It is just one single source code file with one subroutine.   The problem appears to be the z that is inserted in from the the object file name when the .dll is created.
  Thanks.
Dave

From:
Simon Urbanek <simon.urbanek_at_r-project.org> To:
David L Lorenz <lorenz_at_usgs.gov>
Cc:
r-devel_at_r-project.org
Date:
ink3">02/09/2012 09:24 AM
Subject:
Re: [Rd] FORTRAN compilation error

On Feb 9, 2012, at 9:54 AM, David L Lorenz wrote:

>
> I should also have explained that I was using the default Makeconf file
in R-2.14.1\etc\i386. it is reproduced below. I've tried it on other packages and it inserts a z in front of the object files.

I'm not talking about R Makeconf, but the one in your package (in src). What are your settings there? And what are the files?

Thanks,
Simon

> Dave
>
> #-*- Makefile -*-
> # $(R_HOME}/etc$(R_ARCH)/Makeconf
>
> # Hand-edited version for gnuwin32.
>
> ifdef DEBUG
> DLLFLAGS=
> DEBUGFLAG=-gdwarf-2
> else
> DLLFLAGS=-s
> DEBUGFLAG=
> endif
>
> DLLFLAGS+= -static-libgcc
> LINKFLAGS+= -static-libgcc
>
> ## Things which are substituted by fixed/Makefile (and also -O3 -> -O2)
> WIN = 32
> BINPREF =
> # SYMPAT = 's/^.* [BCDRT] _/ /p' for 32-bit
> # SYMPAT = 's/^.* [BCDRT] / /p' for 64-bit
> SYMPAT = 's/^.* [BCDRT] _/ /p'
> IMPDIR = bin/i386
> # flags for multilib builds, for compilers, dlltool and windres
> M_ARCH =
> DT_ARCH =
> RC_ARCH =
> # Used by packages tcltk and tkrplot
> TCL_HOME = $(R_HOME)/Tcl
> LOCAL_SOFT = d:/RCompile/CRANpkg/extralibs/local
>
> ifneq ($(strip $(LOCAL_SOFT)),)
> LOCAL_CPPFLAGS = -I"$(LOCAL_SOFT)/include"
> LOCAL_LIBS = -L"$(LOCAL_SOFT)/lib$(R_ARCH)" -L"$(LOCAL_SOFT)/lib"
> endif
>
> DLLTOOL = $(BINPREF)dlltool --as $(BINPREF)as $(DT_ARCH)
> DLLTOOLFLAGS = -k
> NM = $(BINPREF)nm
> RESCOMP = $(BINPREF)windres $(RC_ARCH)
> ## MAIN_LD needs to be set by the package
> LINKER = $(MAIN_LD)
> ## as a default
> DLL = $(CC)
>
> ## Things defined in Renviron on Unix
> SED = sed
> TAR = tar
>
> ## Things defined in MkRules
> CAT = cat
> CP = cp
> MKDIR = mkdir
> RM = rm -f
> SORT = sort
>
> ## For use in packages
> GRAPHAPP_LIB = -lRgraphapp
> TCL_VERSION = 85
> ZLIB_LIBS = -lRzlib
>
> AR = $(BINPREF)ar
> ## Used by packages 'maps' and 'mapdata'
> AWK = gawk
> BLAS_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRblas
> C_VISIBILITY =
> CC = $(BINPREF)gcc $(M_ARCH)
> CFLAGS = -O3 -Wall $(DEBUGFLAG) -std=gnu99 -mtune=core2
> CPICFLAGS =
> CPPFLAGS =
> CXX = $(BINPREF)g++ $(M_ARCH)
> CXXCPP = $(CXX) -E
> CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2
> CXXPICFLAGS =
> DYLIB_EXT = .dll
> DYLIB_LD = $(DLL)
> DYLIB_LDFLAGS = -shared
> DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
> ECHO = echo
> ECHO_C =
> ECHO_N = -n
> ECHO_T =
> FC = $(BINPREF)gfortran $(M_ARCH)
> FCFLAGS = -O3 $(DEBUGFLAG) -mtune=core2
> # additional libs needed when linking with $(FC), e.g. on Solaris
> FCLIBS =
> F77 = $(BINPREF)gfortran $(M_ARCH)
> F77_VISIBILITY =
> FFLAGS = -O3 $(DEBUGFLAG) -mtune=core2
> FLIBS = -lgfortran
> FCPICFLAGS =
> FPICFLAGS =
> FOUNDATION_CPPFLAGS =
> FOUNDATION_LIBS =
> JAR =
> JAVA =
> JAVAC =
> JAVAH =
> # JAVA_HOME =
> # JAVA_LD_LIBRARY_PATH =
> JAVA_LIBS = -L"$(JAVA_HOME)/bin/client" -ljvm -ljvm-w32
> JAVA_CPPFLAGS = -I"$(JAVA_HOME)/../include"
-I"$(JAVA_HOME)/../include/win32"
> LAPACK_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRlapack
> ## we only need this is if it is external, as otherwise link to R
> LIBINTL=
> LIBM = -lm
> LIBR = -L"$(R_HOME)/$(IMPDIR)" -lR
> LIBS = -lm
> ## needed by R CMD config
> LIBnn = lib
> LIBTOOL =
> LDFLAGS =
> ## needed to build applications linking to static libR
> # MAIN_LD =
> # MAIN_LDFLAGS =
> # MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS)
> # don't have this: would 'mkdir -p' do?
> # MKINSTALLDIRS = $(R_HOME)/bin/mkinstalldirs
> OBJC = $(CC)
> OBJCFLAGS = -O2
> OBJC_LIBS = -lobjc
> OBJCXX =
> R_ARCH = /i386
> RANLIB = $(BINPREF)ranlib
> SAFE_FFLAGS = -O3 -ffloat-store
> SED = sed
> ## it seems some makes (but not ours) get upset if SHELL is set.
> # SHELL = /bin/sh
> SHLIB_CFLAGS =
> SHLIB_CXXFLAGS =
> SHLIB_CXXLD = $(CXX)
> ## ideally -shared -static-libstdc++, but not for gcc 4.2.1
> SHLIB_CXXLDFLAGS = -shared
> SHLIB_EXT = .dll
> SHLIB_FCLD = $(FC)
> ## ideally -shared -static-libgfortran, but not for gcc 4.2.1
> SHLIB_FCLDFLAGS = -shared
> SHLIB_FFLAGS =
> SHLIB_LD = $(CC)
> SHLIB_LDFLAGS = -shared
> SHLIB_LIBADD =
> SHLIB_LINK = $(SHLIB_LD) -Wl,--export-all-symbols $(SHLIB_LDFLAGS)
$(LDFLAGS)
> # not implemented in current toolchain
> SHLIB_OPENMP_CFLAGS =
> SHLIB_OPENMP_CXXFLAGS =
> SHLIB_OPENMP_FCFLAGS =
> SHLIB_OPENMP_FFLAGS =
> STRIP_LIBS = $(BINPREF)strip --strip-unneeded
> STRIP_STATIC_LIBS = $(BINPREF)strip --strip-debug
> TCLTK_CPPFLAGS = -I "$(TCL_HOME)/include" -DWin32
> TCLTK_LIBS = -L"$(TCL_HOME)/bin" -ltcl$(TCL_VERSION) -ltk$(TCL_VERSION)
>
> STATIC_LIBR =
>
> R_XTRA_CFLAGS =
> R_XTRA_CPPFLAGS = -I"$(R_HOME)/include"
> R_XTRA_CXXFLAGS =
> R_XTRA_FFLAGS =
>
> ALL_CFLAGS = $(R_XTRA_CFLAGS) $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS)
$(CFLAGS)
> ALL_CPPFLAGS = $(R_XTRA_CPPFLAGS) $(PKG_CPPFLAGS) $(CPPFLAGS)
$($*-CPPFLAGS) $(CLINK_CPPFLAGS) $(LOCAL_CPPFLAGS)
> ALL_CXXFLAGS = $(R_XTRA_CXXFLAGS) $(PKG_CXXFLAGS) $(CXXPICFLAGS)
$(SHLIB_CXXFLAGS) $(CXXFLAGS)
> ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS)
$(OBJCFLAGS)
> ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS)
$(OBJCXXFLAGS)
> ALL_FFLAGS = $(R_XTRA_FFLAGS) $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS)
$(FFLAGS)
> ALL_LIBS = $(LOCAL_LIBS) $(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR) $(LIBINTL)
>
> .SUFFIXES:
> .SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o .a .def .dll .exe
.rc
>
> .c.o:
> $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
> .c.d:
> @echo "making $@ from $<"
> @$(CC) -std=gnu99 -MM $(ALL_CPPFLAGS) $< > $@
> .cc.o:
> $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
> .cpp.o:
> $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
> .cc.d:
> @echo "making $@ from $<"
> @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
> .cpp.d:
> @echo "making $@ from $<"
> @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
> .m.o:
> $(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
> .m.d:
> @echo "making $@ from $<"
> @$(OBJC) -MM $(ALL_CPPFLAGS) $< > $@
> .mm.o:
> $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
> .M.o:
> $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
> .f.o:
> $(F77) $(ALL_FFLAGS) -c $< -o $@
> .f95.o:
> $(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c $< -o $@
> .f90.o:
> $(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c $< -o $@
>
> %.exe:
> $(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS)
$(LOCAL_LIBS) $(LIBS)
>
> %.dll:
> @echo EXPORTS > $*.def
> @$(NM) $^ | $(SED) -n $(SYMPAT) >> $*.def
> $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $*.def $^ $(ALL_LIBS)
> @$(RM) $*.def
>
> lib%.dll.a: %.def
> $(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll
--input-def $*.def --output-lib $@
>
> %.a:
> @$(RM) $@
> $(AR) crs $@ $^
>
> %.o: %.rc
> $(RESCOMP) $(RESFLAGS) -i $< -o $@
>
>
>
> From: Simon Urbanek <simon.urbanek_at_r-project.org>
> To: David L Lorenz <lorenz_at_usgs.gov>
> Cc: r-devel_at_r-project.org
> Date: 02/08/2012 07:13 PM
> Subject: Re: [Rd] FORTRAN compilation error
>
>
>
>
>
> On Feb 8, 2012, at 3:16 PM, David L Lorenz wrote:
>
> > I get an error when trying to compile a FORTRAN source file for use in
a
> > package that I am developing. The error, reported in 00install.out is
> > below.
> >
> > * installing *source* package 'USGSstats' ...
> > ** libs
> >
> > *** arch - i386
> > C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:194: warning: overriding
recipe
> > for target `.m.o'
> > C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:187: warning: ignoring old
> > recipe for target `.m.o'
> > gfortran -O3 -mtune=core2 -c seakenF.f -o seakenF.o
> > "zseakenF.o" was unexpected at this time.
> > make: *** [USGSstats.dll] Error 255
> > ERROR: compilation failed for package 'USGSstats'
> >
> > I am running R 2.14.1 on a Windows 7 pc. The gnu compilers are all
> > installed and work just fine. In fact, the .o file is created and I
can
> > manually create the .dll file.
> > The error seems to be in the generation of the object name zseakenF.o.
I
> > do not see where that might have been generated in the Makeconf file.
> >
>
> The problem is caused by your Makeconf which you didn't share, so there
is not much we can help you with ... You should remove the offending Makeconf to start with ...
>
> Cheers,
> Simon
>
>
>
>

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 09 Feb 2012 - 15:50:53 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 09 Feb 2012 - 17:10:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive