[PR #1955] fix(build): Support FFMPEG_INCLUDE_DIR on Linux for hardsubx #2757

Open
opened 2026-01-29 17:23:46 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1955

State: closed
Merged: Yes


Summary

Fixes compilation with hardsubx on Linux systems where FFmpeg headers are installed in non-standard locations (e.g., /usr/include/ffmpeg on Fedora with rpmfusion).

The Problem

The FFMPEG_INCLUDE_DIR environment variable was only checked inside the macOS-specific block in build.rs, so setting it had no effect on Linux builds:

// Old code - FFMPEG_INCLUDE_DIR only checked on macOS
if cfg!(target_os = "macos") {
    // ... Homebrew detection ...
    if let Ok(ffmpeg_include) = env::var("FFMPEG_INCLUDE_DIR") {
        builder = builder.clang_arg(format!("-I{}", ffmpeg_include));
    }
}

The Fix

  1. Move FFMPEG_INCLUDE_DIR check outside platform-specific blocks - Now works on all platforms
  2. Add pkg-config fallback on Linux - Automatically finds FFmpeg include paths via pkg-config

Usage

Users can now build on Fedora/systems with non-standard FFmpeg paths:

export FFMPEG_INCLUDE_DIR='/usr/include/ffmpeg'
./build -hardsubx

Or rely on pkg-config if FFmpeg is properly configured.

Fixes #1954

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1955 **State:** closed **Merged:** Yes --- ## Summary Fixes compilation with hardsubx on Linux systems where FFmpeg headers are installed in non-standard locations (e.g., `/usr/include/ffmpeg` on Fedora with rpmfusion). ### The Problem The `FFMPEG_INCLUDE_DIR` environment variable was only checked inside the macOS-specific block in `build.rs`, so setting it had no effect on Linux builds: ```rust // Old code - FFMPEG_INCLUDE_DIR only checked on macOS if cfg!(target_os = "macos") { // ... Homebrew detection ... if let Ok(ffmpeg_include) = env::var("FFMPEG_INCLUDE_DIR") { builder = builder.clang_arg(format!("-I{}", ffmpeg_include)); } } ``` ### The Fix 1. **Move `FFMPEG_INCLUDE_DIR` check outside platform-specific blocks** - Now works on all platforms 2. **Add pkg-config fallback on Linux** - Automatically finds FFmpeg include paths via pkg-config ### Usage Users can now build on Fedora/systems with non-standard FFmpeg paths: ```bash export FFMPEG_INCLUDE_DIR='/usr/include/ffmpeg' ./build -hardsubx ``` Or rely on pkg-config if FFmpeg is properly configured. Fixes #1954 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2757