What's better for upgrade base system ? + Question about CFLAGS

Hello

1)What's the best, safer and cleaner way to do an upgrade of the base system if I don't care about the time it's taking to upgrade ?

2)Coming from Gentoo, the C(XX)FLAGS were set explicitly in the make.conf as CFLAGS="-O2 -pipe" same thing for the CXXFLAGS. So I guessed that I would need to set it to in the make.conf of freebsd but when I set it like that CFLAGS= -O2 -pipe a make buildworld failed and some people told me that it wasn't the correct way to set CFLAGS so it was why it's failed. He told me to put a CFLAGS?= -O2 -pipe instead but he told me that it was already the default CFLAGS.So now I'm totally *beep**beep**beep**beep*ed up ! What's the correct way to write CFLAGS in make.conf and if it's already the default, where the FreeBSD official doc tell that ? I search and it's just always an user that is saying that. I just wanna be sure that it's the way that is at to be ! :P

Regards,
eLvis4526
 
1. csup/build from source is clearly 18.973% better than freebsd-update. The proof of this fact is left as an exercise for the reader.

2a. The proper way to set CFLAGS on FreeBSD is to not set them at all; use the defaults. The base system doesn't need them, and ports where it might make a difference will set what is needed by themselves. Do not set CFLAGS in /etc/make.conf, in /etc/src.conf, in a house, with a mouse, with a fox, in a box.

2b. Defaults appear to come from /usr/src/share/mk/sys.mk. Don't touch them. If you want your computer to go faster, paint it red.

Bonus answer:

It is fairly safe to set CPUTYPE in make.conf. It may make a difference.
 
wblock said:
It is fairly safe to set CPUTYPE in make.conf. It may make a difference.

It will, if any of your applications use SIMD (note too, that SIMD is not used inside of the kernel) and you're running a pentium-mmx or better. Building ports with an alternate compiler (gcc44, & such) may be helpful, as well.

But, yes, on modern hardware most of the CFLAGS tuning is pretty useless.
 
fronclynne said:
It will, if any of your applications use SIMD (note too, that SIMD is not used inside of the kernel) and you're running a pentium-mmx or better. Building ports with an alternate compiler (gcc44, & such) may be helpful, as well.

But, yes, on modern hardware most of the CFLAGS tuning is pretty useless.

I know that Atom netbooks feel a little faster with CPUTYPE?=prescott, but have not benchmarked and thought it might be "speed holes".
 
man make.conf(5)()

you need to copy your make.conf from
/usr/src/share/examples/etc/make.conf
to /etc

?= allows the buildworld to use different CPUTYPE. use ?= not the gentoo way.

CXXFLAGS should also be += and not just =.

Please try to avoid over optimization. as it's been mentioned applications which can deal with the tunings may have the flags set for optimization when installing the ports. For OS level programs it's preferred to have a stable OS.

Also note that gcc on bsd may have some spider webs attached to it in comparison to your 'speedy' gentoo install.

If your not on a production system there is nothing wrong with experimenting with your '--fun-roll-loops' rollup flags but keep it in mind when something goes wrong in the compiler that it may be the issue.
 
A customized compilation flag may cause compilation fail!

I recommend you don't do that and I promise that, in most cases, you will not feel better except long compilation time.

Just copy the default flag setting from "/usr/src/share/examples/etc/make.conf".

Further more, I always set "WANT_FORCE_OPTIMIZATION_DOWNGRADE=2".

Seems the CPUTYPE variable is important and you should set it properly in your make.conf.
 
-pipe is a good flag, I've never had a problem with it. It doesn't speed up run time; but should speed up compile time if you have enough RAM and slow disks (though I've never actually benchmarked it, I could be wrong).
 
Indeed -pipe is a safe flag to set, & indeed (to quote /usr/share/mk/sys.mk):
Code:
.if defined(%POSIX)
CC              ?=      c89
CFLAGS          ?=      -O
.else
CC              ?=      cc
.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips"
CFLAGS          ?=      -O -pipe
.else
[b]CFLAGS          ?=      -O2 -pipe[/b]
.endif
.if defined(NO_STRICT_ALIASING)
CFLAGS          +=      -fno-strict-aliasing
.endif
.endif
 
Back
Top