Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Error script make.conf flags
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Spanish
View previous topic :: View next topic  
Author Message
nestormh
n00b
n00b


Joined: 12 Feb 2008
Posts: 37

PostPosted: Fri Feb 22, 2008 5:13 pm    Post subject: Error script make.conf flags Reply with quote

WEnas, tengo un problema. Estoi instalando gentoo y aora e encotrado este script por la red que sirve para q diga q flags puede utilizar tu sistema..quiero probarlo pero cuando lo ejecuto me da un error : syntax error near unexpected token '{

E leidoi por ahi que es porque no estoi logueado como admin o algo asi?¿??¿nolose,algo mu extraño. Aber si alguie me puede ayudar plis
Back to top
View user's profile Send private message
jgascon
Apprentice
Apprentice


Joined: 08 Dec 2006
Posts: 252

PostPosted: Fri Feb 22, 2008 5:39 pm    Post subject: Reply with quote

Para saber que flags usar en tu sistema te aconsejo que consultes esta página: http://gentoo-wiki.com/Safe_Cflags
Back to top
View user's profile Send private message
kropotkin
Guru
Guru


Joined: 05 Sep 2005
Posts: 437
Location: Chile

PostPosted: Fri Feb 22, 2008 6:14 pm    Post subject: Re: Error script make.conf flags Reply with quote

nestormh wrote:
WEnas,

:?: :?:
nestormh wrote:
tengo un problema. Estoi instalando gentoo y aora e encotrado este script por la red que sirve para q diga q flags puede utilizar tu sistema..quiero probarlo pero cuando lo ejecuto me da un error : syntax error near unexpected token '{

http://gentoo-wiki.com/Safe_Cflags

nestormh wrote:

E leidoi por ahi que es porque no estoi logueado como admin o algo asi?¿??¿nolose,algo mu extraño. Aber si alguie me puede ayudar plis


falta leer un manual de uso básico de linux y otro de ortografía :wink:
_________________
mi sitio Ñoño
mi sitio no tan Ñoño
Back to top
View user's profile Send private message
achaw
l33t
l33t


Joined: 09 Aug 2006
Posts: 689
Location: Argentina

PostPosted: Fri Feb 22, 2008 8:27 pm    Post subject: Reply with quote

Es un error de sintaxis, lo que quiere decir....que hay algo que sobra en este caso ese corchete. Siempre que hagas una consulta postea toda la info posible, en este caso necesitamos ver tu make.conf. en cuanto a lo que decis, calculo que ni se acerca a lo que realmente es. Como dice el compañero kropotkin, te invitamos la leer la doc oficial y el wiki.


Saludos
_________________
Usuario GNU/Linux #398133
Fluxbox + ROX
NO al canon!
Back to top
View user's profile Send private message
nestormh
n00b
n00b


Joined: 12 Feb 2008
Posts: 37

PostPosted: Fri Feb 22, 2008 8:56 pm    Post subject: Reply with quote

jajajaj haber ya se las flags de mi arquitectura, lo unico q keria es correr el script ese que encontre para ver q flags me daba aparte de las "predeterminadas seguras".... :? y el problema no es de sintaxis porque creo q esta bien...

if [ "$1" = "--version" ]; then
echo "0.4" && exit
fi

[ -z "$CC" ] && CC=gcc

try_march() { <----------------------------------------------------------------ERROR DE SINTAXIS AHI?
$CC -march=$1 -S -o /dev/null -xc /dev/null >/dev/null 2>&1
}

try_line() {
for arch in $1; do
if try_march $arch; then
echo $arch
return
fi
done
return 1
}
Back to top
View user's profile Send private message
achaw
l33t
l33t


Joined: 09 Aug 2006
Posts: 689
Location: Argentina

PostPosted: Fri Feb 22, 2008 9:05 pm    Post subject: Reply with quote

Que paremetros toma ese script? Asi "pelado" es dificil de entender...En cuanto a la sintaxis, parece estar correcta. Mas info.

Saludos
_________________
Usuario GNU/Linux #398133
Fluxbox + ROX
NO al canon!
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Fri Feb 22, 2008 9:59 pm    Post subject: Reply with quote

No se de donde ha salido el script, pero lo cierto que es, si bien es correcto sintácticamente, también es completamente inútil en su estado actual, porque lo que has pegado es una colección de funciones que jamás llegan a ser invocadas, y por tanto es como si no estuvieran.

No tengo ni idea de donde salió esto así que pego una versión revisada de ejemplo que ilustra el uso de estas dos funciones. Por supuesto esto es completamente inútil, pero imagino que en el contexto del script completo tendría un sentido... Sin más información poco puedo hacer, porque ni siquiera sé para que servía el original.

Code:

#!/bin/bash

if [ "$1" = "--version" ]
then
  echo "0.4" && exit
fi

if [ -z "$CC" ]
then
  CC=gcc
fi

if [ -z "$1" ]
then
  echo "Uso: $0 <lista de arquitecturas a probar>"
  echo
  exit 0
fi

try_march() {
  $CC -march=$1 -S -o /dev/null -xc /dev/null >/dev/null 2>&1
}
 
try_line() {
  echo "Arquitecturas suministradas:"
  echo "  $@"
  echo "Arquitecturas válidas para tu versión de gcc:"
  for arch in $@
  do
    if try_march $arch
    then
      echo $arch
      # No estoy seguro que hace esto aquí...
      # Sin conocer el script...
      # return
    fi
  done
  return 1
}
 
try_line "$@"


El resultado del script:

Code:

$ ./test opteron amd64 i386 k8 athlon64 amd64
Arquitecturas suministradas:
  opteron amd64 i386 k8 athlon64 amd64
Arquitecturas válidas para tu versión de gcc:
opteron
k8
athlon64


Como ya digo.... ¿para qué sirve? ni idea... habría que ver el contexto.

Lo mínimo cuando se pide ayuda es mostrar el script completo, a no ser que sea secreto de estado, porque si no, tenemos que adivinar, y se pierde tiempo y esfuerzo :P
Back to top
View user's profile Send private message
nestormh
n00b
n00b


Joined: 12 Feb 2008
Posts: 37

PostPosted: Fri Feb 22, 2008 10:40 pm    Post subject: Reply with quote

PERDONAR... ahi lo teneis jeje

#!/bin/sh

# Author:
# http://www.pixelbeat.org/
# Notes:
# This script is Linux specific
# This script is x86 (32 bit) specific
# It should work on any gcc >= 2.95 at least
# It only returns CPU specific options. You probably also want -03 etc.
# Changes:
# V0.1, 12 Mar 2003, Initial release
# V0.2, 01 Jun 2005, Added support for 3.2>=gcc<=4.0
# V0.3, 03 Jun 2005, Added support for pentium-m
# V0.4, 03 Jun 2005, Fix silly bugs

# This table shows when -march options were introduced into _official_ gcc releases.
# Note there are vendor deviations that complicate this.
# For e.g. redhat introduced the prescott option in 3.3-13.
# gcc-2.95 = i386, i486, i586,pentium, i686,pentiumpro, k6
# gcc-3.0 += athlon
# gcc-3.1 += pentium-mmx, pentium2, pentium3, pentium4, k6-2, k6-3, athlon-{tbird, 4,xp,mp}
# gcc-3.3 += winchip-c6, winchip2, c3
# gcc-3.4.0 += k8,opteron,athlon64,athlon-fx, c3-2
# gcc-3.4.1 += pentium-m, pentium3m, pentium4m, prescott, nocona

if [ "$1" = "--version" ]; then
echo "0.4" && exit
fi

[ -z "$CC" ] && CC=gcc

try_march() {
$CC -march=$1 -S -o /dev/null -xc /dev/null >/dev/null 2>&1
}

try_line() {
for arch in $1; do
if try_march $arch; then
echo $arch
return
fi
done
return 1
}

#manipulate version so can do floating point comparisons
gcc_version=`$CC -dumpversion | sed 's/\([0-9]\{1,\}\.[0-9]\{1,\}\)\.*\([0-9]\{1,\}\)\{0,1\}/\1\2/'`
[ `echo "$gcc_version" | cut -d. -f2 | wc -c` = "2" ] && gcc_version=${gcc_version}0

IFS=":"
while read name value; do
unset IFS
name=`echo $name`
value=`echo $value`
IFS=":"
if [ "$name" == "vendor_id" ]; then
vendor_id="$value"
elif [ "$name" == "cpu family" ]; then
cpu_family="$value"
elif [ "$name" == "model" ]; then
cpu_model="$value"
elif [ "$name" == "flags" ]; then
flags="$value"
break #flags last so break early
fi
done < /proc/cpuinfo
unset IFS

if [ "$vendor_id" == "AuthenticAMD" ]; then
if [ "$cpu_family" == "4" ]; then
_CFLAGS="-march=i486"
elif [ "$cpu_family" == "5" ]; then
if [ "$cpu_model" -lt "4" ]; then
_CFLAGS="-march=pentium"
elif [ "$cpu_model" == "6" ] || [ "$cpu_model" == "7" ]; then
_CFLAGS="-march=k6"
elif [ "$cpu_model" == "8" ] || [ "$cpu_model" == "12" ]; then
line="k6-2 k6"
elif [ "$cpu_model" == "9" ] || [ "$cpu_model" == "13" ]; then
line="k6-3 k6-2 k6"
fi
elif [ "$cpu_family" == "6" ]; then
if [ "$cpu_model" -le "3" ]; then
line="athlon k6-3 k6-2 k6"
elif [ "$cpu_model" == "4" ]; then
line="athlon-tbird athlon k6-3 k6-2 k6"
elif [ "$cpu_model" -ge "6" ]; then #athlon-{4,xp,mp}
line="athlon-4 athlon k6-3 k6-2 k6"
fi
elif [ "$cpu_family" == "15" ]; then #k8,opteron,athlon64,athlon-fx
line="k8 athlon-4 athlon k6-3 k6-2 k6"
fi
elif [ "$vendor_id" == "CentaurHauls" ]; then
if [ "$cpu_family" == "5" ]; then
if [ "$cpu_model" == "4" ]; then
line="winchip-c6 pentium"
elif [ "$cpu_model" == "8" ]; then
line="winchip2 winchip-c6 pentium"
elif [ "$cpu_model" -ge "9" ]; then
line="winchip2 winchip-c6 pentium" #actually winchip3 but gcc doesn't support this currently
fi
elif [ "$cpu_family" == "6" ]; then
if echo "$flags" | grep -q cmov; then
fallback=pentiumpro
else
fallback=pentium #gcc incorrectly assumes i686 always has cmov
fi
if [ "$cpu_model" == "6" ]; then
_CFLAGS="-march=pentium" # ? Cyrix 3 (samuel)
elif [ "$cpu_model" == "7" ] || [ "$cpu_model" == "8" ]; then
line="c3 winchip2 winchip-c6 $fallback"
elif [ "$cpu_model" -ge "9" ]; then
line="c3-2 c3 winchip2 winchip-c6 $fallback"
fi
fi
else #everything else "GenuineIntel"
if [ "$cpu_family" == "3" ]; then
_CFLAGS="-march=i386"
elif [ "$cpu_family" == "4" ]; then
_CFLAGS="-march=i486"
elif [ "$cpu_family" == "5" ]; then
if [ "$cpu_model" != "4" ]; then
_CFLAGS="-march=pentium"
else
line="pentium-mmx pentium" #No overlap with other vendors
fi
elif [ "$cpu_family" == "6" ]; then
if [ "$cpu_model" == "0" ] || [ "$cpu_model" == "1" ]; then
_CFLAGS="-march=pentiumpro"
elif [ "$cpu_model" -ge "3" ] && [ "$cpu_model" -le "6" ]; then #4=TM5600 at least
line="pentium2 pentiumpro pentium-mmx pentium i486 i386"
elif [ "$cpu_model" == "9" ] || [ "$cpu_model" == "13" ]; then
line="pentium-m pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
elif [ "$cpu_model" -ge "7" ] && [ "$cpu_model" -le "11" ]; then
line="pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
fi
elif [ "$cpu_family" == "15" ]; then
if [ "$cpu_model" == "3" ]; then
line="prescott pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
else
line="pentium4 pentium3 pentium2 pentiumpro pentium-mmx pentium i486 i386"
fi
fi
fi

[ -z "$_CFLAGS" ] && _CFLAGS="-march=`try_line "$line"`"

if expr $gcc_version '>=' 3.10 >/dev/null; then
if echo "$flags" | grep -q sse; then
_CFLAGS="$_CFLAGS -mfpmath=sse"
fi
fi

echo "$_CFLAGS"
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Fri Feb 22, 2008 11:00 pm    Post subject: Reply with quote

El script funciona -técnicamente- bien, tal y como lo has pegado. No tiene nada que requiera el uso de una cuenta privilegiada (root).

No lo voy a analizar completamente, pero a mi me da estos regultados:

Code:

$ ./test
-march=k8 -mfpmath=sse


Son correctos, pero el -mfpmath no deja de ser redundante y completamente innecesario. Como la misma página man de gcc nos cuenta:

Quote:

-mfpmath=unit
Generate floating point arithmetics for selected unit unit. The choices for
unit are:
....
sse Use scalar floating point instructions present in the SSE instruction set.
This instruction set is supported by Pentium3 and newer chips, in the AMD
line by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of
SSE instruction set supports only single precision arithmetics, thus the
double and extended precision arithmetics is still done using 387. Later
version, present only in Pentium4 and the future AMD x86-64 chips supports
double precision arithmetics too.

For the i386 compiler, you need to use -march=cpu-type, -msse or -msse2
switches to enable SSE extensions and make this option effective. For the
x86-64 compiler, these extensions are enabled by default.

The resulting code should be considerably faster in the majority of cases
and avoid the numerical instability problems of 387 code, but may break
some existing code that expects temporaries to be 80bit.

This is the default choice for the x86-64 compiler.


No he revisado el script completo así que no se como hace las cosas, ya miraré cuando tenga un rato... Pero no parece dar ningún fallo sintáctico. Si te falla, pega la salida exacta que recibes. Debería haber un número de línea junto al fallo.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Spanish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum