[cfe-dev] clang++ doesn't seem to search CMAKE_INSTALL_PREFIX/lib

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 13 21:47:25 PST 2016


Hi,

Try: -DLLVM_BUILD_LLVM_DYLIB=ON

— 
Mehdi

> On Jan 13, 2016, at 6:42 PM, David Sanderson via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> 
> My apologies for this newbie question.  I was unable to discover the answer in the clang and cmake documents.
> 
> 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.
> 
> I then built and installed with
> 
> mkdir build
> cd build
> cmake -DCMAKE_INSTALL_PREFIX=$top -DCMAKE_VERBOSE_MAKEFILE=on -DLLVM_TARGETS_TO_BUILD=host ../$llvm_unpack &&
> cmake --build .
> cmake --build . --target install
> 
> When I try to build using the installed compiler, it is unable to find the libc++ that it just installed:
> 
> $top/bin/clang++ -v -o hello hello.cc <http://hello.cc/>                                                                                              clang version 3.7.0 (tags/RELEASE_370/final)
> Target: x86_64-unknown-freebsd10.1
> Thread model: posix
>  "/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 hello.cc <http://hello.cc/> -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++ hello.cc <http://hello.cc/>
> clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target x86_64-unknown-freebsd10.1
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/include/c++/v1
>  /usr0/dws/llvm-3.7/top/bin/../lib/clang/3.7.0/include
>  /usr/include
> End of search list.
>  "/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
> /usr/bin/ld: cannot find -lc++
> clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
> 
> 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.
> 
> I was expecting that the compiler would pay attention to the CMAKE_INSTALL_PREFIX that it was built with.
> 
> 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?
> 
> Regards,
> David Sanderson (yelliott at gmail.com <mailto:yelliott at gmail.com>)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160113/6fbea824/attachment.html>


More information about the cfe-dev mailing list