<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJytV9ly2zYU_Rr5BSMOVy0PenBkuXUSp66jtH3TgCQkIiEJDgBaVr6-5wKUlHjJNNNoKIoLcJdzl3OVq_KwWFfSMDpaZivBCtVa8WiZ2jLR5KIsZbtzL5Y1x9VW4z0Tbck4vn_cL9lbabGp6WQtNIRY5VaPwqtReLk0qscyo7Z2z7Vgw-2hxRIDnSSy5zsxSi5ZZW1ncDGKr3HspK36PIBgulE72RpcFLRhrLpClcIEXoc_r6Gz0-qzKCw5w1lX99jEtkqzwQpbcTvYNdhr2HIUv8FBhumCnC8FwyrdAwzZCOdkLdsvgMeenRsEQl8hDOxaDmL3lSwqVvAW37qmpe1506CzPOkkZQG7PZzs5iXvrMFiOCAeedPVRxyBegNbmKpLgGz57hit9-__umVadMpIq_SBcBxNwh9AWdcPx5_xoBe3VguBHy1qwQ1dRUnweMQbv4M15xDAK6E7LXCGvm8D8Y0_e6UB3IPQB7YXwEO17FPet7Zn72XbP7I4DMKU0Mt7y25YxR8Ea5VluQBuPIf3gG4nLGHvheOehJKkhhd_fHyWAtKYHlHrOsG1oe258HE_gXXKRdluBdZwClGhtCaLtRgSoZR0D0SZg_6c0blsOZ42quzrQbSLlih6e6yUIdLH_AjYscQQJiPz-gA9NbdIBRg4ipMsnKRzl2q4iSbxLA2eIGoOxoqGIuqfA3J_uNsGWcdFPVRJGt76ezO-5cUbpb6M77Ri35UOFGWsbzkyfMy9kCuu90iql_YGtUI-szgKkiBkw8J3QreiZn8BQ4lw-JeUf3_Dr7dAlWV4iAfJFKdsxu4-rhHxOB4lb5hWyuLpY9uPZ2E0D2ZhEKej6SoOkWH3q_ery4-rzeX97STdrCdhGDKum0n6ovP-7EIrXbI5c5C_YRAhssaiEmFRbyg6v6tG5FrsUeNnMH8hpLVhYyQ6nFAd1VU16MPlEhXA9bkCvYXHtLaE7-DgWO_HekwHwydi39nC0CUawI8Xs3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8zotWiXle-Fx8mfmEG240Y0NPT7fu7-3d6sz_9uj73ywtm-cIb_C4FI1e8>53793</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Header paths not correct for in-memory Clang ORC JIT compiler on macOS
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    This is in the context of embedding the Clang front end and ORC Jit compiler into the 
Csound software sound synthesis language: https://github.com/gogins/clang-opcodes.

The project is a plugin for Csound that 
compiles C++ source code at run time and links it into the Csound process, 
which can call then into the compiled C++ code. My project adapts this example 
from an older tag in the LLVM repository: `https://github.com/llvm/llvm-project/tree/release/13.x/clang/examples/clang-interpreter`

My project works very well on Ubuntu Linux 20.04, but I have not been able to get it 
to work on macOS.

The issue appears to be that the LLVM software infers an incorrect resource directory from the 
binary module that is executing the compile process. This is possibly related to #50649 and #16284.

My system:
```
michaelgogins@Michaels-MacBook-Pro clang-opcodes % uname -a
Darwin Michaels-MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
```

LLVM is version 13.0.1 installed using Homebrew at:

```
michaelgogins@Michaels-MacBook-Pro clang-opcodes % ls -ll /opt/homebrew/Cellar/llvm/13.0.1
total 24
-rw-r--r--    1 michaelgogins  admin   1807 Feb  5 12:43 INSTALL_RECEIPT.json
-rw-r--r--    1 michaelgogins  admin   4499 Jan 20 22:31 README.md
drwxr-xr-x    3 michaelgogins  admin     96 Jan 20 22:31 Toolchains
drwxr-xr-x  159 michaelgogins  admin   5088 Feb  5 12:43 bin
drwxr-xr-x   13 michaelgogins  admin    416 Jan 20 22:31 include
drwxr-xr-x  450 michaelgogins  admin  14400 Feb  5 12:43 lib
drwxr-xr-x    9 michaelgogins  admin    288 Jan 20 22:31 libexec
drwxr-xr-x    9 michaelgogins  admin    288 Jan 20 22:31 share
```

Please note, version 13.0.1 does not 
upgrade or replace Apple Clang but is istalled alongside it.

My system uses the Apple XCode development system with command line tools, but Apple's Clang uses LLVM 12 which 
is not optimal for my project.

I hypothesize that the issue is that, on Linux, LLVM and Clang provided by system 
packages either do not need to infer the resource directory, or do so in a way 
that is compatible with my project, but this does not seem to work on macOS.

I have attached a cut-down version of my project that reproduces the confusion 
of the resource directory. E.g.:
```
ResourceDir: /Users/michaelgogins/lib/clang/13.0.1.
In file included from /var/folders/tc/x44lyz_j7bn468tgvvb352t40000gn/T//clang_opcode_TICnQK.cpp:1:
In file included from /opt/homebrew/Cellar/llvm/13.0.1/include/c++/v1/iostream:36:
/opt/homebrew/Cellar/llvm/13.0.1/include/c++/v1/__config:1151:46: fatal error: cannot open file '/opt/homebrew/Cellar/llvm/13.0.1/include/c++/v1/pthread.h': No such file or directory
      (defined(__MINGW32__) && __has_include(<pthread.h>))
```
[clang_jit_test.zip](https://github.com/llvm/llvm-project/files/8054304/clang_jit_test.zip)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytV9ly2zYU_Rr5BSMOVy0PenBkuXUTJ66jtH3TgCQkIiEJDgBaVr6-5wKUlHjJNNN4aK7AveeeuypX5WGxrqRhdLTMVoIVqrXi0TK1ZaLJRVnKduc-LGuOu63GdybaknH8f7hfsj-kxaamk7XQEGKVWz0Kr0bh5dKoHsuM2to914INj4cWSwx0ksie78QouWSVtZ3BzSi-xrGTturzAILpQe1ka3BT0Iax6gpVChN4Hf68hs5Oq8-isGQMZ13dYxPbKs0GFLbidsA14DVsOYrf4CBguiDjS8GwSvcgQzbCGVnL9gvosWfjBoHQVwgDXMtB7L6SRcUK3uK_rmlpe9406CxPOklZwG4PJ9y85J01WAwDxCNvuvrII1hvgIWpugTJlu-O3nr37q9bpkWnjLRKH4jH0ST8AZV1_XC8jAe9eLRaCFy0qAU3dBclweORb1wHNGcXwCqhO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