<div dir="ltr">Hmm, try adding "libclang" the same way you added clangFrontend! No idea whether that'll work, but after looking around, that's how other cmake files seem to do it.</div><br><div class="gmail_quote"><div dir="ltr">Lou Wynn via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> ezt írta (időpont: 2018. okt. 25., Cs, 5:13):<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p><font size="+1">Hi,</font></p>
    <p><font size="+1">I'm writing a small clang tool in the
        clang-tools-extra directory by using the monorepo. My
        CMakeList.txt files is as follows:</font></p>
    <p><tt><font size="+1">set(LLVM_LINK_COMPONENTS Support)<br>
          <br>
          add_clang_executable(loop-convert<br>
            LoopConvert.cpp<br>
            )<br>
          <br>
          target_link_libraries(loop-convert<br>
            PRIVATE<br>
            clang<br>
            clangAST<br>
            clangASTMatchers<br>
            clangBasic<br>
            clangFrontend<br>
            clangTooling<br>
            )<br>
        </font></tt></p>
    <p><tt><font size="+1"><br>
        </font></tt></p>
    <p><font size="+1">When I ran the build command, I got a linker
        error complaining that functions in lib/libclang.so cannot be
        found:</font></p>
    <p><tt><font size="+1">$ ninja loop-convert<br>
          [1/1] Linking CXX executable bin/loop-convert<br>
          FAILED: : && /usr/bin/clang++-6.0   -fPIC
          -fvisibility-inlines-hidden -Werror=date-time
          -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra
          -Wno-unused-parameter -Wwrite-strings -Wcast-qual
          -Wmissing-field-initializers -pedantic -Wno-long-long
          -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
          -Wdelete-non-virtual-dtor -Wstring-conversion
          -fdiagnostics-color -fno-common -Woverloaded-virtual
          -Wno-nested-anon-types -g  -fuse-ld=lld-6.0
          -Wl,--color-diagnostics -Wl,-allow-shlib-undefined
tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o 
          -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread
          lib/libclangAST.so.8svn lib/libclangASTMatchers.so.8svn
          lib/libclangBasic.so.8svn lib/libclangFrontend.so.8svn
          lib/libclangTooling.so.8svn -Wl,-rpath,"\$ORIGIN/../lib"
          && :<br>
          /usr/bin/ld.lld-6.0: error: undefined symbol: clang_getCString<br>
          >>> referenced by LoopConvert.cpp:7
(/home/lu/work/git-repos/llvm-mono/llvm-project/clang-tools-extra/loop-convert/LoopConvert.cpp:7)<br>
          >>>              
tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(operator<<(std::ostream&,
          CXString const&))</font></tt></p>
    <p><tt><font size="+1">...<br>
        </font></tt></p>
    <p><tt><font size="+1"><br>
        </font></tt></p>
    <p><font size="+1">It is clear that the lib/libclang.so.8svn is
        missing from the command line invoked by ninja. How can I add it
        into the build command? The "clang" line in the CMakeList.txt
        file doesn't work.</font></p>
    <p><font size="+1">Thanks.</font></p>
    <pre class="m_-9024109455794286717moz-signature" cols="72">-- 
Love,
Lou

</pre>
  </div>

_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>