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

    <tr>
        <th>Summary</th>
        <td>
            [flang] Building flang on Macs requires manually passing a flag with path to runtime libraries
        </td>
    </tr>

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

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

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

<pre>
    I have recently installed flang on an Apple M1 Mac that is running Sonoma 14.5. I installed with the latest from the main branch at the time (the commit hash `fd86b2e26c0933c2af61`). When invoking the installed flang executable to build a basic Fortran program, I get the following error:

```
ld: library 'flang_rt.runtime' not found
flang-22: error: linker command failed with exit code 1 (use -v to see invocation)
```

I am able to resolve this by manually passing the path to the runtime library with the following command:
```
flang -L`flang -print-resource-dir`/lib/darwin hello-world.f90
```

I believe this to be an issue that other mac users also face and hope that it can be resolved so the runtime libraries do not have to be manually passed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxslM-OozgQxp_GXEpBxkBIDhwyO4rU0vZpD3tcle0CvG1s1jbpyduvTEjPv5YsxQFXuX7fVwXGaEZH1LP2C2u_FrimyYf-LQWMhfT63r_AhDeCQIpcsncwLia0ljQMFt0I3gE6uCyLJXit4BUVpAkTmAhhdc64Ef7yzs8IVVO2Jbz8kOHdpAnSRGAxUUwwBD9v_2c0DmRApybAtD1KZiZg4pT3ys-zSTBhnIAd-aBPRylIHBU_17USOBwrduRMnEv4eyIHxt38W64kB_8KQN9IrQmlJUge5GqsBgSJ0Si4-pACOliCHwPOTPwBLzDSo6LBW-vfc1oKwQdWXxjf1pHvi1-sZvUFrJEBwx2Y6LY7_wmpDKvLSEx04HyCwa9OM37Z3h-EyGHPtGCNe6OwYaPTMKD5UI--mQTKa4Iqq7NGgsMtg0SijVthMt4xcf6lMsYvL4AzPMEDRW9vBGkyEeQdZnQrWnuHJffIrt2C2TC_7XeAD7gPM7_rshe8K_PD5Q_lD39m8x7bJRiXDrmINSg6aBM2B6_WSCauGsO7cTCRtf7w7oPV5XDmnxFJsoaeGNlPyu1pYlzp0Zc-TRRgRgVrpBABbfQwoMrnNEx-2c9lWdHl-F0ZDfEzcEMRtN883AblcedP6pEuC93X-lyfsaC-6tq6qxvRNMXUD91w7OqhEU2LAzaqwqGTJy3luZKNkl1hesFFyztxElw0vClr7OpW1t1R4-mkJGcNpxmNLa29zaUPY7HR9lVb8boqLEqycZtvITaxmRB51EOfAw5yHSNruDUxxe8pkkl2-yg8Itqv8CUPRjb1Y-xfUUUI9N9qAsXf-wXzyfHRFs---U26Yg22n1JaYm4ScWXiOpo0rbJUfs7229vz57AE_y-pxMR1A4xMXHfGWy_-DwAA___k2Zk6">