build failures after stdlib update

Garrett Cooper yanefbsd at gmail.com
Tue Mar 23 19:07:30 UTC 2010


On Tue, Mar 23, 2010 at 11:19 AM, Scot Hetzel <swhetzel at gmail.com> wrote:
> On Tue, Mar 23, 2010 at 4:34 AM, Alexander Best <alexbestms at wwu.de> wrote:
>> i don't think conf/112997 and the issue where gcc segfaults are directly
>> related to each other:
>>
>> 1. if CPUTYPE is set to 'native' your patch uses `gcc -v -x c -E -mtune=native
>> /dev/null -o /dev/null 2>&1 | grep mtune | sed -e 's/.*mtune=//'` to determine
>> gcc's idea of the appropriate -mtune value. that command however segfaults. so
>> this doesn't really help.
>
> The command runs correctly with a properly built gcc:
>
> # gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep
> mtune | sed -e 's/.*mtune=//'
> generic
>
>>
>> 2. i wasn't able to reproduce your `make -V MACHINE_CPU -DCPUTYPE=native`
>> examples. for me `make` prints the same no matter what CPUTYPE is set to:
>>
>> otaku% make -V MACHINE_CPU -DCPUTYPE=native
>> amd64 sse2 sse
>> otaku% make -V MACHINE_CPU -DCPUTYPE=nocona
>> amd64 sse2 sse
>> otaku% make -V MACHINE_CPU -DCPUTYPE=i386
>> amd64 sse2 sse
>> otaku% make -V MACHINE_CPU -DCPUTYPE=lalalala
>> amd64 sse2 sse
>>
>> ..oh and of course i ran these commands with no CPUTYPE set in make.conf. ;)
>>
>
> If I run the same commands as above, I get similar results:
>
> # make -V MACHINE_CPU -DCPUTYPE=native
> amd64 sse2 sse
> # make -V MACHINE_CPU -DCPUTYPE=k8
> amd64 sse2 sse
> # make -V MACHINE_CPU -DCPUTYPE=nocona
> amd64 sse2 sse
> # make -V MACHINE_CPU -DCPUTYPE=i386
> amd64 sse2 sse
> # make -V MACHINE_CPU -DCPUTYPE=lala
> amd64 sse2 sse
>
> But if I run the commands without the "-D", it shows the problem correctly:
>
> # make -V MACHINE_CPU CPUTYPE=native
> unknown amd64 sse2 sse mmx
> # make -V MACHINE_CPU CPUTYPE=k8
> k8 3dnow amd64 sse2 sse mmx
> # make -V MACHINE_CPU CPUTYPE=nocona
> sse3 amd64 sse2 sse mmx
> # make -V MACHINE_CPU CPUTYPE=i386
> unknown amd64 sse2 sse mmx
> # make -V MACHINE_CPU CPUTYPE=lalala
> unknown amd64 sse2 sse mmx
> # grep CPUTYPE /etc/make.conf /etc/src.conf
> grep: /etc/src.conf: No such file or directory
>
> This was run under a Feb 28th -CURRENT.
>
> Now here is something strange.  Defining CPUTYPE in /etc/src.conf has
> no effect on the output of MACHING_CPU.
>
> /etc/src.conf: 1 lines, 11 characters.
> # make -V MACHINE_CPU ; grep CPUTYPE /etc/make.conf /etc/src.conf
> amd64 sse2 sse
> /etc/src.conf:CPUTYPE=k8
>
> # make -V MACHINE_CPU ; grep CPUTYPE /etc/make.conf /etc/src.conf
> k8 3dnow amd64 sse2 sse mmx
> /etc/make.conf:CPUTYPE=k8

    CPUTYPE can and should be defined in make.conf; it has been this
way since the "beginning of time" (tongue in cheek). src.conf gets
sourced in bsd.own.mk and make.conf gets sourced in sys.mk. I'll leave
it to you to trace down which gets called first and in what order the
logic gets evaluated, but I'm pretty sure it's doing the wrong thing
when you put CPUTYPE in src.conf. The other thing to keep in mind is
that -VCPUTYPE and -DCPUTYPE are evaluated differently:

     -D variable
             Define variable to be 1, in the global context.

...

     -V variable
             Print make's idea of the value of variable, in the global con-
             text.  Do not build any targets.  Multiple instances of this
             option may be specified; the variables will be printed one per
             line, with a blank line for each null or undefined variable.


    So I think that the example code is probably incorrect for -D ;).
Thanks,
-Garrett


More information about the freebsd-current mailing list