<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body 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="moz-signature" cols="72">-- 
Love,
Lou

</pre>
  </body>
</html>