[llvm-dev] Linker errors after installing/compiling LLVM/CLANG

Joan Lluch via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 5 23:00:43 PDT 2019


Hi Nelson,

Thanks for your reply. 

The “build/Debug/lib” and "build/Release/lib” directories is where all the libraries go. Similarly, the executables go to “build/Debug/bin” and “build/Release/bin” before they are moved to the install directory. This is expected and normal. However, the problem is that a small number of libraries (exactly 20 in total) are not created at all for the LLVM 9.0 version that I cloned from gitHub. These libraries are in fact not created anywhere!.

I still have LLVM 7.0 installed in my computer and the libraries for that version are all there in the right places under the LLMV 7.0 directory, but in that case I installed it all in a different way as I said, loosing the benefits of git.

I forgot to mention that “llc” alone compiles and links correctly without any issue. The problem is only when I try to get ‘clang’ compiled.

You mention that you enabled a lot of projects:  "clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llvm;openmp;parallel-libs;polly;pstl”. I only really need the basic installation of “clang”, and I do not need any testing tools because all I want is to add my custom target to it. I also tried "clang;libclc;libcxx” but the problem with the missing libraries is exactly the same.

Just as a matter of information: I successfully implemented a custom target backend, and have it almost finished and running perfectly on LLVM 7.0. Now, I just want to move it to LLVM 9.0, but got stuck in what is supposed to be the easiest part which is just compiling it (??), but I do not understand why it doesn’t compile!

Any ideas?

Joan


> John, I compiled and installed to /usr/local all the projects under llvm except llgo yesterday. The three files you noted are in
> ../llvm-project/build/lib
> I do not have a llvm-project/build/Debug directory.
> Xubuntu 19.04. llvm downloaded from github on 6/18 using instructions from the page you note.
> cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llvm;openmp;parallel-libs;polly;pstl" -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE="Release" ../llvm
> Installed additional packages as needed.
> Neil
> On 7/5/19 6:46 AM, Joan Lluch via llvm-dev wrote:
>> Hi All,
>> 
>> I am looking for the best way to install LLVM+clang,  but I do not seem to find a way that works for me.
>> 
>> I followed the steps in this document Getting Started with the LLVM System — LLVM 9 documentation <https://llvm.org/docs/GettingStarted.html> except that I created the following folder structure as I do not want clang and llc to go to /usr/local
>> 
>> LLVM-9
>>    llvm-project  (cloned from github)
>>    install
>> 
>> I ran the following command line from the build directory in llvm-project as described in the doc, but added the DLLVM_OPTIMIZED_TABLEGEN=On variable :
>> 
>> cmake -G Xcode -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=/Users/joan/LLVM-9/install -DLLVM_OPTIMIZED_TABLEGEN=On ../llvm
>> 
>> The cmake command above seems to work ok, but after that, when I compile the “install” or “build_all” schemes I get a lot of linker errors. Such as these ones and more:
>> 
>> clang: error: no such file or directory: '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangAST.a'
>> clang: error: no such file or directory: '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangLex.a'
>> clang: error: no such file or directory: '/Users/joan/LLVM-9/llvm-project/build/Debug/lib/libclangBasic.a'
>> 
>> Up until recently, I have worked with LLVM 7.0 and all what I did was downloading both llvm and clang from llvm.org <http://llvm.org/>, copied clang into llvm/tools, and ran the cmake application (not command line).  That kind of worked except for some minor glitches but of course I didn’t get the benefits of git.
>> 
>> So what am I doing wrong now? Why I’m getting such linker errors?
>> 
>> It seems that a few required libraries are not created, but I do not understand why. Any ideas?
>> 
>> Thanks,
>> 
>> John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190706/badb1471/attachment.html>


More information about the llvm-dev mailing list