@@ -56,10 +56,62 @@ jobs:
5656 - name : Install system dependencies
5757 run : |
5858 echo "🔧 Installing system dependencies for BPG..."
59- # Install missing libraries
60- sudo apt-get update -qq
61- sudo apt-get install -y libtiff5-dev pkg-config wget build-essential
62- echo "✅ System dependencies installed"
59+
60+ # Check if we can use sudo without password
61+ if sudo -n true 2>/dev/null; then
62+ echo "📦 Installing system packages with sudo..."
63+ sudo apt-get update -qq
64+ sudo apt-get install -y libtiff5-dev pkg-config wget build-essential
65+ echo "✅ System dependencies installed via apt"
66+ else
67+ echo "⚠️ Cannot use sudo - checking for existing dependencies..."
68+
69+ # Check if required tools/libraries are already available
70+ MISSING_DEPS=()
71+
72+ # Check for essential build tools
73+ if ! command -v gcc &> /dev/null; then
74+ MISSING_DEPS+=("gcc")
75+ fi
76+ if ! command -v make &> /dev/null; then
77+ MISSING_DEPS+=("make")
78+ fi
79+ if ! command -v wget &> /dev/null && ! command -v curl &> /dev/null; then
80+ MISSING_DEPS+=("wget or curl")
81+ fi
82+
83+ # Check for pkg-config and libraries
84+ if ! command -v pkg-config &> /dev/null; then
85+ MISSING_DEPS+=("pkg-config")
86+ fi
87+ if ! pkg-config --exists libtiff-4 2>/dev/null; then
88+ MISSING_DEPS+=("libtiff-dev")
89+ fi
90+
91+ if [ ${#MISSING_DEPS[@]} -eq 0 ]; then
92+ echo "✅ All required dependencies are already available"
93+ else
94+ echo "❌ Missing dependencies: ${MISSING_DEPS[*]}"
95+ echo "📝 BPG compilation may fail due to missing system dependencies"
96+ echo "💡 Consider configuring passwordless sudo for the runner user"
97+ echo " or pre-installing: libtiff5-dev pkg-config wget build-essential"
98+
99+ # Try alternative installation methods
100+ echo "🔄 Attempting alternative installation methods..."
101+
102+ # Try using conda if available
103+ if command -v conda &> /dev/null; then
104+ echo "📦 Trying conda installation..."
105+ conda install -c conda-forge libtiff pkg-config -y || echo "⚠️ Conda install failed"
106+ fi
107+
108+ # Try using homebrew if available (for macOS runners)
109+ if command -v brew &> /dev/null; then
110+ echo "📦 Trying homebrew installation..."
111+ brew install libtiff pkg-config || echo "⚠️ Homebrew install failed"
112+ fi
113+ fi
114+ fi
63115
64116 - name : Install BPG tools
65117 run : |
0 commit comments