Hi Folks,
I bought a new PC with FreeBSD compatibility in mind (ASUS P8P67 + Core i5 2500K). Then I configured my make.conf like this:
But when I built some ports like pkg-config I got this:
It seems GCC produces some code which is not compatible with my CPU. This is what I've got from GCC 4.6 when I compile a Hello World program:
As you can see I've got Corei7-avx for march and mtune, and mavx parameters for cc1plus:
Which I'm sure supported by my CPU: http://www.phoronix.com/scan.php?page=article&item=intel_corei5_2500k&num=1.
When I portupgrade -af using CPUTYPE?=core2 everything builds fine. But I've got -march=nocona which I'm not comfortable with. I think it comes from /usr/share/mk/bsd.cpu.mk
I still did not tried 4.7, because I doubt its stability.
Any suggestions?
I bought a new PC with FreeBSD compatibility in mind (ASUS P8P67 + Core i5 2500K). Then I configured my make.conf like this:
Code:
CPUTYPE?=native
CFLAGS= -O2 -fno-strict-aliasing -pipe -fomit-frame-pointer
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc46)
CC=gcc46
CXX=g++46
CPP=cpp46
.endif
# added by use.perl 2011-04-29 23:52:16
PERL_VERSION=5.10.1
But when I built some ports like pkg-config I got this:
Code:
checking system definitions for POLLIN POLLOUT POLLPRI POLLERR POLLHUP POLLNVAL.
.. done
configure: creating ./config.status
config.status: creating glib.spec
config.status: creating Makefile
config.status: creating glib-config
config.status: creating gmodule/gmoduleconf.h
config.status: creating gmodule/Makefile
config.status: creating gthread/Makefile
config.status: creating docs/Makefile
config.status: creating docs/glib-config.1
config.status: creating tests/Makefile
config.status: creating glib.pc
config.status: creating gmodule.pc
config.status: creating gthread.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
creating glibconfig.h
config.status: executing default commands
===> Building for pkg-config-0.25_1
Illegal instruction (core dumped)
*** Error code 1
Stop in /usr/ports/devel/pkg-config.
It seems GCC produces some code which is not compatible with my CPU. This is what I've got from GCC 4.6 when I compile a Hello World program:
Code:
13x17# g++46 -v -march=native -o t t.cpp
Using built-in specs.
COLLECT_GCC=g++46
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1
/lto-wrapper
Target: x86_64-portbld-freebsd8.2
Configured with: ./../gcc-4.6-20110422/configure --disable-nls --libdir=/usr/loc
al/lib/gcc46 --libexecdir=/usr/local/libexec/gcc46 --program-suffix=46 --with-as
=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/g
cc46/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj
--prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc46 --b
uild=x86_64-portbld-freebsd8.2
Thread model: posix
gcc version 4.6.1 20110422 (prerelease) (FreeBSD Ports Collection)
COLLECT_GCC_OPTIONS='-v' '-march=native' '-o' 't' '-shared-libgcc'
/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/cc1plus -quiet -v
t.cpp -march=corei7-avx -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx --param l1-c
ache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=cor
ei7-avx -quiet -dumpbase t.cpp -auxbase t -version -o /var/tmp//ccdxjzo7.s
GNU C++ (FreeBSD Ports Collection) version 4.6.1 20110422 (prerelease) (x86_64-p
ortbld-freebsd8.2)
compiled by GNU C version 4.6.1 20110422 (prerelease), GMP version 5.0.1
, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8
.2/4.6.1/../../../../../x86_64-portbld-freebsd8.2/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc46/include/c++/
/usr/local/lib/gcc46/include/c++//x86_64-portbld-freebsd8.2
/usr/local/lib/gcc46/include/c++//backward
/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/include
/usr/local/include
/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/include-fixed
/usr/include
End of search list.
GNU C++ (FreeBSD Ports Collection) version 4.6.1 20110422 (prerelease) (x86_64-p
ortbld-freebsd8.2)
compiled by GNU C version 4.6.1 20110422 (prerelease), GMP version 5.0.1
, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1cba659807ed6c09fa5b2b94711e7744
COLLECT_GCC_OPTIONS='-v' '-march=native' '-o' 't' '-shared-libgcc'
/usr/local/bin/as -v -o /var/tmp//ccq3XPOP.o /var/tmp//ccdxjzo7.s
GNU assembler version 2.21 (x86_64-portbld-freebsd8.2) using BFD version (GNU Bi
nutils) 2.21
COMPILER_PATH=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/:/usr
/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/:/usr/local/libexec/gcc
46/gcc/x86_64-portbld-freebsd8.2/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebs
d8.2/4.6.1/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/:/usr/local/lib/g
cc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/../../../../../x86_64-portbld-freebsd8.
2/bin/
LIBRARY_PATH=/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/:/usr/loca
l/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/../../../../../x86_64-portbld-fr
eebsd8.2/lib/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/../../../
:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-march=native' '-o' 't' '-shared-libgcc'
/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/collect2 --eh-fram
e-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o t /usr/lib/crt1.o /usr/lib/crti
.o /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/crtbegin.o -L/usr/lo
cal/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1 -L/usr/local/lib/gcc46/gcc/x86
_64-portbld-freebsd8.2/4.6.1/../../../../../x86_64-portbld-freebsd8.2/lib -L/usr
/local/lib/gcc46/gcc/x86_64-portbld-freebsd8.2/4.6.1/../../.. /var/tmp//ccq3XPOP
.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc46/gcc/x86_64-
portbld-freebsd8.2/4.6.1/crtend.o /usr/lib/crtn.o
GNU ld (GNU Binutils) 2.21
Supported emulations:
elf_x86_64_fbsd
elf_i386_fbsd
elf_x86_64
elf_i386
elf_l1om
elf_l1om_fbsd
As you can see I've got Corei7-avx for march and mtune, and mavx parameters for cc1plus:
Code:
-march=corei7-avx -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx --param l1-c
ache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=cor
ei7-avx
Which I'm sure supported by my CPU: http://www.phoronix.com/scan.php?page=article&item=intel_corei5_2500k&num=1.
When I portupgrade -af using CPUTYPE?=core2 everything builds fine. But I've got -march=nocona which I'm not comfortable with. I think it comes from /usr/share/mk/bsd.cpu.mk
Code:
. endif
. elif ${MACHINE_ARCH} == "amd64"
. if ${CPUTYPE} == "prescott" || ${CPUTYPE} == "core2"
CPUTYPE = nocona
. endif
. endif
I still did not tried 4.7, because I doubt its stability.
Any suggestions?