Hello Ralf, On Wed, 2006-08-23 at 14:04 +0200, Ralf Wildenhues wrote: > Hello Steve, > > * Steve Edwards wrote on Wed, Aug 23, 2006 at 01:54:56PM CEST: > > The configure stage works fine: > > > > CC=/opt/ansic/bin/cc F77=fort77 ./configure > > Please use > ./configure CC=/opt/ansic/bin/cc F77=fort77 > > instead, for consistency.
Right you are. I'll update my notes on this - I've been using the other invocation for so long now! > > However, when building, the Fortran builds correctly but the C routines > > all fail as follows (sorry - the lines may autowrap): > > > > source='ul_beeper.c' object='ul_beeper.lo' libtool=yes \ > > DEPDIR=.deps depmode=hp /usr/bin/posix/sh ../depcomp \ > > /usr/bin/posix/sh ../libtool --tag=CC --mode=compile /opt/ansic/bin/cc -Ae > > -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z > > 2>xlf.ul_beeper.errors -c -o ul_beeper.lo ul_beeper.c > > mkdir .libs > > /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include > > -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo +Z -DPIC -o > > .libs/ul_beeper.o > > /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include > > -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo -o ul_beeper.o >/dev/null > > 2>&1 > > fort77 -I.. -I./../include -I.. -DWORDS_BIGENDIAN +O2 +U77 +Z -C > > 2>xlf.ul_beeper.errors -c -o ul_beeper.lo ul_beeper.c > > make[2]: *** [ul_beeper.lo] Error 1 > > > > It creates the file ul_beeper.lo and .libs/ul_beeper.o but I cannot > > understand why the Fortran compiler is being called for the static > > library build of the C source. > > This looks like there are some manual overrides in the Makefile.am file. > Could you show a small example exposing this, or show the respective > parts of the Makefile.am? Especially I don't see at all where the > autotools should cause a file like xlf.ul_beeper.errors to be used. Sorry about that - you are quite correct there are indeed some manual overrides. I should have added those to the first post. First of all, at configure time the user can specify EXTRA_FLAGS which are appended to the compiler flags (see below). The other change is Fortran specific which (dependant upong platform and compiler) attempts to work out a method for pre-processing Fortran source. If no flag is know to the configure script it uses an automake conditional to generate pre-processed Fortran: if PPHASH .f.o: $(FTNPP) $(FTNPPFLAGS) @DEFINES@ $(AM_CPPFLAGS) `test -f '$<' || echo '$(srcdir)/'`$< > $(*F).F && $(F77COMPILE) -c -o $@ $(*F).F endif If a flag is known it sets FPPFLAGS, but this has to be set for the compile stage only and not the link stage - g77 uses -xf77-cpp-input and fails if you leave this in the command line at link time as then it tries to pre-process the object code. So the Makefile.am overrides look like: COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @EXTRA_FLAGS@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) @EXTRA_FLAGS@ F77COMPILE=$(F77) $(AM_FFLAGS) $(FFLAGS) @FPPFLAGS@ @EXTRA_FLAGS@ LTF77COMPILE = $(LIBTOOL) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) \ @FPPFLAGS@ @EXTRA_FLAGS@ Secondly the xlf.ul_beeper.errors file is something set on the FFLAGS and CFLAGS variables in the configure.am - without the stderr redirection I get this: source='ul_beeper.c' object='ul_beeper.lo' libtool=yes \ DEPDIR=.deps depmode=hp /usr/bin/posix/sh ../depcomp \ /usr/bin/posix/sh ../libtool --tag=CC --mode=compile /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c -o ul_beeper.lo ul_beeper.c mkdir .libs /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo +Z -DPIC -o .libs/ul_beeper.o /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo -o ul_beeper.o >/dev/null 2>&1 fort77 -I.. -I./../include -I.. -DWORDS_BIGENDIAN +O2 +U77 +Z -C -c -o ul_beeper.lo ul_beeper.c ul_beeper.c: (Bundled) cc: "ul_beeper.c", line 82: error 1705: Function prototypes are an ANSI feature. (Bundled) cc: "ul_beeper.c", line 82: error 1505: Function may not return a function or an array. (Bundled) cc: "ul_beeper.c", line 82: error 1573: Type of "F77_FUNC_" is undefined due to an illegal declaration. fort77: Errors detected make: *** [ul_beeper.lo] Error 1 I've been through the C source and it compiles fine with gcc on every platform I can access, xlc on RS/6000, Sun Workshop cc compiler. The F77_FUNC_ is a definition set for the Fortran name mangling convention. In case you're wondering, the line it complains about merely says: void UL_BEEPER_F77(void) { I still don't quite see why it's trying to build the C with fort77 especially as it appears to be building the static and shared object version correctly on the previous two lines(?) Commenting out the COMPILE, LTCOMPILE, F77COMPILE and LTF77COMPILE overrides in the Makefile.am (I'm ignoring the fact I can't build the Fortran with this at the moment) I get: source='ul_beeper.c' object='ul_beeper.lo' libtool=yes \ DEPDIR=.deps depmode=hp /usr/bin/posix/sh ../depcomp \ /usr/bin/posix/sh ../libtool --tag=CC --mode=compile /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c -o ul_beeper.lo ul_beeper.c mkdir .libs /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo +Z -DPIC -o .libs/ul_beeper.o /opt/ansic/bin/cc -Ae -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I./../include -I.. +Z -c ul_beeper.c -Wp,-M.deps/ul_beeper.TPlo -o ul_beeper.o >/dev/null 2>&1 /opt/fortran/bin/fort77 -I.. -I./../include -I.. -DWORDS_BIGENDIAN +O2 +U77 +Z -C -c -o ul_beeper.lo ul_beeper.c ul_beeper.c: (Bundled) cc: "ul_beeper.c", line 82: error 1705: Function prototypes are an ANSI feature. (Bundled) cc: "ul_beeper.c", line 82: error 1505: Function may not return a function or an array. (Bundled) cc: "ul_beeper.c", line 82: error 1573: Type of "F77_FUNC_" is undefined due to an illegal declaration. fort77: Errors detected make: *** [ul_beeper.lo] Error 1 (I did reconfigure as you suggested specifying F77=/opt/fortran/bin/fort77 this time) > Wrt. which linker is chosen, please see > info Automake "How the Linker is Chosen" > > but if I understand right, this does not have to do with your issue(?). No. This is all library code at compile stage only at the moment. I'm not actually looking at any linking (yet). > > Cheers, > Ralf Thanks - if you can work out what is going on from all of this I'll be officially amazed! I may try stripping down the automake/autoconf to an absolute minimum on that platform and just try building a library with 2 routines - 1 C and 1 Fortran to see if it still occurs. Would that be of any use to you if I did that? Steve _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool