insane workaround

This commit is contained in:
Anthony Samms
2025-09-16 14:36:38 -04:00
parent 9ae001d494
commit de3a334cf6
2 changed files with 65 additions and 103 deletions

View File

@@ -25,7 +25,6 @@ jobs:
brew update brew update
brew install portaudio libsndfile libsamplerate pkg-config brew install portaudio libsndfile libsamplerate pkg-config
# Use MSYS2 for Windows audio library build with ASIO support
- name: Set up MSYS2 (Windows) - name: Set up MSYS2 (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
@@ -34,7 +33,6 @@ jobs:
install: >- install: >-
base-devel base-devel
mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-libsndfile mingw-w64-x86_64-libsndfile
mingw-w64-x86_64-libsamplerate mingw-w64-x86_64-libsamplerate
mingw-w64-x86_64-flac mingw-w64-x86_64-flac
@@ -46,83 +44,41 @@ jobs:
mingw-w64-x86_64-speex mingw-w64-x86_64-speex
mingw-w64-x86_64-cmake mingw-w64-x86_64-cmake
mingw-w64-x86_64-pkg-config mingw-w64-x86_64-pkg-config
# Note: Removed mingw-w64-x86_64-portaudio since we're using our own
# Download individual PortAudio files (Windows only) - name: Verify local PortAudio library (Windows)
- name: Download PortAudio individual files (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: msys2 {0} shell: msys2 {0}
working-directory: libs/audio
run: | run: |
# Create directory structure for PortAudio echo "=== Checking local PortAudio library ==="
mkdir -p /mingw64/portaudio-custom/{include,lib,bin}
cd /mingw64/portaudio-custom
# Download header files # Check if the static library exists
echo "Downloading PortAudio headers..." if [ -f "libportaudio.a" ]; then
curl -L -o include/portaudio.h https://raw.githubusercontent.com/PortAudio/portaudio/master/include/portaudio.h echo "✓ Found libportaudio.a"
ls -la libportaudio.a
# Download Windows-specific DLL and import library # Check what symbols are in the library
# Note: You'll need to find actual URLs for these files echo "=== Library symbols (sample) ==="
echo "Downloading PortAudio binaries..." nm libportaudio.a | grep -E "(Pa_|ASIO)" | head -10 || echo "No PortAudio symbols found"
# Option 1: From a release that provides individual files # Check for ASIO support specifically
curl -L -o lib/libportaudio.dll.a https://example.com/path/to/libportaudio.dll.a nm libportaudio.a | grep -i asio && echo "✓ ASIO symbols found!" || echo "⚠ No ASIO symbols found"
curl -L -o lib/portaudio.lib https://example.com/path/to/portaudio.lib # MSVC-style
curl -L -o bin/portaudio_x64.dll https://example.com/path/to/portaudio_x64.dll
# Option 2: Alternative sources (adjust URLs as needed)
# curl -L -o lib/libportaudio.a https://github.com/some-repo/portaudio-static/releases/download/v19.7.0/libportaudio.a
# curl -L -o bin/portaudio.dll https://github.com/some-repo/portaudio-binaries/releases/download/v19.7.0/portaudio.dll
# Verify downloads
echo "=== Downloaded files ==="
find . -type f -ls
- name: Set up PortAudio build environment (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
# Create pkg-config file for custom PortAudio
mkdir -p /mingw64/lib/pkgconfig
cat > /mingw64/lib/pkgconfig/portaudio-custom.pc << EOF
prefix=/mingw64/portaudio-custom
exec_prefix=\${prefix}
libdir=\${prefix}/lib
includedir=\${prefix}/include
Name: PortAudio
Description: Portable cross-platform Audio API
Version: 19.7.0
Libs: -L\${libdir} -lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi
Cflags: -I\${includedir}
EOF
# Or set environment variables directly
export PORTAUDIO_INCLUDE_DIR="/mingw64/portaudio-custom/include"
export PORTAUDIO_LIB_DIR="/mingw64/portaudio-custom/lib"
export PORTAUDIO_BIN_DIR="/mingw64/portaudio-custom/bin"
- name: Verify PortAudio setup (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
echo "=== Verifying PortAudio setup ==="
# Check header file
if [ -f "/mingw64/portaudio-custom/include/portaudio.h" ]; then
echo "✓ Header file found"
grep -i "asio\|version" /mingw64/portaudio-custom/include/portaudio.h | head -5
else else
echo "✗ Header file missing" echo "✗ libportaudio.a not found!"
echo "Contents of libs/audio directory:"
ls -la
exit 1
fi fi
# Check library files # Check if we have portaudio.h header
ls -la /mingw64/portaudio-custom/lib/ || echo "Library directory not found" if [ -f "portaudio.h" ]; then
echo "✓ Found portaudio.h"
# Check DLL grep -i "version\|asio" portaudio.h | head -3
ls -la /mingw64/portaudio-custom/bin/ || echo "Binary directory not found" else
echo "⚠ portaudio.h not found - may need to specify include path"
# Test if we can find ASIO symbols (if available) fi
find /mingw64/portaudio-custom -name "*.dll" -o -name "*.a" -exec nm {} \; 2>/dev/null | grep -i asio && echo "ASIO symbols found!" || echo "No ASIO symbols found"
- name: Build static audio library (Windows) - name: Build static audio library (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
@@ -132,55 +88,61 @@ jobs:
# Clean previous builds # Clean previous builds
make clean 2>/dev/null || echo "No previous build to clean" make clean 2>/dev/null || echo "No previous build to clean"
# Build with custom PortAudio # Build with local PortAudio static library
echo "Building with local libportaudio.a"
# Set compiler flags
export CFLAGS="$CFLAGS -DPA_USE_ASIO=1" export CFLAGS="$CFLAGS -DPA_USE_ASIO=1"
# Method 1: Use pkg-config with custom .pc file # Build using the local static library
if pkg-config --exists portaudio-custom; then # Point to current directory for both the library and headers
echo "Building with custom pkg-config PortAudio" make all \
make all PORTAUDIO_CFLAGS="$(pkg-config --cflags portaudio-custom)" PORTAUDIO_LIBS="$(pkg-config --libs portaudio-custom)" PORTAUDIO_CFLAGS="-I." \
PORTAUDIO_LIBS="./libportaudio.a -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi"
# Method 2: Use environment variables # Alternative if your Makefile expects different variable names:
elif [ -d "/mingw64/portaudio-custom" ]; then # make all \
echo "Building with custom PortAudio paths" # CFLAGS="-I. $CFLAGS" \
make all \ # LDFLAGS="./libportaudio.a -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi"
PORTAUDIO_CFLAGS="-I/mingw64/portaudio-custom/include" \
PORTAUDIO_LIBS="-L/mingw64/portaudio-custom/lib -lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi"
# Method 3: Fallback to system PortAudio echo "=== Build completed ==="
else ls -la *.dll *.a 2>/dev/null || echo "No output files found"
echo "Falling back to system PortAudio"
if pkg-config --exists portaudio; then - name: Verify build output (Windows)
make all PORTAUDIO_CFLAGS="$(pkg-config --cflags portaudio)" PORTAUDIO_LIBS="$(pkg-config --libs portaudio)" if: runner.os == 'Windows'
shell: msys2 {0}
working-directory: libs/audio
run: |
echo "=== Verifying build output ==="
# Check what was built
ls -la libaudio.dll 2>/dev/null && echo "✓ libaudio.dll created" || echo "✗ libaudio.dll not found"
# Check dependencies of the built DLL
if [ -f "libaudio.dll" ]; then
echo "=== DLL dependencies ==="
ldd libaudio.dll || objdump -p libaudio.dll | grep "DLL Name"
# Since we're statically linking PortAudio, it should NOT show portaudio.dll as dependency
if ldd libaudio.dll | grep -i portaudio; then
echo "⚠ WARNING: Still depends on external PortAudio DLL"
else else
make all PORTAUDIO_LIBS="-lportaudio -lole32 -luuid -lwinmm -ldsound -lwsock32 -lsetupapi" echo "✓ PortAudio is statically linked (no external dependency)"
fi fi
fi fi
# Verify the build - name: Copy static DLL (Windows)
make verify 2>/dev/null || echo "Verification step not available"
- name: Copy libraries and DLLs (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: | run: |
mkdir -p build/lib mkdir -p build/lib
# Copy your built library
cp libs/audio/libaudio.dll build/lib/ cp libs/audio/libaudio.dll build/lib/
# Copy the custom PortAudio DLL if it exists echo "=== Final build output ==="
if [ -f "/mingw64/portaudio-custom/bin/portaudio.dll" ]; then
cp /mingw64/portaudio-custom/bin/portaudio.dll build/lib/
echo "✓ Custom PortAudio DLL copied"
elif [ -f "/mingw64/portaudio-custom/bin/portaudio_x64.dll" ]; then
cp /mingw64/portaudio-custom/bin/portaudio_x64.dll build/lib/
echo "✓ Custom PortAudio x64 DLL copied"
else
echo "⚠ No custom PortAudio DLL found - runtime may need system PortAudio"
fi
echo "Build output:"
ls -la build/lib/ ls -la build/lib/
# Verify final DLL
echo "=== Final DLL dependencies ==="
ldd build/lib/libaudio.dll || echo "Could not check dependencies"
shell: bash shell: bash
# For Unix systems, also try static builds # For Unix systems, also try static builds

BIN
libs/audio/libportaudio.a Normal file

Binary file not shown.