Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cdee0de
Update vcpkg triplets for static linking and release-only builds on W…
shauneccles Dec 2, 2025
bd787b4
Refactor vcpkg triplet files for static linking and release-only buil…
shauneccles Dec 2, 2025
dff259c
Update meson-python settings for Windows to allow internal shared lib…
shauneccles Dec 2, 2025
e5e73ee
Update vcpkg installation command to allow unsupported builds and add…
shauneccles Dec 2, 2025
c06a84b
Add release-only triplets for macOS and Windows to optimize build times
shauneccles Dec 2, 2025
73eead3
Add custom triplet for x64 MinGW static release builds
shauneccles Dec 2, 2025
845942e
Refactor vcpkg triplet configurations to use MSVC for static linking …
shauneccles Dec 2, 2025
e3637ec
Update x64 Windows static triplet to use static CRT for MSVC builds
shauneccles Dec 2, 2025
e9c240d
Refactor build configuration for Windows MSVC: improve vcpkg integrat…
shauneccles Dec 2, 2025
89338e9
Update cibuildwheel version to 3.3.0 and add 'uv' extras for wheel bu…
shauneccles Dec 2, 2025
819bd1f
Improve vcpkg installation logic for Windows: validate cached depende…
shauneccles Dec 2, 2025
6cc3417
Refactor vcpkg integration for cross-platform builds: streamline trip…
shauneccles Dec 2, 2025
bc81a24
Enhance Windows build process: add installation of nasm and streamlin…
shauneccles Dec 2, 2025
65afde6
Enhance Windows and Linux build configurations: add triplet support f…
shauneccles Dec 2, 2025
6f9f4f5
set win compilers to cl.exe
shauneccles Dec 2, 2025
367e932
Enhance Windows build configuration: ensure MSVC Build Tools are used…
shauneccles Dec 2, 2025
9a0490f
Enhance Windows build configuration: set up MSVC environment for cibu…
shauneccles Dec 2, 2025
7d74603
test cibw bug fix branch
shauneccles Dec 2, 2025
607b28c
Enhance build configuration: install uv for faster dependency resolut…
shauneccles Dec 2, 2025
4a759a3
Fix threading configuration for Windows in timestretch_rubberband.c
shauneccles Dec 2, 2025
6e4183f
Enhance Windows build configuration: add required system libraries fo…
shauneccles Dec 2, 2025
2db37f9
Enhance Windows build configuration: improve dependency handling for …
shauneccles Dec 2, 2025
3879049
Initial plan
Copilot Dec 2, 2025
f234ec3
Fix Windows build: Add SLEEF DFT library and system library dependencies
Copilot Dec 2, 2025
78c2f7a
Remove rubberband from Windows builds due to static linking incompati…
Copilot Dec 3, 2025
3326ce6
Add comprehensive Windows build fix summary documentation
Copilot Dec 3, 2025
66d4123
Remove SLEEF DFT detection - no longer needed without Windows rubberband
Copilot Dec 3, 2025
ac0ef0d
Merge pull request #54 from LedFx/copilot/sub-pr-53
shauneccles Dec 3, 2025
d14bfe9
Initial plan
Copilot Dec 3, 2025
0be67cf
Update Python README to reflect wheel features after static linking c…
Copilot Dec 3, 2025
f44eda7
Merge pull request #55 from LedFx/copilot/sub-pr-53-again
shauneccles Dec 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 47 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,28 @@ jobs:
# Linux x86_64
- os: ubuntu-latest
arch: x86_64
triplet: x64-linux-pic
cibw_archs: "x86_64"
# Linux ARM64 (native, no QEMU)
- os: ubuntu-24.04-arm
arch: aarch64
triplet: arm64-linux-pic
cibw_archs: "aarch64"
# Windows AMD64
- os: windows-latest
arch: AMD64
triplet: x64-windows-static-msvc-release
cibw_archs: "AMD64"
# macOS x86_64 (Intel)
- os: macos-15-intel
macoosx_deployment_target: "10.15"
triplet: x64-osx
triplet: x64-osx-release
arch: x86_64
cibw_archs: "x86_64"
# macOS ARM64 (Apple Silicon)
- os: macos-latest
macoosx_deployment_target: "11.0"
triplet: arm64-osx
triplet: arm64-osx-release
arch: arm64
cibw_archs: "arm64"

Expand All @@ -88,6 +91,14 @@ jobs:
with:
submodules: 'recursive'

# Activate MSVC environment on Windows before cibuildwheel
# This ensures cl.exe is in PATH and takes precedence over MinGW
- name: Set up MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

# Cache vcpkg_installed directory to avoid rebuilding dependencies
# This caches the installed packages directory which is reused across builds
- name: Cache vcpkg installed packages ${{ matrix.os }} ${{ matrix.arch }}
Expand All @@ -104,24 +115,52 @@ jobs:
# Install nasm (required by vcpkg for ffmpeg assembly optimizations)
brew install nasm

- name: Install build tools (Windows)
if: runner.os == 'Windows'
run: |
# Install nasm (required by vcpkg for ffmpeg assembly optimizations)
choco install nasm -y

# macOS vcpkg setup - build dependencies from source with correct deployment target
- name: Install vcpkg dependencies ${{ matrix.os }} ${{ matrix.arch }}
# Uses custom release-only triplets (x64-osx-release, arm64-osx-release) to avoid building debug libraries
- name: Install vcpkg dependencies (MacOS) ${{ matrix.arch }}
if: runner.os == 'macOS'
env:
VCPKG_BUILD_TYPE: "release"
run: |
echo "Building vcpkg dependencies for ${{ matrix.os }} ${{ matrix.arch }} with deployment target ${{ matrix.macoosx_deployment_target }}"
$VCPKG_INSTALLATION_ROOT/vcpkg install --triplet=${{ matrix.triplet }}
$VCPKG_INSTALLATION_ROOT/vcpkg install --triplet=${{ matrix.triplet }} --overlay-triplets=vcpkg-triplets
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macoosx_deployment_target }}" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}/lib/pkgconfig:${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}/share/pkgconfig" >> $GITHUB_ENV

# Windows vcpkg setup - build dependencies with MSVC static linking
# Uses custom x64-windows-static-msvc-release triplet for static libraries
- name: Install vcpkg dependencies (Windows) ${{ matrix.arch }}
if: runner.os == 'Windows'
shell: cmd
run: |
echo === Building vcpkg dependencies for ${{ matrix.os }} ${{ matrix.arch }} ===
%VCPKG_INSTALLATION_ROOT%\vcpkg.exe install --triplet=${{ matrix.triplet }} --overlay-triplets=vcpkg-triplets --allow-unsupported
if errorlevel 1 (
echo VCPKG INSTALL FAILED
exit /b 1
)
echo === Vcpkg installation complete ===
echo CMAKE_PREFIX_PATH=${{ github.workspace }}\vcpkg_installed\${{ matrix.triplet }}>> %GITHUB_ENV%
echo PKG_CONFIG_PATH=${{ github.workspace }}\vcpkg_installed\${{ matrix.triplet }}\lib\pkgconfig;${{ github.workspace }}\vcpkg_installed\${{ matrix.triplet }}\share\pkgconfig>> %GITHUB_ENV%
- name: Install uv
if: runner.os != 'linux'
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Build wheels
uses: pypa/cibuildwheel@9c00cb4f6b517705a3794b22395aedc36257242c # 3.2.1
uses: pypa/cibuildwheel@henryiii/fix/simpleraction
# with:
# extras: uv
env:
# Build only for the native architecture (no cross-compilation)
CIBW_ARCHS: ${{ matrix.cibw_archs }}



# All other configuration is in pyproject.toml

- name: Upload wheels
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aubio-ledfx
>
> **Why this fork exists:**
> - The original aubio project is no longer actively maintained and released
> - We need Python 3.13 support with pre-built wheels on PyPI
> - We need Python 3.14 support with pre-built wheels on PyPI
> - We require the latest fixes and improvements from the main branch of aubio
> - LedFx depends on aubio and needs a reliable, up-to-date release
>
Expand Down Expand Up @@ -88,13 +88,28 @@ aubio uses the [Meson build system](https://mesonbuild.com/) and [vcpkg](https:/

### Prerequisites

- **Meson** >= 1.9.0: `pip install "meson>=1.9.0"` or `apt install meson`
- **Ninja**: `pip install ninja` or `apt install ninja-build`
- **uv** (recommended): `pip install uv` or see [uv installation](https://docs.astral.sh/uv/getting-started/installation/)
- **C compiler**: GCC, Clang, or MSVC
- **Python** >= 3.8 (for Python bindings)
- **NumPy** (for Python bindings): `pip install numpy`
- **Python** >= 3.10 (for Python bindings)
- **vcpkg** (optional, for automatic dependency management): See [vcpkg installation](https://vcpkg.io/en/getting-started.html)

Install development dependencies using uv:
```bash
# Install build dependencies (meson, ninja, meson-python)
uv sync --group dev

# Install test dependencies (pytest)
uv sync --group test

# Install all dependency groups
uv sync --all-groups
```

Alternatively, use pip:
```bash
pip install meson>=1.9.0 ninja numpy>=1.26.4
```

### Dependency Management with vcpkg

aubio uses vcpkg manifest mode (vcpkg.json) to automatically manage dependencies. If vcpkg is installed, dependencies will be fetched automatically during build.
Expand Down
108 changes: 108 additions & 0 deletions WINDOWS_BUILD_FIX_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Windows Build Fix Summary

## Problem
GitHub Actions Windows builds were failing with linker errors during Python extension compilation.

## Investigation Process

### Initial Error Analysis
Examined workflow run logs showing 7 unresolved SLEEF DFT symbols:
- `__imp_Sleef_malloc`
- `__imp_Sleef_free`
- `__imp_SleefDFT_double_init1d`
- `__imp_SleefDFT_double_execute`
- `__imp_SleefDFT_float_init1d`
- `__imp_SleefDFT_float_execute`
- `__imp_SleefDFT_dispose`

### Root Cause Identification
The `__imp_` prefix indicated Windows linker was expecting DLL import symbols, not static library symbols. This revealed:

1. **vcpkg's rubberband** on Windows is built expecting SLEEF as a DLL
2. **Our static triplet** (`x64-windows-static-msvc-release.cmake`) tries to link everything statically
3. **Fundamental incompatibility**: rubberband.lib references SLEEF with DLL import symbols even when SLEEF static libraries are present

This is a **vcpkg packaging limitation**, not a build system configuration issue.

## Solution Implemented

### Commit 1: f234ec3 - Platform-specific library dependencies
Added Windows system libraries required by FFmpeg when statically linking:
- `ws2_32`: Winsock2 networking
- `secur32`: Security Support Provider (SSPI/TLS)
- `bcrypt`: Cryptography API
- `mfuuid`, `strmiids`: Media Foundation GUIDs
- `ole32`: Component Object Model

Also added:
- Linux: `pthread` and `libstdc++` for FFmpeg and rubberband C++ code
- SLEEF DFT library detection (conditional on rubberband being found)

### Commit 2: 78c2f7a - Remove rubberband from Windows
After determining rubberband cannot be statically linked on Windows:
- Changed vcpkg.json platform filters from `"!linux"` to `"osx"`
- Affects: rubberband and sleef packages
- Created documentation: WINDOWS_RUBBERBAND_REMOVAL.md

## Impact

### Functionality Changes
- ✅ Windows builds will succeed
- ❌ Windows loses rubberband time-stretch and pitch-shift effects
- ✅ Core aubio functionality unchanged (onset, pitch detection, tempo, MFCC, etc.)
- ✅ macOS retains full rubberband support
- ✅ Linux unaffected (already didn't have rubberband)

### Platform Matrix
| Platform | Rubberband | Time-stretch | Pitch-shift |
|----------|-----------|--------------|-------------|
| Windows | ❌ | Dummy impl | Dummy impl |
| macOS | ✅ | Full support | Full support|
| Linux | ❌ | Dummy impl | Dummy impl |

## Technical Details

### Why Not Fix vcpkg?
Fixing this properly would require:
1. Modifying vcpkg's rubberband port
2. Ensuring SLEEF builds without DLL import expectations
3. Testing across multiple Windows configurations
4. Contributing changes upstream
5. Waiting for vcpkg release cycle

This is outside the scope of immediate CI fixes.

### Why Not Use Dynamic Linking?
- Defeats purpose of portable Python wheels
- Requires bundling DLLs
- Increases package size and complexity
- Makes distribution error-prone

### Why Not Use MinGW?
- MSVC is the standard Windows toolchain
- Better compatibility with vcpkg packages (especially FFmpeg)
- Would require significant build system rework

## Files Modified

1. **vcpkg.json**: Platform filters for rubberband and sleef
2. **python/meson.build**: Windows system library dependencies
3. **meson.build**: SLEEF DFT library detection
4. **WINDOWS_RUBBERBAND_REMOVAL.md**: Detailed rationale documentation

## Verification

Expected build behavior:
1. vcpkg skips rubberband/sleef installation on Windows
2. Meson detects rubberband as "not found"
3. `HAVE_RUBBERBAND` not defined in config.h
4. Dummy timestretch/pitchshift implementations compile
5. Python extension links successfully with FFmpeg system libraries
6. Wheels build and package correctly

## Future Work

If rubberband on Windows becomes critical:
- Investigate vcpkg rubberband port modifications
- Consider contributing fix to vcpkg upstream
- Or implement alternative pure-Python time-stretching solution
95 changes: 95 additions & 0 deletions WINDOWS_RUBBERBAND_REMOVAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Windows Build Fix: Rubberband Removal

## Problem
Windows builds were failing with 7 unresolved external symbols when linking the Python extension:

```
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_Sleef_malloc
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_Sleef_free
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_SleefDFT_double_init1d
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_SleefDFT_double_execute
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_SleefDFT_float_init1d
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_SleefDFT_float_execute
rubberband.lib(src_common_FFT.cpp.obj) : error LNK2019: unresolved external symbol __imp_SleefDFT_dispose
```

## Root Cause Analysis

The `__imp_` prefix on these symbols indicates that rubberband.lib was expecting SLEEF to be provided as a **DLL import library**, not a static library. This is a fundamental incompatibility issue:

1. **vcpkg's Windows rubberband package** builds rubberband with dynamic SLEEF expectations
2. **Our custom triplet** (`x64-windows-static-msvc-release.cmake`) specifies full static linking
3. Even when SLEEF static libraries are present, rubberband.lib references them with `__imp_` prefixes (DLL import symbols)

This is a **vcpkg packaging limitation** - rubberband on Windows does not support proper static linking with static SLEEF libraries when using the MSVC toolchain.

## Solution

Removed rubberband and SLEEF from Windows builds:

### Changes to `vcpkg.json`
```diff
- "platform": "!linux" # Was: Windows AND macOS
+ "platform": "osx" # Now: macOS only
```

This change affects two dependencies:
- `sleef`: SIMD math library (only needed for rubberband)
- `rubberband`: Audio time-stretching/pitch-shifting library

### Impact

**Functionality Loss on Windows:**
- No rubberband-based time stretching (`aubio_timestretch_t` with rubberband backend)
- No rubberband-based pitch shifting (`aubio_pitchshift_t` with rubberband backend)

**Fallback Behavior:**
- Aubio automatically uses dummy implementations when rubberband is not available
- These dummy implementations print an error message when called
- Core aubio functionality (onset detection, pitch tracking, tempo, MFCC, etc.) is NOT affected

**Platforms Still With Rubberband Support:**
- macOS: ✅ Full rubberband support
- Linux: ❌ Already disabled (rubberband not in vcpkg.json for Linux)

## Alternative Approaches Considered

1. **Try to fix vcpkg rubberband package** - Would require:
- Modifying vcpkg's rubberband port to support static SLEEF
- Ensuring SLEEF exports symbols without `__imp_` in static builds
- Contributing changes upstream to vcpkg
- Time-intensive and outside scope of this PR

2. **Use dynamic linking on Windows** - Rejected because:
- Defeats the purpose of portable wheels
- Would require bundling DLLs with the Python package
- Increases package size and complexity
- Makes distribution more error-prone

3. **Use MinGW instead of MSVC** - Rejected because:
- MSVC is the standard Windows toolchain
- Better compatibility with vcpkg packages (especially FFmpeg)
- MinGW would require significant build system changes

## Verification

The build will now:
1. Skip rubberband installation on Windows
2. Meson will detect rubberband as "not found" on Windows
3. `HAVE_RUBBERBAND` will not be defined in config.h
4. Dummy timestretch/pitchshift implementations will be used
5. Python extension will build successfully without rubberband dependencies

## Future Work

If rubberband support on Windows becomes critical:
1. Investigate vcpkg rubberband port modifications
2. Consider contributing a fix to vcpkg upstream
3. Or implement a pure-Python fallback for time-stretching/pitch-shifting effects

## References

- SLEEF (SIMD Library for Evaluating Elementary Functions): https://sleef.org/
- Rubberband Library: https://breakfastquay.com/rubberband/
- vcpkg rubberband port: https://github.com/microsoft/vcpkg/tree/master/ports/rubberband
- Windows DLL import symbols: https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files
Loading