<div dir="ltr"><div class="gmail_extra">Hi Dmitri,<br><br><div class="gmail_quote">On Sat, Mar 22, 2014 at 11:50 PM, Dmitri Gribenko <span dir="ltr"><<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>></span> wrote:<br>
<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">Hello,<br>
<br>
It looks like compiler-rt CMake scripts don't take CMAKE_CXX_FLAGS<br>
into account.  This is because clang_compile and clang_link_shared<br>
functions call the newly-built compiler directly, and they don't add<br>
those flags.<br></blockquote><div><br></div><div>Indeed.</div><div> </div><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">

<br>
Using CMAKE_CXX_FLAGS is necessary on systems where the C++11-enabled<br>
libstdc++ is installed not in the default location.  For example, the<br>
CentOS buildbot uses:<br>
<br>
-DCMAKE_CXX_FLAGS=--gcc-toolchain=/opt/centos/devtoolset-1.1/root/usr<br>
<br>
I tried adding ${CMAKE_CXX_FLAGS} to the compiler invocation in<br>
clang_compile (with and without quotes), but in both cases the<br>
resulting command is not correct, all of CMAKE_CXX_FLAGS is treated as<br>
a single option, for example:<br></blockquote><div><br></div><div>Yes, recently I discovered the same problem and also though of adding CMAKE_CXX_FLAGS<br>to manual clang invocations. I think it just needs to be done.</div>
<div> </div><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">
<br>
[6/67] Generating gtest-all.cc.x86_64.o<br>
FAILED: cd /home/llvmbb/clang/build-cmake-r+a/projects/compiler-rt/lib/tsan/tests/unit<br>
&& /home/llvmbb/clang/build-cmake-r+a/./bin/clang -fPIC -fno-builtin<br>
-fno-exceptions -fomit-frame-pointer -funwind-tables<br>
-fno-stack-protector -fvisibility=hidden -fno-function-sections -O3<br>
-gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions<br>
-Wno-non-virtual-dtor -fPIE -fno-rtti -DGTEST_NO_LLVM_RAW_OSTREAM=1<br>
-I/home/llvmbb/clang/llvm/utils/unittest/googletest/include<br>
-I/home/llvmbb/clang/llvm/utils/unittest/googletest<br>
-I/home/llvmbb/clang/llvm/projects/compiler-rt/lib<br>
-I/home/llvmbb/clang/llvm/projects/compiler-rt/lib/tsan/rtl -std=c++11<br>
-DGTEST_HAS_RTTI=0<br>
--gcc-toolchain=/opt/centos/devtoolset-1.1/root/usr\ -fPIC\<br>
-fvisibility-inlines-hidden\ -Wall\ -W\ -Wno-unused-parameter\<br>
-Wwrite-strings\ -Wmissing-field-initializers\ -pedantic\<br>
-Wno-long-long\ -Wcovered-switch-default\ -Wnon-virtual-dtor\<br>
-std=c++11\ -fcolor-diagnostics\ -ffunction-sections\ -fdata-sections\<br>
-Wall\ -std=c++11 -m64 -c -o gtest-all.cc.x86_64.o<br>
/home/llvmbb/clang/llvm/utils/unittest/googletest/src/gtest-all.cc<br>
<br>
Note the backslases in the command.<br></blockquote><div><br></div><div>Yep, because CMAKE_CXX_FLAGS is a string, and its contents is automatically</div><div>escaped when we use it in COMMAND in CMake rules. I guess we'll have to manually</div>
<div>turn CMAKE_CXX_FLAGS into a CMake semicolon-separated list.</div><div> </div><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">

<br>
Could maintainers of the compiler-rt CMake scripts help me with this?<br></blockquote><div><br></div><div><div>Thanks for the detailed description of your use case.</div><div>I will try to address this problem tomorrow.</div>
</div><div> </div><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">
<span class=""><font color="#888888"><br>
Dmitri<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
</font></span></blockquote></div><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>