@@ -44,41 +44,88 @@ jobs:
4444 if : runner.os == 'Windows'
4545 shell : powershell
4646 run : |
47- # Install OpenSSL via chocolatey
48- choco install openssl -y
47+ # Download and install Win32OpenSSL for better compatibility
48+ Write-Host "Downloading Win32OpenSSL..."
49+ $url = "https://slproweb.com/download/Win64OpenSSL-3_2_1.exe"
50+ $output = "$env:TEMP\Win64OpenSSL.exe"
4951
50- # Add OpenSSL to PATH
51- $env:Path += ";C:\Program Files\OpenSSL-Win64\bin"
52+ try {
53+ Invoke-WebRequest -Uri $url -OutFile $output -UseBasicParsing
54+ Write-Host "Installing Win32OpenSSL..."
55+ Start-Process -FilePath $output -ArgumentList "/SILENT", "/VERYSILENT", "/SP-", "/SUPPRESSMSGBOXES" -Wait
56+ Remove-Item $output -Force
57+ Write-Host "Win32OpenSSL installation completed"
58+ } catch {
59+ Write-Host "Win32OpenSSL download failed, falling back to chocolatey..."
60+ choco install openssl -y
61+ }
5262
53- # Verify installation and directories exist
54- if (Test-Path "C:\Program Files\OpenSSL-Win64\lib") {
55- Write-Host "OpenSSL lib directory found"
56- } else {
57- Write-Host "OpenSSL lib directory not found, checking alternate locations..."
58- if (Test-Path "C:\Program Files\OpenSSL\lib") {
59- Write-Host "Found OpenSSL at C:\Program Files\OpenSSL\"
60- echo "OPENSSL_DIR=C:\Program Files\OpenSSL" | Out-File -FilePath $env:GITHUB_ENV -Append
61- echo "OPENSSL_LIB_DIR=C:\Program Files\OpenSSL\lib" | Out-File -FilePath $env:GITHUB_ENV -Append
62- echo "OPENSSL_INCLUDE_DIR=C:\Program Files\OpenSSL\include" | Out-File -FilePath $env:GITHUB_ENV -Append
63- } else {
64- Write-Host "OpenSSL installation failed or directories not found"
65- exit 1
63+ # Define possible OpenSSL installation paths
64+ $possiblePaths = @(
65+ "C:\Program Files\OpenSSL-Win64",
66+ "C:\Program Files\OpenSSL",
67+ "C:\OpenSSL-Win64",
68+ "C:\OpenSSL"
69+ )
70+
71+ $opensslPath = $null
72+ foreach ($path in $possiblePaths) {
73+ if (Test-Path "$path\lib") {
74+ $opensslPath = $path
75+ Write-Host "Found OpenSSL at: $path"
76+ break
6677 }
6778 }
6879
69- # Set environment variables for the standard location
70- if (Test-Path "C:\Program Files\OpenSSL-Win64\lib") {
71- echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
72- echo "OPENSSL_LIB_DIR=C:\Program Files\OpenSSL-Win64\lib" | Out-File -FilePath $env:GITHUB_ENV -Append
73- echo "OPENSSL_INCLUDE_DIR=C:\Program Files\OpenSSL-Win64\include" | Out-File -FilePath $env:GITHUB_ENV -Append
80+ if (-not $opensslPath) {
81+ Write-Host "ERROR: OpenSSL installation not found in any expected location"
82+ Write-Host "Searched paths:"
83+ foreach ($path in $possiblePaths) {
84+ Write-Host " - $path"
85+ }
86+ exit 1
7487 }
7588
76- # Also set OPENSSL_ROOT_DIR for compatibility
77- if (Test-Path "C:\Program Files\OpenSSL-Win64") {
78- echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
79- } elseif (Test-Path "C:\Program Files\OpenSSL") {
80- echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" | Out-File -FilePath $env:GITHUB_ENV -Append
89+ # Set environment variables for cargo and the linker
90+ echo "OPENSSL_DIR=$opensslPath" | Out-File -FilePath $env:GITHUB_ENV -Append
91+ echo "OPENSSL_LIB_DIR=$opensslPath\lib" | Out-File -FilePath $env:GITHUB_ENV -Append
92+ echo "OPENSSL_INCLUDE_DIR=$opensslPath\include" | Out-File -FilePath $env:GITHUB_ENV -Append
93+ echo "OPENSSL_ROOT_DIR=$opensslPath" | Out-File -FilePath $env:GITHUB_ENV -Append
94+
95+ # Add OpenSSL bin directory to PATH for DLL resolution during linking
96+ $currentPath = [Environment]::GetEnvironmentVariable("PATH", "Process")
97+ $newPath = "$opensslPath\bin;$currentPath"
98+ echo "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append
99+
100+ # Verify all required files exist
101+ $requiredFiles = @(
102+ "$opensslPath\lib\libssl.lib",
103+ "$opensslPath\lib\libcrypto.lib",
104+ "$opensslPath\bin\libssl-3-x64.dll",
105+ "$opensslPath\bin\libcrypto-3-x64.dll"
106+ )
107+
108+ $missingFiles = @()
109+ foreach ($file in $requiredFiles) {
110+ if (-not (Test-Path $file)) {
111+ $missingFiles += $file
112+ }
81113 }
114+
115+ if ($missingFiles.Count -gt 0) {
116+ Write-Host "WARNING: Some OpenSSL files are missing:"
117+ foreach ($file in $missingFiles) {
118+ Write-Host " - $file"
119+ }
120+ } else {
121+ Write-Host "All required OpenSSL files found"
122+ }
123+
124+ # Display environment for debugging
125+ Write-Host "OpenSSL configuration:"
126+ Write-Host " OPENSSL_DIR: $opensslPath"
127+ Write-Host " OPENSSL_LIB_DIR: $opensslPath\lib"
128+ Write-Host " OPENSSL_INCLUDE_DIR: $opensslPath\include"
82129
83130 - name : Install Perl dependencies for OpenSSL (Windows fallback)
84131 if : runner.os == 'Windows'
@@ -103,6 +150,28 @@ jobs:
103150 - name : Build
104151 timeout-minutes : 15
105152 run : |
153+ # On Windows, display OpenSSL environment for debugging
154+ if [ "${{ runner.os }}" = "Windows" ]; then
155+ echo "=== OpenSSL Environment Debug Info ==="
156+ echo "OPENSSL_DIR: $OPENSSL_DIR"
157+ echo "OPENSSL_LIB_DIR: $OPENSSL_LIB_DIR"
158+ echo "OPENSSL_INCLUDE_DIR: $OPENSSL_INCLUDE_DIR"
159+ echo "PATH (first 500 chars): ${PATH:0:500}"
160+
161+ # List OpenSSL library files if directory exists
162+ if [ -d "$OPENSSL_LIB_DIR" ]; then
163+ echo "OpenSSL lib directory contents:"
164+ ls -la "$OPENSSL_LIB_DIR" || true
165+ fi
166+
167+ # Check if OpenSSL DLLs are accessible
168+ if [ -d "$OPENSSL_DIR/bin" ]; then
169+ echo "OpenSSL bin directory contents:"
170+ ls -la "$OPENSSL_DIR/bin" || true
171+ fi
172+ echo "=== End OpenSSL Debug Info ==="
173+ fi
174+
106175 cargo build --release --target ${{ matrix.target }}
107176
108177 - name : Check for dependency drift
0 commit comments