Subject: How to (almost) build a 64bit lang/gcc3 on Solaris2.8
To: None <tech-pkg@NetBSD.org>
From: Rob Quinn <rquinn@sec.sprint.net>
List: tech-pkg
Date: 07/19/2004 16:50:18
 Under Solaris2.8 the current lang/gcc3 package makes a gcc that can only
produce 32bit binaries.  This means I can't make a functional lsof:

   #gcc -v
   Reading specs from /usr/pkg/gcc3/lib/gcc-lib/sparc-sun-solaris2/3.3.4/specs
   Configured with: ./configure --prefix=/usr/pkg/gcc3 --host=sparc-sun-solaris2 --enable-shared --enable-languages=c
   Thread model: posix
   gcc version 3.3.4
   #gcc -m64 it.c 
   cc1: error: -m64 is not supported by this configuration

   #lsof /
   lsof: FATAL: lsof was compiled for a 32 bit kernel,
	 but this machine has booted a 64 bit kernel.



 If I comment out one line in gcc3/Makefile.common I can build a gcc that
accepts both the -m64 and the -m32 flags, and lsof compiles and runs fine:

   #cvs diff -c1 Makefile.common
   Index: Makefile.common
   ===================================================================
   RCS file: /cvsroot/pkgsrc/lang/gcc3/Makefile.common,v
   retrieving revision 1.8
   diff -c -c -1 -r1.8 Makefile.common
   *** Makefile.common     3 Jul 2004 12:15:22 -0000       1.8
   --- Makefile.common     19 Jul 2004 20:32:48 -0000
   ***************
   *** 59,61 ****
     .endif
   ! CONFIGURE_ARGS+=      --host=${GCC_PLATFORM}
     PLIST_SUBST+=         GCC_PLATFORM=${GCC_PLATFORM}
   --- 59,61 ----
     .endif
   ! #CONFIGURE_ARGS+=     --host=${GCC_PLATFORM}
     PLIST_SUBST+=         GCC_PLATFORM=${GCC_PLATFORM}


   #gcc -v
   Reading specs from /usr/pkg/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.4/specs
   Configured with: ./configure --prefix=/usr/pkg/gcc3 --enable-shared --enable-languages=c
   Thread model: posix
   gcc version 3.3.4
   #gcc -m64 it.c -o it
   #file it
   it: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped



  Unfortunately, this new gcc isn't able to compile gcc3-c++, as it loops
forever.  It looks like it's stuck in the "bmake configure" stage, but if I run
that by hand it works fine.  It's not until the final "bmake" that it starts
looping:

   [...]
   checking for unistd.h... (cached) yes
   checking for sys/time.h... (cached) yes
   checking for sys/resource.h... (cached) yes
   checking for testsuite memory limit support... yes
   checking for setenv declaration... no
   checking for --with-gxx-include-dir... no
   checking for --enable-version-specific-runtime-libs... no
   checking for install location... $(prefix)/include/c++/3.3.4
   creating ./config.status
   creating Makefile
   Adding multilib support to Makefile in .
   with_multisubdir=sparcv9
   chmod: WARNING: can't access mkcheck
   chmod: WARNING: can't access testsuite_flags
   gmake[1]: Leaving directory `/usr/obj/pkg/lang/gcc3-c++/work/gcc-3.3.4/sparc-sun-solaris2.8/libstdc++-v3'
   gmake[1]: Entering directory `/usr/obj/pkg/lang/gcc3-c++/work/gcc-3.3.4/sparc-sun-solaris2.8/libstdc++-v3'
   /bin/sh ./config.status --recheck
   running /bin/sh ./configure  --cache-file=../config.cache --host=sparc-sun-solaris2.8 --build=sparc-sun-solaris2.8 --enable-multilib --with-gcc-version-trigger=/usr/obj/pkg/lang/gcc3-c++/work/gcc-3.3.4/gcc/version.c --prefix=/usr/pkg/gcc3 --enable-shared --enable-languages=c++ --srcdir=. --with-target-subdir=sparc-sun-solaris2.8 --no-create --no-recursion
   loading cache ../config.cache
   checking host system type... sparc-sun-solaris2.8
   checking target system type... sparc-sun-solaris2.8
   checking build system type... sparc-sun-solaris2.8
   checking for Cygwin environment... (cached) no
   checking for mingw32 environment... (cached) no
   checking for gawk... (cached) gawk
   checking whether ln -s works... (cached) yes
   [...]


  I'm guessing it's because something is still set to "solaris2" instead of
"solaris2.8".  Can someone more familiar with gcc and pkgsrc take this on and
come up with a good solution?