# 64 bit on Intel Core 2 Duo (P8600): buildworld error & which GENERIC?



## nikolajg (Apr 9, 2010)

I've made an minimum install of the 8.0-RELEASE-amd64-memstick.img on a server with MSI IM-GM45 motherboard, 4Gb ram and P8600 CPU. I've made an csup using the standard-supfile (RELENG_8_0) to get latest sercurity and bugfixes. I have 2 questions:

QUESTION1: Making "buildworld" gives me this error:


```
cc -O2 -pipe -march=i686 -DHAVE_CONFIG_H -I/usr/src/gnu/lib/libssp/libssp_nonsha
red/..  -I/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/l
ibssp  -I/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/in
clude -fPIC -DPIC -fvisibility=hidden -std=gnu99 -fstack-protector  -c /usr/src/
gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp/ssp-local.c
/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp/ssp-
local.c:1: error: CPU you selected does not support x86-64 instruction set
*** Error code 1

Stop in /usr/src/gnu/lib/libssp/libssp_nonshared.
*** Error code 1
```

QUESTION2: Im going to compile the kernel afterwards because of PF etc. Which GENERIC should I choose as a starting point?

Thanks.
Nikolaj G., Denmark, Copenhagen


----------



## SirDice (Apr 9, 2010)

nikolajg said:
			
		

> QUESTION1: Making "buildworld" gives me this error:


Remove any CPUFLAGS and/or CFLAGS and/or other build options from /etc/make.conf



> QUESTION2: Im going to compile the kernel afterwards because of PF etc. Which GENERIC should I choose as a starting point?


For FreeBSD-amd64 /usr/src/sys/amd64/conf/GENERIC. For FreeBSD-i386 /usr/src/sys/i386/conf/GENERIC. Note the architecture in the path.


----------



## phoenix (Apr 9, 2010)

nikolajg said:
			
		

> I've made an minimum install of the 8.0-RELEASE-amd64-memstick.img on a server with MSI IM-GM45 motherboard, 4Gb ram and P8600 CPU. I've made an csup using the standard-supfile (RELENG_8_0) to get latest sercurity and bugfixes. I have 2 questions:
> 
> QUESTION1: Making "buildworld" gives me this error:
> 
> ...



If you installed the amd64 (64-bit) version, why are you compiling for an i686 (32-bit) version?  Do you have the wrong CPUTYPE listed in /etc/make.conf?  Or are you actually running the 32-bit version of FreeBSD?  What's shown in *uname -a* output?



> QUESTION2: Im going to compile the kernel afterwards because of PF etc. Which GENERIC should I choose as a starting point?



/usr/src/sys/amd64/conf/GENERIC for the amd64 (64-bit) version of FreeBSD.
/usr/src/sys/i386/conf/GENERIC for the i386 (32-bit) version of FreeBSD.


----------



## nikolajg (Apr 12, 2010)

I was using the wrong CPUTYPE. The make.conf was:

```
CPUTYPE=i686
COPTFLAGS= -O2 -pipe -funroll-loops -ffast-math
# added by use.perl 2010-02-16 18:54:12
PERL_VERSION=5.10.1
```

After making an empty make.conf "buildworld" works, cool.

I'll try to fiddle with the COPTFLAGS later on (found this one http://silverwraith.com/papers/freebsd-kernel.php).

The "uname -a" seems ok:

```
FreeBSD netop.classensgade.dk 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009 [email]root@mason.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  amd64
```
, as said, I used 8.0-RELEASE-amd64-memstick.img to install with.

To prove that Im not a complete idiot I was using the amd64 GENERIC at first  Then I began to experiment... just found out that the current one Im using is an i386 GENERIC (not that it will affect buildworld though). I will use the /usr/src/sys/amd64/conf/GENERIC from now on since I want a 64 bit system (have 4Gb ram). One of the problems was that I - wrongly - thought that i686 also meant 64 bit. It doesn't - it means 32 bit (as phoenix point out).

At last, maybe you could save me from some other troubles - are there any package problems using 64 bit. The machine will function as a server and I need to install: Java, JBoss, Tomcat, Apache, Postgresql, MySQL, Plone, Postfix etc.. I could also ask in another way: are there any major package problems on FreeBSD 64 bit compared to 32 bit.

Thanks to both of you, it have been very helpful.

Nikolaj G., Denmark, Copenhagen


----------



## SirDice (Apr 12, 2010)

Remove CPUTYPE and COPTFLAGS. Those options will make things go only marginally faster. And as soon as you run into problems people will tell you to remove them and recompile. So it's best not to fiddle with them until you know exactly what you're doing.


----------



## phoenix (Apr 13, 2010)

You really, really, really, really don't want to be blindly copy/paste'ing random CFLAGS/COPTFLAGS settings into /etc/make.conf.  There is a default set for these that is guaranteed to work for everyone.  Until you know all the ins and outs of the FreeBSD source tree, and how all the different GCC options affects things, don't mess with the defaults.  

Is getting a 1% speed increase worth a 10% decrease in stability?  Is getting a 10% increase worth spending days or even weeks troubleshooting why some app is crashing randomly?


----------



## fronclynne (Apr 13, 2010)

*& if you don't understand why -On where n>3 is meaningless, don't even try*



			
				phoenix said:
			
		

> don't mess with the defaults.



Just to add agreement with this:
Excessively optimising the kernel gives you almost nothing in return.

Last time I tried it, -Os on amd64 gives a system that won't go multiuser and dozens of sh.core files scattered everywhere.  -O3 screwed up stuff too, as with -ffast-math last time I tried it.  Be _very_ careful when mucking about with CFLAGS=, to say nothing of COPTFLAGS=.  -O2, -pipe*, and a couple of the higher -f options are already defined in most of the places they are known to be safe.  Many, if not most, ports also have reasonably good, and non-broken flags already defined.

One of the few areas you can muddle around and get true, honest, and proper gains is in userland applications (I'm thinking mostly things like multimedia/mplayer, maybe www/firefox, perhaps some of the webservers and proxies and games), and that by building your programs with a newer compiler (but see [thread=7454]here[/thread]) and through many tests and hours of poking, better flags being passed to that compiler.  But even then, when stuff breaks one of the first things you'll be asked to do is revert all your insane flags.

*well, okay I doubt -pipe will ever break anything on the *.o side of things.


----------



## nikolajg (Apr 13, 2010)

Ok, 3 people are telling me not to fiddle with CFLAGS/COPTFLAGS. Im not an expert on FreeBSD (yet) - I'll put the task at the bottom of my BSD todo list. And sorry (fronclynne), maybe I was giving the impression that I use the ports tree (compile). I don't if I can avoid, Im too unpatient. Its another thing with the kernel and userland though... and of course if the application needs some addon in Makefile ex. Apache needing ssl (never compiled Apache on FreeBSD, the example is from Linux). Anyway, lets not go into that, unless you mean that I absolutely need to compile anything. Im using FreeBSD for both laptop and servers.

Anyway, none of you answered the question about package complications using 64 bits compared to 32 bit. Are there any problems?

Thanks. Have to say, one thing is choosing FreeBSD - another thing is to get help from the community. Thanks for your time. Have nice day whatever time it is.
Nikolaj G., Denmark, Copenhagen


----------



## SirDice (Apr 13, 2010)

nikolajg said:
			
		

> Anyway, none of you answered the question about package complications using 64 bits compared to 32 bit. Are there any problems?


As far as I know 99% of the things in the ports tree work on 64 bit.


----------



## DutchDaemon (Apr 13, 2010)

Of my 607 installed ports, none threw a fit on 64-bit.


----------



## nikolajg (Apr 13, 2010)

Cool. Anyway, I'll just get on with it. Lets stop the thread here - I'll continue in "ports and packages", if I get into trouble. Thanks to all: phoenix, SirDice, fronclynne and DutchDaemon.

Have a nice day whatever time it is 
Nikolaj G., Denmark, Copenhagen


----------

