As well as i know variables works this way: # set foo=bar # set | grep foo _ set foo=bar foo bar # echo $foo bar # echo ${foo} bar So maybe someone could explain me why following things happens with variables in make.conf? My make.conf: CPUTYPE=athlon64 MAKEOPTS=-j3 # USE CCACHE .if !defined(NOCCACHE) CC=/usr/local/libexec/ccache/world-cc CXX=/usr/local/libexec/ccache/world-c++ .endif # default build settings for ports collection .if ${.CURDIR:M*/ports/*} CFLAGS= -O2 -fno-strict-aliasing -pipe -funroll-loops -fomit-frame-pointer CXXFLAGS= -O2 -fno-strict-aliasing -pipe -funroll-loops .endif # default build settings for base system .if ${.CURDIR:M*/usr/src/*} || ${.CURDIR:M*/usr/obj/*} CFLAGS=-O2 -fno-strict-aliasing -pipe #CXXFLAGS=-O2 -fno-strict-aliasing -pipe COPTFLAGS=-O2 -fno-strict-aliasing -pipe CXXFLAGS=${CFLAGS} #COPTFLAGS=${CFLAGS} .endif # added by use.perl 2008-04-14 10:39:38 PERL_VER=5.8.8 PERL_VERSION=5.8.8 As you see I use ccache and different flags for world and port building, but what's interesting: 1. when I use these flags: CFLAGS=-O2 -fno-strict-aliasing -pipe CXXFLAGS=${CFLAGS} COPTFLAGS=${CFLAGS} world building finish without problem, but making kernel give an error: -------------------------------------------------------------- >>> stage 3.1: making dependencies -------------------------------------------------------------- cd /usr/obj/usr/src/sys/AMD64SMP7; MAKEOBJDIRPREFIX=/usr/obj MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE=athlon64 GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac _SHLIBDIRPREFIX=/usr/obj/usr/src/tmp VERSION="FreeBSD 7.1-PRERELEASE amd64 700112" INSTALL="sh /usr/src/tools/install.sh" PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin NO_CTF=1 make KERNEL=kernel depend -DNO_MODULES_OBJ machine -> /usr/src/sys/amd64/include Variable CFLAGS is recursive. *** Error code 2 Stop in /usr/src. *** Error code 1 Stop in /usr/src. 2. When I use these flags: CFLAGS=-O2 -fno-strict-aliasing -pipe CXXFLAGS=-O2 -fno-strict-aliasing -pipe COPTFLAGS=-O2 -fno-strict-aliasing -pipe kernel build finish without problem, but... building world give an error!: ===> gnu/lib/libstdc++ (depend) ln -sf /usr/src/gnu/lib/libstdc++/../../../contrib/libstdc++/config/cpu/generic/ atomicity_builtins/atomicity.h atomicity.cc ln -sf /usr/src/gnu/lib/libstdc++/../../../contrib/gcc/unwind-generic.h unwind.h rm -f .depend (...) /usr/src/gnu/lib/libstdc++/../../../contrib/libstdc++/libsupc++/unwind-cxx.h:41: 20: error: unwind.h: No such file or directory In file included from /usr/src/gnu/lib/libstdc++/../../../contrib/libstdc++/libs upc++/vec.cc:37: /usr/src/gnu/lib/libstdc++/../../../contrib/libstdc++/libsupc++/unwind-cxx.h:41: 20: error: unwind.h: No such file or directory mkdep: compile failed *** Error code 1 Stop in /usr/src/gnu/lib/libstdc++. *** Error code 1 Stop in /usr/src/gnu/lib. *** Error code 1 3. What's even more funny? When I use flags: CFLAGS=-O2 -fno-strict-aliasing -pipe COPTFLAGS=-O2 -fno-strict-aliasing -pipe CXXFLAGS=${CFLAGS} I have no errors at all! But shouldn't all those flags be treated by make command exactly the same way?? It isn't new issue - it's couple of months as I face this problem - on AMD 64 machine with CPUTYPE=athlon64 and MAKEOPTS=-j3 and olso on i386 machine with CPUTYPE=pentium2 and MAKEOPTS=-j2. Other flags are the same as in the beginning of this message. Another machine - exactly the same flags but CPUTYPE=athlon-tbird and MAKEOPTS=-j2 and no problems compiling world and kernel regardless of flags combination. Could anyone explain to me sthis trange behaviour ? p.s. Sorry for my poor english ;) -- Bartosz Stec - specjalista ds. IT AUXILIA Sp??ka z o.o.
Hello Bartosz, Friday, September 5, 2008, 6:12:12 AM, you wrote:> My make.conf: > CPUTYPE=athlon64 > MAKEOPTS=-j3I would recommend to take that -j3 out from make.conf, it might screw up make install, not to mention many ports might not build with it.> # USE CCACHE > .if !defined(NOCCACHE) > CC=/usr/local/libexec/ccache/world-cc > CXX=/usr/local/libexec/ccache/world-c++ > .endifAFAIK this is setting for building world, the way you set it up seems to be using it for everything else (i.e. ports) I belive this is the recommended way of using it: .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE) CC=/usr/local/libexec/ccache/world-cc CXX=/usr/local/libexec/ccache/world-c++ .endif> 1. when I use these flags:> CFLAGS=-O2 -fno-strict-aliasing -pipe > CXXFLAGS=${CFLAGS} > COPTFLAGS=${CFLAGS}> world building finish without problem, but making kernel give an error:> 2. When I use these flags:> CFLAGS=-O2 -fno-strict-aliasing -pipe > CXXFLAGS=-O2 -fno-strict-aliasing -pipe > COPTFLAGS=-O2 -fno-strict-aliasing -pipe> kernel build finish without problem, but... building world give an error!:> 3. What's even more funny? When I use flags:> CFLAGS=-O2 -fno-strict-aliasing -pipe > COPTFLAGS=-O2 -fno-strict-aliasing -pipe > CXXFLAGS=${CFLAGS}> I have no errors at all! But shouldn't all those flags be treated by > make command exactly the same way??I think the strange behavior probably is because make.conf is called each time a make is executed. Building world, kernel etc. Will call multiple makes inside of another make. I suspect some of the Makefiles might append additional flags, so the ${CFLAGS} might change its value in different parts of the compiling, so that's why you might get the weird errors. I guess perhaps you could use the last option since it works, or instead of using = you would use ?i.e. CFLAGS ?= -O2 -fno-strict-aliasing -pipe This will assign cflags only if CFLAGS is empty. -- Best regards, Derek mailto:takeda@takeda.tk -- Be nice to your kids. They'll choose your nursing home.