# [SOLVED] core2 in -mtune

## Spiros

Spero di non chiedere cose già chieste, ma non ho trovato nulla.

Sto installando una amd64, il processore è un Intel Core2 Duo. In make.conf ho messo

CFLAGS="-O2 -mtune=core2 -pipe"

CXXFLAGS="-O2 -mtune=core2 -pipe"

ma le compilazioni con portage non vanno. Posto un po' di log:

```

configure:1453: checking for x86_64-pc-linux-gnu-gcc

configure:1469: found /usr/bin/x86_64-pc-linux-gnu-gcc

configure:1479: result: x86_64-pc-linux-gnu-gcc

...

Target: x86_64-pc-linux-gnu

Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure -

-prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/l

ib/gcc/x86_64-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/x86_64-pc

-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man --in

fodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=

/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 --host=x86_64-pc-linux-gnu

 --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-g

ettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt

 --disable-libunwind-exceptions --enable-multilib --enable-libmudflap --disable-

libssp --disable-libgcj --enable-languages=c,c++,treelang,fortran --enable-share

d --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu

Thread model: posix

gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)

configure:1772: $? = 0

configure:1774: x86_64-pc-linux-gnu-gcc -V </dev/null >&5

x86_64-pc-linux-gnu-gcc: '-V' option must have argument

configure:1777: $? = 1

configure:1800: checking for C compiler default output file name

configure:1803: x86_64-pc-linux-gnu-gcc -O2 -mtune=core2 -pipe  -Wl,-O1 conftest.c  >&5

conftest.c:1: error: bad value (core2) for -mtune= switch

configure:1806: $? = 1

```

Dice che "error: bad value (core2) for -mtune", eppure io ho guardato qui: http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html e core2 esiste.

In pratica ora portage è bloccato perché non può compilare niente. Ah, io ho provato a compilare con g++ e con x86_64-pc-linux-gnu-gcc un "Hello world" in c++ e funzionano.

EDIT:

Ora ho provato a compilare il mio hello world con il comando "g++ -mtune=core2 hello.cpp" ed effettivamente viene restituito l'errore che ho già segnalato. Ho provato a mettere generic, native e altri e non funziona mai, dice sempre che il valore non è valido per lo switch -mtune=. È strano, sembra che non riconosca lo switch. E la cosa più strana è che se faccio man gcc o man g++ dice che la pagina di manuale non esiste e se do g++ --help stampa questo:

```

Usage: g++ [options] file...

Options:

  -pass-exit-codes         Exit with highest error code from a phase

  --help                   Display this information

  --target-help            Display target specific command line options

  (Use '-v --help' to display command line options of sub-processes)

  -dumpspecs               Display all of the built in spec strings

  -dumpversion             Display the version of the compiler

  -dumpmachine             Display the compiler's target processor

  -print-search-dirs       Display the directories in the compiler's search path

  -print-libgcc-file-name  Display the name of the compiler's companion library

  -print-file-name=<lib>   Display the full path to library <lib>

  -print-prog-name=<prog>  Display the full path to compiler component <prog>

  -print-multi-directory   Display the root directory for versions of libgcc

  -print-multi-lib         Display the mapping between command line options and

                           multiple library search directories

  -print-multi-os-directory Display the relative path to OS libraries

  -Wa,<options>            Pass comma-separated <options> on to the assembler

  -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  -Wl,<options>            Pass comma-separated <options> on to the linker

  -Xassembler <arg>        Pass <arg> on to the assembler

  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor

  -Xlinker <arg>           Pass <arg> on to the linker

  -combine                 Pass multiple source files to compiler at once

  -save-temps              Do not delete intermediate files

  -pipe                    Use pipes rather than intermediate files

  -time                    Time the execution of each subprocess

  -specs=<file>            Override built-in specs with the contents of <file>

  -std=<standard>          Assume that the input sources are for <standard>

  --sysroot=<directory>    Use <directory> as the root directory for headers

                           for headers and libraries

  -B <directory>           Add <directory> to the compiler's search paths

  -b <machine>             Run gcc for target <machine>, if installed

  -V <version>             Run gcc version number <version>, if installed

  -v                       Display the programs invoked by the compiler

  -###                     Like -v but options quoted and commands not executed

  -E                       Preprocess only; do not compile, assemble or link

  -S                       Compile only; do not assemble or link

  -c                       Compile and assemble, but do not link

  -o <file>                Place the output into <file>

  -x <language>            Specify the language of the following input files

                           Permissible languages include: c c++ assembler none

                           'none' means revert to the default behavior of

                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically

 passed on to the various sub-processes invoked by g++.  In order to pass

 other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:

<URL:http://bugs.gentoo.org/>.

```

----------

## mack1

```

-mtune=core2

```

Se hai gcc 4.3*, controlla la tua versione di gcc.

Comunque prova con:

```

 -mtune=nocona

```

La versione stabile in portage è gcc-4.1.2 e non supporta core2.

Se hai la necessità di creare codice generico -mtune va bene, ma normalmente si usa -march.

per le CFLAGS guarda qui:

http://en.gentoo-wiki.com/wiki/Safe_Cflags

Ciao

----------

## Spiros

Sì, ho la 4.1.2. E non sono supportati neanche generic o native? Sono andato a vedere e dice di usare nocona. Effettivamente funziona. Grazie.

----------

## k01

http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Intel_Core_2_Duo.2FQuad_.2F_Xeon_51xx.2F53xx.2F54xx.2C_Pentium_Dual-Core_T23xx.2B.2FExxxx

----------

