public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RFH: trouble getting gfortran to build multilib'ed
@ 2004-03-20 22:35 Steven Bosscher
  2004-03-31  9:11 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Bosscher @ 2004-03-20 22:35 UTC (permalink / raw)
  To: gcc; +Cc: paul

Hi,

I'm trying to make libgfortran multilib'ed.  Configuring seems to work,
but I keep running into the following problem:

/space/stevenb/build-tree-ssa/gcc/xgcc -B/space/stevenb/build-tree-ssa/gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include -shared  .libs/environ.o .libs/error.o .libs/main.o .libs/memory.o .libs/pause.o .libs/stop.o .libs/string.o .libs/select.o .libs/all_l4.o .libs/all_l8.o .libs/any_l4.o .libs/any_l8.o .libs/count_4_l4.o .libs/count_8_l4.o .libs/count_4_l8.o .libs/count_8_l8.o .libs/maxloc0_4_i4.o .libs/maxloc0_8_i4.o .libs/maxloc0_4_i8.o .libs/maxloc0_8_i8.o .libs/maxloc0_4_r4.o .libs/maxloc0_8_r4.o .libs/maxloc0_4_r8.o .libs/maxloc0_8_r8.o .libs/maxloc1_4_i4.o .libs/maxloc1_8_i4.o .libs/maxloc1_4_i8.o .libs/maxloc1_8_i8.o .libs/maxloc1_4_r4.o .libs/maxloc1_8_r4.o .libs/maxloc1_4_r8.o .libs/maxloc1_8_r8.o .libs/maxval_i4.o .libs/maxval_i8.o .libs/maxval_r4.o .libs/maxval_r8.o .libs/minloc0_4_i4.o .libs/minloc0_8_i4.o .libs/minloc0_4_i8.o .libs/minloc0_8_i8.o .libs/minloc0_4_r4.o .libs/minloc0_8_r4.o .libs/minloc0_4_r8.o .libs/minloc0_8_r8.o .libs/minloc1_4_i4.o .libs/minloc1_8_i4.o .libs/minloc1_4_i8.o .libs/minloc1_8_i8.o .libs/minloc1_4_r4.o .libs/minloc1_8_r4.o .libs/minloc1_4_r8.o .libs/minloc1_8_r8.o .libs/minval_i4.o .libs/minval_i8.o .libs/minval_r4.o .libs/minval_r8.o .libs/product_i4.o .libs/product_i8.o .libs/product_r4.o .libs/product_r8.o .libs/product_c4.o .libs/product_c8.o .libs/sum_i4.o .libs/sum_i8.o .libs/sum_r4.o .libs/sum_r8.o .libs/sum_c4.o .libs/sum_c8.o .libs/dotprod_i4.o .libs/dotprod_i8.o .libs/dotprod_r4.o .libs/dotprod_r8.o .libs/dotprod_l4.o .libs/dotprod_l8.o .libs/dotprod_c4.o .libs/dotprod_c8.o .libs/matmul_i4.o .libs/matmul_i8.o .libs/matmul_r4.o .libs/matmul_r8.o .libs/matmul_c4.o .libs/matmul_c8.o .libs/matmul_l4.o .libs/matmul_l8.o .libs/transpose_i4.o .libs/transpose_i8.o .libs/shape_i4.o .libs/shape_i8.o .libs/eoshift1_4.o .libs/eoshift1_8.o .libs/eoshift3_4.o .libs/eoshift3_8.o .libs/cshift1_4.o .libs/cshift1_8.o .libs/reshape_i4.o .libs/reshape_i8.o .libs/in_pack_i4.o .libs/in_pack_i8.o .libs/in_unpack_i4.o .libs/in_unpack_i8.o .libs/exponent_r4.o .libs/exponent_r8.o .libs/fraction_r4.o .libs/fraction_r8.o .libs/nearest_r4.o .libs/nearest_r8.o .libs/set_exponent_r4.o .libs/set_exponent_r8.o .libs/backspace.o .libs/close.o .libs/endfile.o .libs/format.o .libs/inquire.o .libs/list_read.o .libs/lock.o .libs/open.o .libs/read.o .libs/rewind.o .libs/transfer.o .libs/unit.o .libs/unix.o .libs/write.o .libs/associated.o .libs/abort.o .libs/cpu_time.o .libs/cshift0.o .libs/eoshift0.o .libs/eoshift2.o .libs/ishftc.o .libs/pack_generic.o .libs/size.o .libs/spread_generic.o .libs/string_intrinsics.o .libs/random.o .libs/reshape_generic.o .libs/reshape_packed.o .libs/selected_kind.o .libs/transpose_generic.o .libs/unpack_generic.o .libs/in_pack_generic.o .libs/in_unpack_generic.o .libs/_abs_r4.o .libs/_abs_r8.o .libs/_exp_r4.o .libs/_exp_r8.o .libs/_exp_c4.o .libs/_exp_c8.o .libs/_log_r4.o .libs/_log_r8.o .libs/_log_c4.o .libs/_log_c8.o .libs/_log10_r4.o .libs/_log10_r8.o .libs/_sqrt_r4.o .libs/_sqrt_r8.o .libs/_sqrt_c4.o .libs/_sqrt_c8.o .libs/_asin_r4.o .libs/_asin_r8.o .libs/_acos_r4.o .libs/_acos_r8.o .libs/_atan_r4.o .libs/_atan_r8.o .libs/_sin_r4.o .libs/_sin_r8.o .libs/_sin_c4.o .libs/_sin_c8.o .libs/_cos_r4.o .libs/_cos_r8.o .libs/_cos_c4.o .libs/_cos_c8.o .libs/_tan_r4.o .libs/_tan_r8.o .libs/_sinh_r4.o .libs/_sinh_r8.o .libs/_cosh_r4.o .libs/_cosh_r8.o .libs/_tanh_r4.o .libs/_tanh_r8.o .libs/_conjg_c4.o .libs/_conjg_c8.o .libs/_aint_r4.o .libs/_aint_r8.o .libs/_anint_r4.o .libs/_anint_r8.o .libs/_sign_i4.o .libs/_sign_i8.o .libs/_sign_r4.o .libs/_sign_r8.o .libs/_dim_i4.o .libs/_dim_i8.o .libs/_dim_r4.o .libs/_dim_r8.o .libs/_atan2_r4.o .libs/_atan2_r8.o .libs/_mod_i4.o .libs/_mod_i8.o .libs/_mod_r4.o .libs/_mod_r8.o .libs/dprod_r8.o .libs/trig_c4.o .libs/trig_c8.o .libs/exp_c4.o .libs/exp_c8.o .libs/hyp_c4.o .libs/hyp_c8.o   -Wl,-soname -Wl,libgfortran.so.0 -o .libs/libgfortran.so.0.0.0
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: warning: i386 architecture of input file `.libs/environ.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `.libs/error.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `.libs/main.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `.libs/memory.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `.libs/pause.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `.libs/stop.o' is incompatible with i386:x86-64 output
(goes on for every file...)
make[6]: *** [libgfortran.la] Error 1
make[6]: Leaving directory `/space/stevenb/build-tree-ssa/x86_64-unknown-linux-gnu/32/libgfortran'
make[5]: *** [all] Error 2
make[5]: Leaving directory `/space/stevenb/build-tree-ssa/x86_64-unknown-linux-gnu/32/libgfortran'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/space/stevenb/build-tree-ssa/x86_64-unknown-linux-gnu/libgfortran'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/space/stevenb/build-tree-ssa/x86_64-unknown-linux-gnu/libgfortran'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/space/stevenb/build-tree-ssa/x86_64-unknown-linux-gnu/libgfortran'
make[1]: *** [all-target-libgfortran] Error 2
make[1]: Leaving directory `/space/stevenb/build-tree-ssa'
make: *** [bootstrap] Error 2

This is on amd64 configured with --enable-multilib and the attached
patch applied.  As you can see, I've mostly just copied over things
from libstdc++v3, where things always works just fine.  But apparently
I need something extra, and my understanding of auto* is below zero :-/

I've been stuck on this for almost a day now and I still don't know
what/where the problem is.  Perhaps some build system hero can help
me out here?

Gr.
Steven


Index: libgfortran/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/Attic/Makefile.am,v
retrieving revision 1.1.2.9
diff -c -3 -p -r1.1.2.9 Makefile.am
*** libgfortran/Makefile.am	7 Feb 2004 18:06:17 -0000	1.1.2.9
--- libgfortran/Makefile.am	20 Mar 2004 17:31:11 -0000
*************** lib_LTLIBRARIES = libgfortran.la libgfor
*** 10,16 ****
  libgfortranbegin_la_SOURCES = fmain.c
  libgfortranbegin_la_LDFLAGS = -static
  
! INCLUDES = -I$(srcdir)/io
  
  libgfortranincludedir = $(includedir)/gforio
  
--- 10,16 ----
  libgfortranbegin_la_SOURCES = fmain.c
  libgfortranbegin_la_LDFLAGS = -static
  
! AM_CPPFLAGS = -I$(srcdir)/io
  
  libgfortranincludedir = $(includedir)/gforio
  
*************** $(gfor_built_specific2_src): m4/specific
*** 457,460 ****
  endif
  
  EXTRA_DIST = $(m4_files)
- 
--- 457,459 ----
Index: libgfortran/configure.ac
===================================================================
RCS file: libgfortran/configure.ac
diff -N libgfortran/configure.ac
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- libgfortran/configure.ac	20 Mar 2004 17:31:27 -0000
***************
*** 0 ****
--- 1,133 ----
+ # Process this file with autoconf to produce a configure script, like so:
+ # aclocal && autoconf && autoheader && automake
+ 
+ AC_PREREQ(2.59)
+ AC_INIT([GNU Fortran Runtime Library], 0.2,,[libgfortran])
+ AC_CONFIG_HEADER(config.h)
+ 
+ # For libtool versioning info, format is CURRENT:REVISION:AGE
+ libtool_VERSION=6:0:0
+ AC_SUBST(libtool_VERSION)
+ 
+ # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+ #
+ # You will slowly go insane if you do not grok the following fact:  when
+ # building this library, the top-level /target/ becomes the library's /host/.
+ #
+ # configure then causes --target to default to --host, exactly like any
+ # other package using autoconf.  Therefore, 'target' and 'host' will
+ # always be the same.  This makes sense both for native and cross compilers
+ # just think about it for a little while.  :-)
+ #
+ # Also, if this library is being configured as part of a cross compiler, the
+ # top-level configure script will pass the "real" host as $with_cross_host.
+ #
+ # Do not delete or change the following two lines.  For why, see
+ # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+ AC_CANONICAL_SYSTEM
+ target_alias=${target_alias-$host_alias}
+ 
+ # Sets up automake.  Must come after AC_CANONICAL_SYSTEM.  Each of the
+ # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+ #  1.8.2:  minimum required version
+ #  no-define:  PACKAGE and VERSION will not be #define'd in config.h (a bunch
+ #              of other PACKAGE_* variables will, however, and there's nothing
+ #              we can do about that; they come from AC_INIT).
+ #  foreign:  we don't follow the normal rules for GNU packages (no COPYING
+ #            file in the top srcdir, etc, etc), so stop complaining.
+ #  no-dependencies:  turns off auto dependency generation (just for now)
+ #  -Wall:  turns on all automake warnings...
+ #  -Wno-portability:  ...except this one, since GNU make is required.
+ AM_INIT_AUTOMAKE([1.8.2 no-define foreign no-dependencies -Wall -Wno-portability])
+ 
+ AM_MAINTAINER_MODE
+ AM_ENABLE_MULTILIB(, ..)
+ 
+ # Handy for debugging:
+ #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
+ 
+ # Are we being configured with some form of cross compiler?
+ # NB: We don't actually need to know this just now, but when, say, a test
+ #     suite is included, we'll have to know.
+ if test "$build" != "$host"; then
+   LIBGFOR_IS_NATIVE=false
+   GCC_NO_EXECUTABLES
+ else
+   LIBGFOR_IS_NATIVE=true
+ fi
+ 
+ # Check the compiler.
+ AC_PROG_CC
+ 
+ # Add -Wall if we are using GCC.
+ if test "x$GCC" = "xyes"; then
+   CFLAGS="$CFLAGS -Wall"
+ fi
+ 
+ # Find other programs we need.
+ AC_CHECK_TOOL(AS, as)
+ AC_CHECK_TOOL(AR, ar)
+ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
+ AC_PROG_MAKE_SET
+ AC_PROG_INSTALL
+ 
+ # Configure libtool
+ #AC_MSG_NOTICE([====== Starting libtool configuration])
+ AC_LIBTOOL_DLOPEN
+ AM_PROG_LIBTOOL
+ AC_SUBST(enable_shared)
+ AC_SUBST(enable_static)
+ #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
+ 
+ # We need gfortran to compile parts of the library
+ # We can't use AC_PROG_F77 because it expects a fully working gfortran. 
+ #AC_PROG_F77(gfortran)
+ F77="$GFORTRAN"
+ AC_PROG_F77(gfortran)
+ FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring"
+ 
+ AC_FUNC_MMAP
+ AC_TYPE_OFF_T
+ 
+ # check header files
+ AC_STDC_HEADERS
+ AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h)
+ AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
+ AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
+ 
+ # Check for complex math functions
+ AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
+ 
+ # Check for complex math functions in -lmx also
+ AC_CHECK_LIB([mx],[csin],[need_math="no"],[need_math="yes"])
+ 
+ # Check for library functions.
+ AC_CHECK_FUNCS(getrusage times)
+ 
+ # Let the user override this
+ AC_ARG_ENABLE(cmath,
+ 	AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
+ 	[need_math=$enableval])
+ if test "$need_math" = "yes"; then
+ 	AC_MSG_NOTICE([Including complex math functions in libgfor]);
+   extra_math_obj='$(gfor_cmath_obj)'
+ fi
+ 
+ AC_SUBST([MATH_OBJ],["$extra_math_obj"])
+ 
+ # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
+ # for struct timezone, as you might think.  We also need to check how
+ # to call gettimeofday if we have it.
+ LIBGFOR_GETTIMEOFDAY
+ 
+ AC_CACHE_SAVE
+ 
+ if test ${multilib} = yes; then
+   multilib_arg="--enable-multilib"
+ else
+   multilib_arg=
+ fi
+ 
+ # Write our Makefile.
+ AC_CONFIG_FILES(Makefile)
+ AC_OUTPUT
Index: libgfortran/configure.in
===================================================================
RCS file: libgfortran/configure.in
diff -N libgfortran/configure.in
*** libgfortran/configure.in	6 Jan 2004 00:20:01 -0000	1.1.2.3
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,88 ****
- dnl configure.in for libgfor
- dnl Copyright Free Software Foundation
- dnl Released under the LGPL
- 
- dnl The rest of gcc uses autoconf 2.13, but we really need more, hence:
- AC_PREREQ(2.54)
- 
- AC_INIT([GNU Fortran Runtime Library], 0.2,,[libgfortran])
- AM_INIT_AUTOMAKE()
- AM_CONFIG_HEADER(config.h)
- AM_MAINTAINER_MODE
- 
- AC_SUBST(enable_shared)
- AC_SUBST(enable_static)
- 
- # check for compiler
- AC_PROG_CC
- dnl Add -Wall if using gcc
- if test "x$GCC" = "xyes"; then
-  CFLAGS="$CFLAGS -Wall"
- fi
- 
- # We need gfortran to compile parts of the library
- # We can't use AC_PROG_F77 because it expects a fully working gfortran. 
- #AC_PROG_F77(gfortran)
- F77="$GFORTRAN"
- AC_PROG_F77(gfortran)
- FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring"
- 
- AC_FUNC_MMAP
- AC_TYPE_OFF_T
- 
- # Check for install
- AC_PROG_INSTALL
- 
- # check header files
- AC_STDC_HEADERS
- AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h)
- AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
- AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
- # Check for complex math functions
- AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
- 
- # Check for complex math functions in -lmx also
- AC_CHECK_LIB([mx],[csin],[need_math="no"],[need_math="yes"])
- 
- dnl Checks for library functions.
- AC_CHECK_FUNCS(getrusage times)
- 
- # Let the user override this
- AC_ARG_ENABLE(cmath,
- 	AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
-     [need_math=$enableval])
- if test "$need_math" = "yes"; then
- 	AC_MSG_NOTICE([Including complex math functions in libgfor]);
-   extra_math_obj='$(gfor_cmath_obj)'
- fi
- 
- AC_SUBST([MATH_OBJ],["$extra_math_obj"])
- 
- dnl The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
- dnl for struct timezone, as you might think.  We also need to check how
- dnl to call gettimeofday if we have it.
- LIBGFOR_GETTIMEOFDAY
- 
- dnl These should be inherited in the recursive make, but ensure they are
- dnl defined:
- test "$AR" || AR=ar
- AC_SUBST(AR)
- if test "$RANLIB"; then :
-   AC_SUBST(RANLIB)
- else
-   AC_PROG_RANLIB
- fi
- 
- dnl Don't pull is system libtool.m4, it conflicts with the gcc version.
- dnl if test "$LIBTOOL"; then :
- dnl   AC_SUBST(LIBTOOL)
- dnl else
- dnl   AC_PROG_LIBTOOL
- dnl fi
- AM_PROG_LIBTOOL
- 
- AC_PROG_MAKE_SET
- AC_PROG_INSTALL
- 
- AC_OUTPUT(Makefile)
- 
--- 0 ----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFH: trouble getting gfortran to build multilib'ed
  2004-03-20 22:35 RFH: trouble getting gfortran to build multilib'ed Steven Bosscher
@ 2004-03-31  9:11 ` Jim Wilson
  2004-03-31 10:49   ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2004-03-31  9:11 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: paul, gcc

Steven Bosscher wrote:
> I'm trying to make libgfortran multilib'ed.  Configuring seems to work,
> but I keep running into the following problem:

I tried this with a mips-elf cross compiler build as I don't have an 
x86_64 machine (yet).

I ran into a few newlib cross issues.  libgfortran uses stdint.h 
conditionally, but its contents (e.g. int32_t) unconditionally, so if it 
is missing, we get parse errors where int32_t is used.  libgfortran uses 
sys/mman.h unconditionally in io/unix.c.  That file should perhaps not 
be compiled for a non-unix target, or else configured so it can be 
compiled for a non-unix target.  I hacked around these problems by 
manually defining the types and macros needed for the build.

After that, I noticed that all of the fortran library files are compiled 
wrong.  This is because the toplevel config-ml.in file does not define 
FFLAGS.  Search for CFLAGS, and add FFLAGS and any other Fortran defines 
you might need.  I didn't see any other obvious problem.  mips-elf 
doesn't build a shared library file, so there might be other issues I 
can't see with an embedded cross.

If that doesn't solve your problem, then you need to figure out why the 
link command for libgfortran.so isn't creating a 32-bit output file.  I 
noticed that there is no -m32 option on this command, which is probably 
a bug.  You need to figure out why it is missing.  Maybe it was missing 
because it wasn't in FFLAGS?  If the -m32 option isn't needed for the 
link, then you need to figure out why the linker is deciding to create a 
64-bit output file.  Maybe something else on the command line is a 
64-bit object?  You can pass verbose options to the linker to see what 
it is doing.  The linker might be collect though, which means you might 
not be able to just use -Wl,-verbose.  You have to get the linker 
command from collect, and then add verbose options there.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFH: trouble getting gfortran to build multilib'ed
  2004-03-31  9:11 ` Jim Wilson
@ 2004-03-31 10:49   ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2004-03-31 10:49 UTC (permalink / raw)
  To: gcc

Jim Wilson wrote:
> wrong.  This is because the toplevel config-ml.in file does not define 
> FFLAGS.

And it doesn't handle ADAFLAGS either, which will matter if we ever want 
libada multilibbing to work.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-31  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-20 22:35 RFH: trouble getting gfortran to build multilib'ed Steven Bosscher
2004-03-31  9:11 ` Jim Wilson
2004-03-31 10:49   ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).