<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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="">Hi,<div class=""><br class=""></div><div class="">Try: -DLLVM_BUILD_LLVM_DYLIB=ON</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 6:42 PM, David Sanderson 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=""><div class="gmail_default" style="font-family:tahoma,sans-serif">My apologies for this newbie question.  I was unable to discover the answer in the clang and cmake documents.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I have built my own copy of llvm/clang 3.7.0 on FreeBSD 10.1.  In the llvm projects directory, I populated compiler-rt, libcxx, and libunwind, also version 3.7.0.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I then built and installed with</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><div class="gmail_default">mkdir build</div><div class="gmail_default">cd build</div><div class="gmail_default">cmake -DCMAKE_INSTALL_PREFIX=$top -DCMAKE_VERBOSE_MAKEFILE=on -DLLVM_TARGETS_TO_BUILD=host ../$llvm_unpack &&</div><div class="gmail_default">cmake --build .</div><div class="gmail_default">cmake --build . --target install</div><div class="gmail_default"><br class=""></div><div class="gmail_default">When I try to build using the installed compiler, it is unable to find the libc++ that it just installed:</div><div class="gmail_default"><br class=""></div><div class="gmail_default"><div class="gmail_default">$top/bin/clang++ -v -o hello <a href="http://hello.cc" class="">hello.cc</a>                                                                                              clang version 3.7.0 (tags/RELEASE_370/final)</div><div class="gmail_default">Target: x86_64-unknown-freebsd10.1</div><div class="gmail_default">Thread model: posix</div><div class="gmail_default"> "/usr0/dws/llvm-3.7/top/bin/clang-3.7" -cc1 -triple x86_64-unknown-freebsd10.1 -emit-obj -mrelax-all -disable-free -main-file-name <a href="http://hello.cc" class="">hello.cc</a> -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -resource-dir /usr0/dws/llvm-3.7/top/bin/../lib/clang/3.7.0 -internal-isystem /usr/include/c++/v1 -fdeprecated-macro -fdebug-compilation-dir /usr0/dws/llvm-3.7 -ferror-limit 19 -fmessage-length 167 -mstackrealign -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-4b055a.o -x c++ <a href="http://hello.cc" class="">hello.cc</a></div><div class="gmail_default">clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target x86_64-unknown-freebsd10.1</div><div class="gmail_default">#include "..." search starts here:</div><div class="gmail_default">#include <...> search starts here:</div><div class="gmail_default"> /usr/include/c++/v1</div><div class="gmail_default"> /usr0/dws/llvm-3.7/top/bin/../lib/clang/3.7.0/include</div><div class="gmail_default"> /usr/include</div><div class="gmail_default">End of search list.</div><div class="gmail_default"> "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/hello-4b055a.o -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o</div><div class="gmail_default">/usr/bin/ld: cannot find -lc++</div><div class="gmail_default">clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)</div><div class="gmail_default"><br class=""></div><div class="gmail_default">In order to expose this problem, I moved aside the /usr/lib/libc++* files on the system.  Prior to that, this compiler was silently using the system's own libc++ library instead of the one that was built and installed along with the compiler.</div><div class="gmail_default"><br class=""></div><div class="gmail_default">I was expecting that the compiler would pay attention to the CMAKE_INSTALL_PREFIX that it was built with.</div><div class="gmail_default"><br class=""></div><div class="gmail_default">What's the proper way (or at least, the expected way) to get clang++ to pay attention to the CMAKE_INSTALL_PREFIX that it was built with?</div><div class="gmail_default"><br class=""></div><div class="gmail_default">Regards,</div><div class="gmail_default">David Sanderson (<a href="mailto:yelliott@gmail.com" class="">yelliott@gmail.com</a>)</div></div></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=""><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=""></div></blockquote></div><br class=""></div></body></html>