Skip to content

LLVM config fails when static zstd libraries are not found #113583

Closed
@uditagarwal97

Description

@uditagarwal97

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions