Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Sep 2011 01:28:15 +0300
From:      Volodymyr Kostyrko <c.kworr@gmail.com>
To:        Olivier Smedts <olivier@gid0.org>
Cc:        freebsd-current@freebsd.org, Dimitry Andric <dim@freebsd.org>
Subject:   Re: Compiling BETA2 with clang fails
Message-ID:  <4E654CFF.6000307@gmail.com>
In-Reply-To: <CABzXLYM94zip6p7XVdA=2ChuFuzV2VVf8pY%2BifYpHchP2%2Bsgrg@mail.gmail.com>
References:  <j3u29f$bv8$1@dough.gmane.org> <4E62915E.1010405@FreeBSD.org> <4E6294E0.5010104@gmail.com> <4E6298DE.5090007@FreeBSD.org> <4E644993.4090703@gmail.com> <CABzXLYPmvd2DdeQMx9uYq5spCK%2BR3ikOZOO6M_M-L2SgnEE74w@mail.gmail.com> <4E654664.1010504@gmail.com> <CABzXLYM94zip6p7XVdA=2ChuFuzV2VVf8pY%2BifYpHchP2%2Bsgrg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
06.09.2011 01:11, Olivier Smedts wrote:
>>>> ===>    libexec/atrun (all)
>>>> clang -O2 -pipe -march=native -DATJOB_DIR=\"/var/at/jobs/\"
>>>> -DLFILE=\"/var/at/jobs/.lockfile\"  -DLOADAVG_MX=1.5
>>>> -DATSPOOL_DIR=\"/var/at/spool\"  -DVERSION=\"2.9\" -DDAEMON_UID=1
>>>> -DDAEMON_GID=1  -DDEFAULT_BATCH_QUEUE=\'E\'  -DDEFAULT_AT_QUEUE=\'c\'
>>>> -DPERM_PATH=\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at
>>>> -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99 -fstack-protector
>>>> -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized
>>>> -Wno-pointer-sign
>>>> -c /usr/src/libexec/atrun/atrun.c
>>>
>>> Try removing "-march=native" from your CFLAGS.
>>>
>>> I have the exact same problem since months on my Core i7 CPU when
>>> using "-march=native" or "-march=corei7". No problems for me with
>>> "-march=core2" though.
>>
>> It so nice you have noted that. I'll be much happier if you also spare some
>> time reading my previous emails.
>
> Or you could search this mailing list for the exact same problem
> reported some time ago.

Well... I know that clang with -march=native can produce flawed binaries 
but it's quite common for them to SEGFAULT and SIGILL so I made at least 
a clean build to check that this is not the problem.

>> As I noted before this command fails only if run as a part of 'make
>> buildworld'. If I cd to that directory and run the same command from there
>> it completes successfully yielding working binary. If the error would be
>> related to -fPIC, ccache or -march it'll end up with other bunch of error
>> messages and result would be irrelevant of invocation and environment.
>
> If you cd to that directory, you'll use the system clang, let's call
> it the "good" clang.
>
> If you buildworld with -march=native or -march=corei7, you'll first
> compile a bootstrap clang with -march=native or -march=corei7 (the
> "bad" one) and that one will fail building libexec/atrun. Chicken and
> egg problem.
>
> If you try building and installing clang with -march=native or
> -march=corei7, you'll have the same error if you then cd to that
> directory and make.
>
>> As I suspect some incorrect buildworld behavior I have no other choice as
>> running another clean build and presenting new logs. Here you go:

I really mean a clean build here. /usr/obj was wiped and I started from 
scratch. And it gives me the same error. This is not the problem with 
-march.

>> clang -O2 -pipe  -DATJOB_DIR=\"/var/at/jobs/\"
>> -DLFILE=\"/var/at/jobs/.lockfile\"  -DLOADAVG_MX=1.5
>> -DATSPOOL_DIR=\"/var/at/spool\"  -DVERSION=\"2.9\" -DDAEMON_UID=1
>> -DDAEMON_GID=1  -DDEFAULT_BATCH_QUEUE=\'E\'  -DDEFAULT_AT_QUEUE=\'c\'
>> -DPERM_PATH=\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at
>> -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99 -fstack-protector
>> -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialize
>> d -Wno-pointer-sign  -o atrun atrun.o gloadavg.o -lpam -lutil
>> clang: warning: argument unused during compilation: '-std=gnu99'

Anyway you are right. Using /usr/obj/usr/src/tmp/usr/bin/clang gives me 
the same error while installed clang works. So this is really problem 
with clang.

-- 
Sphinx of black quartz judge my vow.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E654CFF.6000307>