You are not logged in.

#1 2009-02-27 20:08:03

Phlogiston
Member
Registered: 2009-02-14
Posts: 39

can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

I need this specific version of gcc, so I got the old PKDBUILD from svn, see below. However when gcc compiles I run into this compile error:

TARGET_CPU_DEFAULT="" \                                                                                                                                         
        HEADERS="auto-host.h ansidecl.h" DEFINES="USED_FOR_TARGET " \                                                                                           
        /bin/sh ../../gcc-4.1.2/gcc/mkconfig.sh tconfig.h                                                                                                       
./xgcc -B./ -B/usr/i686-pc-linux-gnu/bin/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -L/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc/../ld -O2 -O2 -march=i686 -mtune=generic -O2 -pipe  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I. -I../../gcc-4.1.2/gcc -I../../gcc-4.1.2/gcc/. -I../../gcc-4.1.2/gcc/../include -I../../gcc-4.1.2/gcc/../libcpp/include   -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time  -fno-omit-frame-pointer \                     
          -c ../../gcc-4.1.2/gcc/crtstuff.c -DCRT_BEGIN \                                                                                                       
          -o crtbegin.o                                                                                                                                         
../../gcc-4.1.2/gcc/crtstuff.c:1: error: bad value (generic) for -mtune= switch                                                                                 
make[2]: *** [crtbegin.o] Error 1                                                                                                                               
make[2]: Leaving directory `/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc'                                                                                      
make[1]: *** [stage1_build] Error 2                                                                                                                             
make[1]: Leaving directory `/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc'                                                                                      
make: *** [bootstrap] Error 2                                                                                                                                   
==> ERROR: Build Failed.                                                                                                                                        
    Aborting...

Here is the PKGBUILD I use:

# $Id: PKGBUILD,v 1.60 2007/02/14 14:53:50 jgc Exp $
# Maintainer: Jan de Groot <jgc@archlinux.org>      
pkgname=gcc                                         
pkgver=4.1.2                                        
pkgrel=3                                            
pkgdesc="The GNU Compiler Collection"               
arch=(i686 x86_64)                                  
url="http://gcc.gnu.org"                            
depends=('glibc' 'binutils>=2.17')                  
options=('!libtool')                                
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-{core,g++,objc}-${pkgver}.tar.bz2
        ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/libstdc++-man-4.0.0.tar.bz2               
        DW_CFA_val.patch                                                                      
        gcc_pure64.patch)                                                                     
md5sums=('2af3fb599635219171c6ae1f3034888a' '75c6d5fa3415d614314caf0f509e8933'                
         'abda05c0ab99059e8f9e7a625361fd87' '2be86d2117c8fa7f9ec2845cc0660ab1'                
         '078680c207f7cd490044d4a53edf158d' '1ceaa49e3a1d9f984ecc2893c43f7425')               

build() {
  export MAKEFLAGS="-j1"
  cd ${startdir}/src/gcc-${pkgver}
  # Don't install libiberty       
  sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in

  if [ "${CARCH}" = "x86_64" ]; then
    patch -Np1 -i ../gcc_pure64.patch || return 1
  fi
  patch -Np0 -i ${startdir}/src/DW_CFA_val.patch || return 1

  # Don't run fixincludes
  sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
  mkdir ../gcc-build
  cd ../gcc-build
  ../gcc-${pkgver}/configure --prefix=/usr --enable-shared \
      --enable-languages=c,c++,objc --enable-threads=posix \
      --enable-__cxa_atexit  --disable-multilib --libdir=/usr/lib \
      --libexecdir=/usr/lib --enable-clocale=gnu

  make bootstrap || return 1
  make DESTDIR=${startdir}/pkg install || return 1
  mkdir -p ${startdir}/pkg/lib
  (cd ${startdir}/pkg/lib; ln -s ../usr/bin/cpp)
  (cd ${startdir}/pkg/usr/bin; ln -sf gcc cc; ln -sf g++ c++)

  # install the libstdc++ man pages
  mkdir -p ${startdir}/pkg/usr/man/man3
  install -m644 ${startdir}/src/man/man3/* ${startdir}/pkg/usr/man/man3/
}

Last edited by Phlogiston (2009-02-27 20:08:37)

Offline

#2 2009-03-09 22:18:57

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,541

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

Check /etc/makepkg. The default CFLAGS use -mtune=generic (read GCC docs for more info on march and mtune). For whatever reason, the old GCC doesn't like generic. Try removing mtune and setting march to your CPU (e.g. march=pentium2). This is usually smart anyways for any compiling. Note that the older GCC does not support some CPUs (for example, instead of -march=core2 you must use -march=nocona).

Offline

#3 2009-03-09 23:40:26

Phlogiston
Member
Registered: 2009-02-14
Posts: 39

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

Hehe better late that never right?

In the meantime I found that out and corrected it. Furthermore I had to install gcc somewhat slotted to get it installed without conflicts. So I changed the pkgbuild file a little more. If anyone is interested I could share it.

Offline

#4 2009-03-11 20:30:53

Schnouki
Member
From: Nancy, France
Registered: 2007-10-28
Posts: 21
Website

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

Phlogiston,

I'd be quite interested in your modified PKGBUILD (I also need gcc 4.1 -- the latest CUDA SDK doesn't support gcc 4.3 very well...). Could you please post it?


There's no place like ::1

Offline

#5 2009-03-11 20:38:12

Allan
Member
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,028
Website

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

See http://aur.archlinux.org/packages/gcc-s … t/PKGBUILD

Essentially, add "--program-suffix=-4.1 --enable-version-specific-runtime-libs" to the configure flags and remove conflicts.

Offline

#6 2009-03-11 21:10:01

Phlogiston
Member
Registered: 2009-02-14
Posts: 39

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

or here you go:

# $Id: PKGBUILD,v 1.60 2007/02/14 14:53:50 jgc Exp $                                                       
# Maintainer: Jan de Groot <jgc@archlinux.org>                                                             
pkgname=gcc-4.1                                                                                            
pkgver=4.1.2                                                                                               
pkgrel=3                                                                                                   
pkgdesc="The GNU Compiler Collection"                                                                      
arch=(i686 x86_64)                                                                                         
url="http://gcc.gnu.org"                                                                                   
depends=('glibc' 'binutils>=2.17')                                                                         
options=('!libtool')                                                                                       
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-{core,g++,objc}-${pkgver}.tar.bz2             
        ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/libstdc++-man-4.0.0.tar.bz2                            
        DW_CFA_val.patch                                                                                   
        gcc_pure64.patch)                                                                                  
md5sums=('2af3fb599635219171c6ae1f3034888a' '75c6d5fa3415d614314caf0f509e8933'                             
         'abda05c0ab99059e8f9e7a625361fd87' '2be86d2117c8fa7f9ec2845cc0660ab1'                             
         '078680c207f7cd490044d4a53edf158d' '1ceaa49e3a1d9f984ecc2893c43f7425')                            

build() {
  export MAKEFLAGS="-j1"                                                                                                                                        
  cd ${startdir}/src/gcc-${pkgver}                                                                                                                              
  # Don't install libiberty                                                                                                                                     
  sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in                                                                                                

  if [ "${CARCH}" = "x86_64" ]; then
    patch -Np1 -i ../gcc_pure64.patch || return 1
  fi
  patch -Np0 -i ${startdir}/src/DW_CFA_val.patch || return 1

  # Don't run fixincludes
  sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
  mkdir ../gcc-build
  cd ../gcc-build
  ../gcc-${pkgver}/configure --prefix=/opt/gcc-4.1 --enable-shared \
      --enable-languages=c,c++,objc --enable-threads=posix \
      --enable-__cxa_atexit  --disable-multilib \
      --enable-clocale=gnu

  make bootstrap || return 1
  make DESTDIR=${startdir}/pkg install || return 1
  mkdir -p ${startdir}/pkg/lib
#  (cd ${startdir}/pkg/lib; ln -s ../usr/bin/cpp)
#  (cd ${startdir}/pkg/usr/bin; ln -sf gcc cc; ln -sf g++ c++)

  # install the libstdc++ man pages
  mkdir -p ${startdir}/pkg/usr/man/man3
  install -m644 ${startdir}/src/man/man3/* ${startdir}/pkg/usr/man/man3/
}

Offline

#7 2009-03-12 11:20:13

Schnouki
Member
From: Nancy, France
Registered: 2007-10-28
Posts: 21
Website

Re: can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

Thanks to both of you, it worked perfectly using a modified gcc-snapshot PKGBUILD smile


There's no place like ::1

Offline

Board footer

Powered by FluxBB