Skip to content

uutils/0.1.0 package update #54259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

octo-sts[bot]
Copy link
Contributor

@octo-sts octo-sts bot commented May 24, 2025

@octo-sts octo-sts bot added request-version-update request for a newer version of a package automated pr labels May 24, 2025
Copy link
Contributor Author

octo-sts bot commented May 24, 2025

📦 Build Failed: Missing Dependency

Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-.so', 'libclang.so.', 'libclang-.so.'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (invalid: [])"

Build Details

Category Details
Build System Rust/Cargo
Failure Point Custom build script for fts-sys v0.2.16

Root Cause Analysis 🔍

The build process requires libclang for bindgen to generate Rust bindings to C libraries. The libclang shared library is missing in the build environment. Bindgen uses libclang to parse C/C++ headers and generate Rust FFI bindings. The error occurred while trying to build the fts-sys crate, which depends on bindgen to generate Rust bindings to the C FTS library.


🔍 Build failure fix suggestions

Found similar build failures that have been fixed in the past and analyzed them to suggest a fix:

Suggested Changes

File: package:name:uutils/melange.yaml

  • modification at line 19 (environment.contents.packages section)
    Original:
  contents:
    packages:
      - bash
      - build-base
      - ca-certificates-bundle
      - cargo-auditable
      - rust
      - wolfi-base

Replacement:

  contents:
    packages:
      - bash
      - build-base
      - ca-certificates-bundle
      - cargo-auditable
      - clang-dev
      - rust
      - wolfi-base
Click to expand fix analysis

Analysis

The build failure is occurring because the Rust crate fts-sys requires the libclang library for bindgen to generate Rust bindings to C libraries. Bindgen uses libclang to parse C/C++ headers and generate Rust FFI (Foreign Function Interface) bindings. In this case, the error message clearly indicates that the build process can't find the shared library libclang.so (or variants like libclang-*.so) in the build environment.

Looking at the Melange YAML file, we can see that the build environment includes packages like bash, build-base, cargo-auditable, rust, and wolfi-base, but it's missing the package that provides the libclang shared library. This is a common issue in Rust projects that use bindgen, as bindgen requires libclang to parse C headers and generate Rust FFI bindings.

Since Wolfi OS uses the Alpine package manager (apk), we need to add the package that provides libclang to the environment section of the Melange YAML file. In Alpine-based systems, the package that provides libclang is typically clang-dev or llvm-dev.

Click to expand fix explanation

Explanation

The build failure is occurring because the Rust build process is trying to use bindgen, which requires libclang to generate Rust bindings to C libraries. The error message specifically states that it couldn't find any valid shared libraries matching libclang.so, libclang-*.so, etc.

Adding clang-dev to the dependencies in the Melange YAML file will install the necessary libclang shared libraries in the build environment. In Alpine-based systems (which Wolfi OS uses for package management), the clang-dev package typically provides the libclang shared libraries needed by bindgen.

When the build runs again with this change, the bindgen tool should be able to find the libclang shared library and successfully generate the Rust bindings for the fts-sys crate. This will allow the build process to complete successfully.

The error is specifically occurring during the build of the fts-sys crate, which is likely a transitive dependency of the uutils coreutils package. The fts-sys crate provides Rust bindings to the C FTS (File Tree System) library, which is used for traversing file hierarchies. It needs bindgen to generate these bindings, and bindgen needs libclang.

Click to expand alternative approaches

Alternative Approaches

  • Instead of adding 'clang-dev', you could add 'llvm-dev' to the environment packages, as it might also provide the required libclang libraries, depending on how Wolfi OS packages are structured.
  • Another approach would be to set the LIBCLANG_PATH environment variable in the build script to point to the location of libclang.so, but this requires knowing the exact path of the library, which may vary between builds or architectures. Adding the package is more reliable.
  • For a more minimal approach, you could try adding just 'libclang' instead of 'clang-dev' if such a package exists in Wolfi OS. This would add only the library without the development files, but bindgen might need the development headers as well.

Was this comment helpful? Please use 👍 or 👎 reactions on this comment.

@octo-sts octo-sts bot added the ai/skip-comment Stop AI from commenting on PR label May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/skip-comment Stop AI from commenting on PR automated pr request-version-update request for a newer version of a package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants