<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64834>64834</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            CompilerInvocation::GetResourcesPath 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          owinebar
      </td>
    </tr>
</table>

<pre>
    I tried to build tool-template.cpp in an out-of-tree project directory based on a recent main checkout (version 18 at this time).  I compiled and installed all the llvm projects from this checkout in ${HOME}/dev, including the shared libraries.
The CMakeLists.txt in the out-of-tree project is set to link tool-template to the shared libraries in ${HOME}/dev.  tool-template successfully builds, but raises an error when the resulting binary is run on its source.
As alluded to at the end of https://clang.llvm.org/docs/LibTooling.html, the problem is that the resource directory is set relative to the executable in CompilerInvocation::GetResourcesPath.  If I move the tool-template executable to ${HOME}/dev/bin, for example, it processes its source with no issue. 

It would make more sense, if the executable is dynamically linked to libclang, to determine the resources path relative to the location of libclang.so.  

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlN1u4zYQhZ-GuhlYkCXZkS90kU3q1sAuWhT7AvwZWdNQpEAOnfjtC0qOsdlNgd74D-aZM985lIyRzg6xF7svYvdcyMSjD71_JYdKhkJ5c-1PwIHQAHtQiWz-4O2GcZqtZCz1PAM5kA584o0fNhwQYQ7-H9QMhgJq9uEKSkY04B1ICKjRMUySHOgR9YtPDKLuLhgieQfbDiQDjxSBaUJRH0qAE2g_zWTRgHQGyEWWdvlmLfCIYO1lep8bYQh-WiXuE8iBqFvx8OWPP7_9Jh6eRX00eBH1E5DTNhly50UojjKgAUsqyEAYS1E9i-rx-4jw9E2-4FeKHEt-WxTzgc8WpwgROUOz5F4-Msu_fjboPxyW8NPxmLTGGIdk7XXNJOYtVGIIkiLGnAaG4AO8jrh6DBiT5byiIifDNRsMyeVAiCNEn4LG26aPMUNNZg19iQIBnQE_wMg8R9E8ivoo6qO20p3LTL704Zzteh1FffxK6rv3lty5HHmy2V3WmINXFqc8m8ebbsB19g9VubELaCXT5Y4L31AnlspiBvW0tiGc3MVryeRddtU8_o78900y_iV5zNUZ4ASTz0oj_sTyB1H2n_fjqMjlDQYfAN_kNFtcSsN5nxxETu7OEF6JR3AeKMaEJaxI19cTw6tP1sAkXxAmHxAiurjKDb8sGcFcnZxIyxx07tGaiCW1gF-wejDIGCZy-IFnhFny-AtEe4OVs3zXKaMv4Wa0MH1jDs1BFthv94d6V3XbtivGXjf7bdsqJTt96PZKDWaosFZ703XbutvuCurrqm6qrq6qXXWourLdGvOwM3LXNPtu13SirXCSZO99KRZE_b7tmrawUqGN70-i0Oc_bVQ6R9FWdrlx92NMbLH_vwWAIgXbf-ztmXhMqtR-EvUx697eNrfrK-rj4i13ebH3bwAAAP__FWPGDQ">