<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127538>127538</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Driver hardcodes `lib/libflang_rt.a` path that is incorrect on `lib64` systems, and does not permit multilib
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mgorny
</td>
</tr>
</table>
<pre>
I'm almost ready to package Flang on Gentoo. The remaining problem is that the driver hardcodes the `lib` directory for `libflang_rt.a`:
https://github.com/llvm/llvm-project/blob/6fde8fe9adc835df50ea57b710781ffe8a6657e8/clang/lib/Driver/ToolChains/CommonArgs.cpp#L1361-L1370
This is problematic for two reasons:
1. Gentoo is using `lib64` for 64-bit libraries on platforms such on amd64, and `lib` for 32-bit libraries, and installing a 64-bit library into `lib` is generally an error.
2. The forced use of a single library directory makes cross-compilation / multilib builds impossible. I haven't tested how well Flang works with that yet, but at least a dumb `flang --target=i686-pc-linux-gnu hello.f90` seems to work, modulo trying to link a 64-bit runtime.
I've tried fiddling a fair bit, and unfortunately I don't see any good way of getting the correct `lib*` directory in that code. Perhaps the correct approach would be to include the architecture in the filename the way compiler-rt does — and perhaps move it to clang's resource directory while at it?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlE-PozgTxj-NcykFgSEQDjn0O_1mNdIc9jD3VYEL8LZxIbvoLN9-ZZL0dM9tpUgRll1_flXPgzHa0RNd1Ol_6vR6wFUmDpd55OC3Q8dmu3xXupkB3cxRIBCaDYRhwf4NR4KrQz8Ce_iDvDBn8HMiCDSj9daPsATuHM1gI8iEAjIRmGDfKcCEwfRsKO6Hqs6d7VSdg7GBeuGwwcDhcT6kLH8FyVDVuSpfVJ5-k8gS05e-Kn0drUxrl_U8K3117v35d1wC_029KH3tHHdKX-vB0HmgFk1_Lk9mOOWEp6Zrirw5F8NAZ6zrU0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