<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=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Although I do wonder how I might configure clang on build to use a particular (set of) directories for the default header include paths. </div></div></div></div></blockquote><div class="">You can do this in CMake with CMAKE_OSX_SYSROOT, although if there is no `xcodebuild` or `xcrun` in that path, CMake may complain. You can also append (or prepend) to the CMAKE_PREFIX_PATH variable, and CMake will search for headers, libraries, etc. in there, although I these may be searched AFTER system search paths.</div><div class=""><br class=""></div><div class="">You can also create a CMake “Toolchain File” that will be loaded early in the process to populate whatever variables you want to set related to system headers and libraries. Documentation about CMake toolchains can be found here: <a href="https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html" class="">https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html</a></div><div class=""><br class=""></div><div class="">Docs regarding the different CMake variables here: </div><div class=""><a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_OSX_SYSROOT.html" class="">https://cmake.org/cmake/help/v3.6/variable/CMAKE_OSX_SYSROOT.html</a></div><div class=""><a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_PREFIX_PATH.html" class="">https://cmake.org/cmake/help/v3.6/variable/CMAKE_PREFIX_PATH.html</a></div><div class=""><a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_SYSTEM_PREFIX_PATH.html" class="">https://cmake.org/cmake/help/v3.6/variable/CMAKE_SYSTEM_PREFIX_PATH.html</a></div><div class=""><a href="https://cmake.org/cmake/help/v3.6/variable/CMAKE_TOOLCHAIN_FILE.html" class="">https://cmake.org/cmake/help/v3.6/variable/CMAKE_TOOLCHAIN_FILE.html</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Best,</div><div class="">Morgan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 22, 2016, at 5:28 PM, Kevin Ushey 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=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Sep 22, 2016 at 4:13 PM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class="gmail-"><blockquote type="cite" class=""><div class="">On Sep 22, 2016, at 11:42 AM, Kevin Ushey via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi everyone,<div class=""><br class=""></div><div class="">This is my first post here on cfe, so please be kind -- I apologize if some of these issues have already been discussed previously on the list. I'm building clang + LLVM mostly following the instructions at <a href="http://clang.llvm.org/get_started.html" target="_blank" class="">http://clang.llvm.org/get_<wbr class="">started.html</a> and <a href="http://llvm.org/docs/CMake.html" target="_blank" class="">http://llvm.org/docs/<wbr class="">CMake.html</a>. The goal is for me to be able to produce a clang installation that I can use and play with locally on my MBP.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">When I follow these steps, I can usually build clang on MacOS with just `cmake path/to/llvm && make`</div></div></div></blockquote><div class=""><br class=""></div><div class="">It looks like the issue was ultimately me just missing the command line tools (and, with that, the headers it installs into `/usr/include`). Although I do wonder how I might configure clang on build to use a particular (set of) directories for the default header include paths. (Unless there's a good reason why I shouldn't be doing this?)</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class="gmail-"><div class=""><br class=""></div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">When building LLVM + clang, I had to manually add the include paths for Valgrind, libxml2, and Python (currently just using -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS when invoking cmake for configuration). Is this intended, or should the cmake scripts be able to automatically discover these dependencies? (I believe the header include errors occurred when attempting to compile lldb).</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">The getting started page you linker does not mention lldb, how did you ended up building it?</div></div></div></blockquote><div class=""><br class=""></div><div class="">I followed the instructions here related to building on MacOSX with CMake:</div><div class=""><br class=""></div><div class=""><a href="http://lldb.llvm.org/build.html#BuildingLldbOnMacOSX" class="">http://lldb.llvm.org/build.html#BuildingLldbOnMacOSX</a></div><div class=""><br class=""></div><div class="">In other words, checking out the lldb sources in the 'projects' subfolder, and letting the build system handle the rest when building everything. </div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><br class=""></div><div class="">— </div><span class="gmail-HOEnZb"><font color="#888888" class=""><div class="">Mehdi</div><div class=""><br class=""></div><br class=""></font></span><blockquote type="cite" class=""><div class=""><div class=""><div class="gmail-h5"><div dir="ltr" class=""><div class=""><br class=""></div><div class="">After making these changes, an installation of clang is produced, but it does not seem to know about the standard library headers -- e.g. compilation fails when attempting to include <stdio.h>. (Note that this build was produced with 'libcxx' available in the 'llvm/projects' subdirectory). This did seem to work automagically when building with clang-3.9; has anything changed here? Is there some option I can set that says "please install + use the version of libc++ in the projects directory by default"? For reference:<br class=""><br class=""><div class="">$ clang-4.0 -E - -v < /dev/null</div><div class="">clang version 4.0.0 (<a href="http://llvm.org/git/clang.git" target="_blank" class="">http://llvm.org/git/clang.git</a> 2f1019880e3fca33b8c7ac8f8bd272<wbr class="">e546d930ac) (<a href="http://llvm.org/git/llvm.git" target="_blank" class="">http://llvm.org/git/llvm.git</a> 20bb0322fd381dd7e265eaa05b7fb1<wbr class="">c292278abe)</div><div class="">Target: x86_64-apple-darwin16.0.0</div><div class="">Thread model: posix</div><div class="">InstalledDir: /usr/local/bin</div><div class=""> "/usr/local/llvm/bin/clang-4.<wbr class="">0" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-<wbr class="">usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /usr/local/llvm/bin/../lib/<wbr class="">clang/4.0.0 -fdebug-compilation-dir /Users/kevin/scratch -ferror-limit 19 -fmessage-length 101 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-<wbr class="">signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c -</div><div class="">clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target x86_64-apple-darwin16.0.0</div><div class="">ignoring nonexistent directory "/usr/include"</div><div class="">#include "..." search starts here:</div><div class="">#include <...> search starts here:</div><div class=""> /usr/local/include</div><div class=""> /usr/local/llvm/bin/../lib/<wbr class="">clang/4.0.0/include</div><div class=""> /System/Library/Frameworks (framework directory)</div><div class=""> /Library/Frameworks (framework directory)</div><div class="">End of search list.</div></div><div class=""><br class=""></div><div class="">For reference, I am configuring LLVM from a build directory within the LLVM project tree with:</div><div class=""><br class=""></div><div class=""><div class="">cmake -G "Ninja" ..                                \</div><div class="">    -DCMAKE_C_COMPILER=/usr/bin/<wbr class="">clang              \</div><div class="">    -DCMAKE_C_FLAGS="${INCLUDE_<wbr class="">FLAGS}"             \</div><div class="">    -DCMAKE_CXX_COMPILER=/usr/bin/<wbr class="">clang++          \</div><div class="">    -DCMAKE_CXX_FLAGS="${INCLUDE_<wbr class="">FLAGS}"           \</div><div class="">    -DCMAKE_SHARED_LINKER_FLAGS="-<wbr class="">L/usr/local/lib" \</div><div class="">    -DCMAKE_BUILD_TYPE=Release                     \</div><div class="">    -DCMAKE_INSTALL_PREFIX="${<wbr class="">LLVM_INSTALL_DIR}"   \</div><div class="">    -DLLVM_ENABLE_CXX1Y=Yes                        \</div><div class="">    -DLLVM_ENABLE_LTO=Yes</div></div><div class=""><br class=""></div><div class="">with INCLUDE_FLAGS set with the include paths as noted before.</div><div class=""><br class=""></div><div class="">As an aside, it would be _incredibly_ helpful if a 'one-button' shell script for download, build and installation of LLVM + clang could be provided in the documentation; that is, something users could play with and tweak themselves. Or, perhaps, links to scripts used by existing projects that need to build LLVM + clang themselves?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Kevin</div></div></div></div><span class="gmail-">
______________________________<wbr class="">_________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-dev</a><br class=""></span></div></blockquote></div><br class=""></div></blockquote></div><br class=""></div></div>
<pre class="">_______________________________________________<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="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="">
</pre></div></blockquote></div><br class=""></body></html>