<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 4:18 PM, Eric Fiselier via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi All,<div class=""><br class=""></div><div class="">Configuring a compiler to target or build libc++ is tricky. It often requires suppressing and rebuilding large parts of the CC1 compiler invocation. Doing this manually can be prohibitive, even for experienced users. Even doing it programmatically is hard and requires a lot of code because of the sheer number of configurations libc++ support.</div><div class=""><br class=""></div><div class="">These problems affects both libc++ and it's users. For libc++ CMake's statefulness makes it hard to generate the two different sets of flags needed to initially build the library and then to target it afterwards.</div></div></div></blockquote><div><br class=""></div><div>Can you elaborate on this issue? Without looking deeply at the problem, it seems difficult to me to figure exactly what the problem is.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Therefore I'm proposing a utility called `libcxx-config.py` which, similar to llvm-config, when queried will output the flags required to compile and link libc++. The tool will have two main purposes:<br class=""></div><div class=""><br class=""></div><div class="">(1) Generating the compile and link flags required to <b class="">use the just-built libc++ library</b>.</div><div class="">(2) Generating the compile and link flags required to <b class="">build the libc++ dylib.</b></div><div class=""><b class=""><br class=""></b></div><div class="">The goals for `libcxx-config.py` are:</div><div class=""><br class=""></div><div class="">(1) Reduce duplicate configuration logic between the CMake and test-suite.</div><div class="">(2) Allow non-CMake users to correctly generate the flags required to build libc++. (Ex buildit)</div><div class="">(3) Make it easier for projects, including libc++, to correctly configure to target the just-built libc++.</div><div class="">(4) Allow the creation of a `test-libc++` tool which can compile and link test programs against libc++ (Often needed when debugging test suite failures).</div><div class=""><br class=""></div><div class="">Would anybody else have a need for this? Are there use cases anybody would like to see supported?</div><div class=""><br class=""></div><div class="">Some example usages I imagine for `libcxx-config.py` are:</div><div class=""><br class=""></div><div class="">  # Get the compile flags needed to build libc++.dylib</div><div class="">  $ libcxx-config.py --building-library --compile-flags --compiler=clang++ --cxx-abi-library=libcxxabi</div><div class="">  </div><div class="">  # output: -nostdinc++ -I <libcxx-headers> -D_LIBCPP_BUILDING_LIBRARY -DLIBCXX_BUILDING_LIBCXXABI -std=c++11 -fvisibility-inlines-hidden</div></div></div></blockquote><div><br class=""></div><div>I’m not sure why it is not the role of CMake?</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">  # Get the link flags needed to use libc++ with the specified compiler</div><div class="">  $ libcxx-config.py --link-flags --compiler=g++</div><div class="">  </div><div class="">  # Output: -nodefaultlibs -L <path> -Wl,-rpath <path> -lc++experimental -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc</div></div></div></blockquote><div><br class=""></div><div>Isn’t it the role of the clang driver when given -stdlib=libc++ ?</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Any feedback is appreciated.</div><div class=""><br class=""></div><div class="">/Eric</div><div class=""><br class=""></div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></body></html>