<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113583>113583</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM config fails when static zstd libraries are not found
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
uditagarwal97
</td>
</tr>
</table>
<pre>
**Problem:**
When we use `LLVM_ENABLE_ZSTD=ON` along with `LLVM_USE_STATIC_ZSTD=ON`, LLVM config fails with the following error when **libzstd.a is not found but libzstd.so is found**:
```
CMake Error at lib/Support/CMakeLists.txt:327 (get_property):
get_property could not find TARGET zstd::libzstd_static. Perhaps it has
not yet been created.
CMake Error at lib/Support/CMakeLists.txt:330 (get_property):
get_property could not find TARGET zstd::libzstd_static. Perhaps it has
not yet been created.
```
The error is thrown in the following lines: https://github.com/intel/llvm/blob/sycl/llvm/lib/Support/CMakeLists.txt#L32 - In the `else()`, the code just assumes that static libraries are available.
**Potential Solution:**
When user specifies `LLVM_USE_STATIC_ZSTD=ON`, we should enable ZSTD only if static zstd library is present. Otherwise, the build should just proceed normally since zstd is optional.
**To Reproduce this error:**
1. Have zstd installed in your environment such that only libzstd.so is available and not libzstd.a. You can also build zstd manually from source with `ZSTD_BUILD_STATIC=OFF`.
2. Configure LLVM with `LLVM_ENABLE_ZSTD=ON LLVM_USE_STATIC_ZSTD=ON`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vd2OIjcTfRpzU9pWtz3QcNEXzAx830jsjxY2UXKD3O6C9sbYLZcNIU8fuRvQMNlsopUiAcIuV_mcOlVlSaT3FrFi40c2fh7JGFrnq9joIPfSn6SZlaPaNeeK8Tnj80_e1QYPTMyHNcufWX75_blFCyeESAhskq9WP73fLj7MH1eL7a_rzTMTzx8_sEkO0ji7h5MO7e3Yl_Viu97MNy9Pd0cZf4JkB-XsTu9hJ7WhwT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