<div dir="ltr">Hi Ivan,<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 3:21 PM, Ivan A. Kosarev <span dir="ltr"><<a href="mailto:ivan@ivan-labs.com" target="_blank">ivan@ivan-labs.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Alexey,<div class=""><br>
<br>
On 03/27/2014 04:35 PM, Alexey Samsonov wrote:<br>
<blockquote type="cite">
<div dir="ltr">Here's the reason why I've made this change:
<div class="gmail_extra"><a href="http://llvm.1065342.n5.nabble.com/compiler-rt-CMake-build-ignores-CMAKE-CXX-FLAGS-tp67022.html" target="_blank">http://llvm.1065342.n5.nabble.com/compiler-rt-CMake-build-ignores-CMAKE-CXX-FLAGS-tp67022.html</a></div>
<div class="gmail_extra"><br>
</div>
</div>
</blockquote>
<br></div>
OK, thanks.<br>
<br>
BTW, should we CC this conversation to Konstantin or some other
people as well?</div></blockquote><div><br></div><div>+llvmdev</div><div>Oh, sure. Please cc' llvmdev mailing list for the discussion of sanitizers, especially when discussing portability issues,</div><div>as more people might be interested in that or share their experience.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div class="">
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On
FreeBSD 9.2 I add a couple custom options to
CMAKE_CXX_FLAGS in order to let clang know which header
set it should use, like that:<br>
<br>
CC=clang CXX=clang++ cmake \<br>
-DLLVM_TARGETS_TO_BUILD=X86 \<br>
-DCMAKE_CXX_FLAGS="-I/usr/include/c++/4.8.1
-I/usr/include/c++/4.8.1/x86_64-unknown-freebsd9.2"<br>
</blockquote>
<div><br>
</div>
<div>That seems unfortunate - you add x86_64- headers to
CMAKE_CXX_FLAGS, while sanitizers tests are built in i386
mode.</div>
</div>
</div>
</div>
</blockquote>
<br></div>
Not just that. There are several differences between building llvm
and sanitizers tests that I believe should be taken into account:<br></div></blockquote><div><br></div><div>Correct. Yes, LLVM (and compiler-rt) can be built with gcc and with MSVC. Blindly passing CMAKE_CXX_FLAGS</div>
<div>to Clang when building sanitizer unit tests is... wrong. For now we get away with this (and I decided to commit the mentioned change),</div><div>as sanitizer unit tests are built only on unix with GCC/Clang.</div><div>
<br></div><div>Hopefully this will soon change, and by default we will build all compiler-rt libraries and test suites with just-built Clang. This will allow us to be very specific about command-line flags. Of course "just-built Clang" will still need to use system headers and (for unit tests) even system libraries, so _some_ flags must remain configurable by the user. But I'd rather work on the bright future than fix the existing and ugly clang_compile, clang_link etc. set of rules :) Let me know if you're OK with this, or you are in desperate need of the short-term fix (it prevents you from setting up a buildbot, or smth. like that).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
1) Different compilers. Is bulding llvm with gcc still supported? Is
there a chance llvm (including sanitizers) will support building
with MSVC as the host compiler? What if one will need to add an
option that should only be applied to the llvm components themselves
(that is, not the sanitizers tests)? What if clang and the host
compiler have different command-line interfaces?<br>
<br>
2) Different targets (the point you have mentioned). What if I build
llvm on a 64-bit system and I want to pass some 64-bit specific
options to be applied to the llvm components and not the sanitizers
tests? What should I do to add an option that should only be applied
to i386 tests?<br>
<br>
Consider this: on x86_64 FreeBSD--both 9.2 and 10.0--when build
something in 32-bit mode (-m32) with gcc you have to add
-B/usr/lib32 in order to let the compiler know where it should
search for the libs. As of today, it is recognized as a defect in
the FreeBSD community. However, it appears there will be no fix
available anytime soon due to various complications with how gcc
lookups for libraries. For this reason building LLVM on FreeBSD with
gcc and enabled sanitizers will not be supported.<br>
<br>
In general, it looks to me that adding several variables is not just
a question of more fine-grained control over the build process, but
it also removes unnatural connections between things to be used to
build a clang executable and things to be used to build other pieces
with this executable. I agree that there may be options that are
common to both the cases, but do we really want to force them to be
exactly same?<div class=""><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div> This setting looks like a hack to me - where do you
get new libstdc++ from?</div>
</div>
</div>
</div>
</blockquote>
<br></div>
It's the one from gcc 4.8 distribution.<div class=""><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div> Why is it enough to just change the include paths, but
not change the path to the library location?</div>
</div>
</div>
</div>
</blockquote>
<br></div>
Once the library is installed, its location must be added to
/etc/libmap.conf .<div class=""><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div> Is it possible to install newer version of libstdc++
in the system, so that it's picked up at configure time
w/o the need for additional flags?</div>
</div>
</div>
</div>
</blockquote>
<br></div>
I'm going to spend some more time on digging this matter. Will let
you know.<br>
<br>
Thanks,<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>