From 8541efc7c2cd3d901798f2a5e8b3ae67a0b57000 Mon Sep 17 00:00:00 2001 From: Jon Raiford Date: Sat, 11 Jul 2026 12:57:26 -0400 Subject: [PATCH 1/2] Add Windows on Arm (arm64) CI: build + regression-test the driver, MSM and MSI natively on windows-11-arm, with libpq and OpenSSL built from source --- .github/workflows/configuration.xml | 13 + .github/workflows/main.yml | 355 +++++++++++++++++++++++++++- installer/buildInstallers.ps1 | 6 +- installer/psqlodbc_cpu.wxs | 13 +- installer/psqlodbcm_cpu.wxs | 16 +- winbuild/BuildAll.ps1 | 13 +- winbuild/Psqlodbc-config.psm1 | 4 +- winbuild/configuration_template.xml | 10 + winbuild/pgenlist.vcxproj | 86 ++++++- winbuild/pgxalib.vcxproj | 70 +++++- winbuild/psqlodbc.Cpp.props | 40 ++++ winbuild/psqlodbc.vcxproj | 76 +++++- winbuild/psqlsetup.vcxproj | 90 ++++++- winbuild/regress.ps1 | 9 +- winbuild/regress_one.vcxproj | 72 +++++- 15 files changed, 859 insertions(+), 14 deletions(-) diff --git a/.github/workflows/configuration.xml b/.github/workflows/configuration.xml index 760dc956..c6c66996 100644 --- a/.github/workflows/configuration.xml +++ b/.github/workflows/configuration.xml @@ -28,6 +28,19 @@ + + + C:\postgresql_arm64\include + C:\postgresql_arm64\lib + C:\postgresql_arm64\bin + + + + + + + + 03/04/2024 10:49:13 17.0 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9637a77..10e34faa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,10 @@ env: # PostgreSQL build from source. POSTGRESQL_SOURCE_TAG: 'REL_18_STABLE' OPENSSL_VERSION: '3_5_7' + # OpenSSL is built from source for arm64 (no reliable prebuilt arm64 installer); + # this is the git tag in https://github.com/openssl/openssl to build. + OPENSSL_ARM64_TAG: 'openssl-3.5.7' + WORKFLOW_VERSION_POSTGRESQL_ARM64: '1' # increment to invalidate the arm64 cache PKGCONFIGLITE_VERSION: '0.28-1' WINFLEXBISON_VERSION: '2.5.24' WORKFLOW_VERSION_POSTGRESQL: '1' # increment to invalidate cache @@ -393,11 +397,360 @@ jobs: retention-days: 5 if-no-files-found: error + # ===================================================================== + # Build PostgreSQL arm64 (full, from source) for Windows on Arm + # + # The windows-11-arm image has no prebuilt arm64 OpenSSL/PostgreSQL, so + # OpenSSL and libpq are built from source natively. Only libpq is built: + # the full server does not build for aarch64 (PostgreSQL's msvc_gendef.pl + # rejects the arch when generating postgres.def), and the driver only needs + # libpq. The regression test server is a separate x64 EDB install (run under + # emulation) in the build-and-test job. windows-11-arm has no D: drive, so + # outputs live under C:. Results are cached so subsequent runs skip this job. + # ===================================================================== + build-postgres-arm: + runs-on: windows-11-arm + + steps: + - name: Cache libpq arm64 build output + uses: actions/cache@v4 + id: cachePostgresArm + with: + path: C:\postgresql_arm64 + key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_ARM64_TAG}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} + + # ----------------------------------------------------------------- + # Source code + # ----------------------------------------------------------------- + - name: Cache PostgreSQL source + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + uses: actions/cache@v4 + id: cachePgSourceArm + with: + path: postgres + # Distinct from the x64 job's pg-source key: that cache contains an + # x64-configured meson build/ dir with absolute D: paths, which breaks + # a C:-based arm64 reconfigure. + key: pg-source-arm64-${{env.POSTGRESQL_SOURCE_TAG}} + - name: Get PostgreSQL source + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePgSourceArm.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: "postgres/postgres.git" + ref: ${{env.POSTGRESQL_SOURCE_TAG}} + path: postgres + + # ----------------------------------------------------------------- + # Build tools + # ----------------------------------------------------------------- + - name: Install meson and ninja + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + run: python -m pip install meson ninja + + - name: Cache winflexbison + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + uses: actions/cache@v4 + id: cacheWinFlexBisonArm + with: + path: C:\OTHERBIN\winflexbison + key: winflexbison-${{env.WINFLEXBISON_VERSION}} + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 + - name: Download winflexbison + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheWinFlexBisonArm.outputs.cache-hit != 'true' + uses: suisei-cn/actions-download-file@v1.6.0 + with: + retry-times: 5 + url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-${{env.WINFLEXBISON_VERSION}}.zip + filename: win_flex_bison.zip + - name: Extract winflexbison + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheWinFlexBisonArm.outputs.cache-hit != 'true' + shell: cmd + run: | + mkdir "C:\OTHERBIN\winflexbison" + 7z x win_flex_bison.zip -o"C:\OTHERBIN\winflexbison" + - name: Add winflexbison to PATH + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + shell: cmd + run: printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH% + + - name: Cache pkgconfiglite + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + uses: actions/cache@v4 + id: cachePkgConfigLiteArm + with: + path: C:\OTHERBIN\pkgconfiglite + key: pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}-win32 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 + - name: Download pkgconfiglite + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePkgConfigLiteArm.outputs.cache-hit != 'true' + uses: suisei-cn/actions-download-file@v1.6.0 + with: + retry-times: 5 + url: http://downloads.sourceforge.net/project/pkgconfiglite/${{env.PKGCONFIGLITE_VERSION}}/pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}_bin-win32.zip + filename: pkg-config-lite_bin-win32.zip + - name: Extract pkgconfiglite + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePkgConfigLiteArm.outputs.cache-hit != 'true' + shell: cmd + run: | + mkdir "C:\OTHERBIN\pkgconfiglite" + 7z x pkg-config-lite_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite" + - name: Add pkgconfiglite to PATH + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + shell: cmd + run: printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-%PKGCONFIGLITE_VERSION%\\bin" >> %GITHUB_PATH% + + # ----------------------------------------------------------------- + # Native arm64 MSVC toolchain + # ----------------------------------------------------------------- + - name: Setup MSVC arm64 + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: arm64 + + # ----------------------------------------------------------------- + # OpenSSL arm64 (built from source; required for release installers). + # Uses the runner's Strawberry Perl + the arm64 MSVC toolset. + # + # OpenSSL has its own cache (keyed by the OpenSSL tag) and is saved + # immediately after it builds, so it survives failures in later steps + # and libpq-cache misses -- avoiding a ~9 min recompile on every + # iteration. On a hit, the compile below is skipped. + # ----------------------------------------------------------------- + - name: Restore OpenSSL arm64 from cache + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + id: cacheOpenSSLArm + uses: actions/cache/restore@v4 + with: + path: C:\OTHERBIN\openssl_arm64 + key: openssl-arm64-${{env.OPENSSL_ARM64_TAG}} + - name: Get OpenSSL source + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + repository: "openssl/openssl" + ref: ${{env.OPENSSL_ARM64_TAG}} + path: openssl + - name: Build and install OpenSSL arm64 + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' + working-directory: openssl + shell: cmd + run: | + perl Configure VC-WIN64-ARM no-tests --prefix=c:\OTHERBIN\openssl_arm64 --openssldir=c:\OTHERBIN\openssl_arm64\ssl + nmake + nmake install_sw + - name: Save OpenSSL arm64 to cache + if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: C:\OTHERBIN\openssl_arm64 + key: openssl-arm64-${{env.OPENSSL_ARM64_TAG}} + + # ----------------------------------------------------------------- + # Build libpq arm64 only (with SSL). + # + # Building only the libpq client library avoids the full-server build, + # which fails for aarch64 (postgres.def generation). This mirrors the + # x86 libpq-only build in the x64 job. A minimal libpq SDK (lib + dll + + # the client headers psqlodbc needs) is assembled under C:\postgresql_arm64. + # ----------------------------------------------------------------- + - name: Build libpq arm64 + if: steps.cachePostgresArm.outputs.cache-hit != 'true' + working-directory: postgres + shell: pwsh + run: | + # Always configure a clean arm64 build dir (never reuse a stale or + # cross-arch meson configuration). + if (Test-Path build) { Remove-Item -Recurse -Force build } + meson setup build -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl_arm64\lib -Dextra_include_dirs=c:\OTHERBIN\openssl_arm64\include --prefix=C:\postgresql_arm64 + + # Build only the libpq client library (and its dependencies). + meson compile -C build src/interfaces/libpq/libpq:shared_library + + # Assemble a minimal libpq SDK layout at C:\postgresql_arm64. + New-Item -ItemType Directory -Force -Path C:\postgresql_arm64\lib, C:\postgresql_arm64\bin, C:\postgresql_arm64\include | Out-Null + Get-ChildItem build -Recurse -Filter libpq.lib | Select-Object -First 1 | Copy-Item -Destination C:\postgresql_arm64\lib\ + Get-ChildItem build -Recurse -Filter libpq.dll | Select-Object -First 1 | Copy-Item -Destination C:\postgresql_arm64\bin\ + + # Headers: reproduce a PostgreSQL install-style include layout so the + # driver builds. psqlodbc includes , "pqexpbuffer.h" and + # "postgres_fe.h"; the last pulls in the full server header tree + # (c.h, pg_config*.h, ...). Client headers go in include\, server + # headers in include\server\ (on psqlodbc's PG_INC/server include path). + $inc = "C:\postgresql_arm64\include" + New-Item -ItemType Directory -Force -Path "$inc\server" | Out-Null + Copy-Item src\interfaces\libpq\libpq-fe.h, src\interfaces\libpq\libpq-events.h, src\interfaces\libpq\pqexpbuffer.h $inc + Copy-Item src\include\postgres_ext.h $inc + # Full server header tree: static source headers plus the meson-generated + # pg_config.h / pg_config_os.h (emitted together in build\src\include). + # (PostgreSQL 18 has no pg_config_ext.h.) + Copy-Item -Recurse -Force src\include\* "$inc\server" + $gen = (Get-ChildItem build -Recurse -Filter pg_config.h | Select-Object -First 1).Directory.FullName + Copy-Item -Recurse -Force "$gen\*" "$inc\server" + + # OpenSSL runtime DLLs alongside libpq (needed at load time and by the installer). + Copy-Item c:\OTHERBIN\openssl_arm64\bin\*.dll C:\postgresql_arm64\bin\ + + # ===================================================================== + # Build and test psqlodbc arm64 (standard and mimalloc, in parallel) + # + # Runs natively on windows-11-arm. The regression tests run against a + # from-source arm64 PostgreSQL server started below. + # ===================================================================== + build-and-test-arm: + needs: build-postgres-arm + runs-on: windows-11-arm + strategy: + fail-fast: false + matrix: + # mimalloc is omitted on arm64: the vendored mimalloc submodule's VS + # project (libs/mimalloc/ide/vs2022/mimalloc.vcxproj) declares no ARM64 + # configuration, so mimalloc-static.lib can't be built for arm64. Left + # as a follow-up (submodule bump or CMake build); mimalloc remains + # enabled for x86/x64. + variant: [standard] + + steps: + - name: Restore libpq arm64 build from cache + uses: actions/cache/restore@v4 + with: + path: C:\postgresql_arm64 + key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_ARM64_TAG}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} + fail-on-cache-miss: true + + # ----------------------------------------------------------------- + # Test dependencies + # ----------------------------------------------------------------- + - name: Cache GNU diffutils + uses: actions/cache@v4 + id: cacheDiffutilsArm + with: + path: C:\OTHERBIN\diffutils + key: diffutils-${{env.DIFFUTILS_VERSION}} + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 + - name: Download GNU diffutils + if: steps.cacheDiffutilsArm.outputs.cache-hit != 'true' + uses: suisei-cn/actions-download-file@v1.6.0 + with: + retry-times: 5 + url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/${{env.DIFFUTILS_VERSION}}/diffutils-${{env.DIFFUTILS_VERSION}}-bin.zip + filename: diffutils-bin.zip + - name: Extract GNU diffutils + if: steps.cacheDiffutilsArm.outputs.cache-hit != 'true' + shell: cmd + run: | + mkdir "C:\OTHERBIN\diffutils" + 7z x diffutils-bin.zip -o"C:\OTHERBIN\diffutils" + - name: Add diffutils to PATH + shell: cmd + run: printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH% + + # ----------------------------------------------------------------- + # PostgreSQL test server: the x64 EDB installer, run under Windows-on-Arm + # x64 emulation. The driver connects over localhost TCP, so the server's + # architecture is irrelevant. The regression harness (reset-db) creates + # the contrib_regression database itself, so no createdb here. + # ----------------------------------------------------------------- + - name: Cache PostgreSQL installer + uses: actions/cache@v4 + id: cacheInstallerArm + with: + path: C:\OTHERBIN\postgresql_install.exe + key: pg-installer-${{env.POSTGRESQL_PACKAGE_FILEID}} + - name: Download PostgreSQL installer + if: steps.cacheInstallerArm.outputs.cache-hit != 'true' + uses: suisei-cn/actions-download-file@v1.6.0 + with: + retry-times: 5 + url: https://sbp.enterprisedb.com/getfile.jsp?fileid=${{env.POSTGRESQL_PACKAGE_FILEID}} + target: c:\OTHERBIN + filename: postgresql_install.exe + - name: Install and start PostgreSQL server + shell: cmd + run: | + echo on + C:\OTHERBIN\postgresql_install.exe --mode unattended --unattendedmodeui none --superpassword password --enable-components server + sc config "postgresql-x64-17" start= auto + sc start "postgresql-x64-17" + ping -n 6 127.0.0.1 >nul + + # Put the arm64 libpq (and its OpenSSL DLLs) ahead of the emulated x64 + # server's bin so the arm64 driver loads the matching arm64 libpq at runtime. + - name: Add arm64 libpq to PATH + shell: cmd + run: echo C:\postgresql_arm64\bin>> %GITHUB_PATH% + + # ----------------------------------------------------------------- + # Build and test psqlodbc + # ----------------------------------------------------------------- + - name: Checkout psqlodbc + uses: actions/checkout@v4 + with: + path: psqlodbc + submodules: true + - name: Setup MSVC arm64 for psqlodbc + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: arm64 + + - name: Install WiX + shell: cmd + run: | + dotnet tool install --global wix --version "6.*" + wix extension add --global WixToolset.UI.wixext/6.0.0 + + - name: Build psqlodbc ${{matrix.variant}} + shell: powershell + working-directory: psqlodbc + run: | + copy .github\workflows\configuration.xml winbuild + if ('${{matrix.variant}}' -eq 'mimalloc') { + winbuild\BuildAll.ps1 -Platform ARM64 -UseMimalloc + } else { + winbuild\BuildAll.ps1 -Platform ARM64 + } + installer\buildInstallers.ps1 -cpu arm64 + env: + PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}} + - name: Test psqlodbc ${{matrix.variant}} + shell: powershell + working-directory: psqlodbc + run: | + if ('${{matrix.variant}}' -eq 'mimalloc') { + winbuild\regress.ps1 -Platform ARM64 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password" -ExpectMimalloc + } else { + winbuild\regress.ps1 -Platform ARM64 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password" + } + ${{matrix.variant}}\test_arm64\RegisterRegdsn.exe uninstall_driver postgres_devw + env: + PSQLODBC_OBJBASE: ${{ github.workspace }}\psqlodbc\winbuild\${{matrix.variant}} + + # ----------------------------------------------------------------- + # Upload artifacts (named to match the release job's glob patterns) + # ----------------------------------------------------------------- + - name: Upload ${{matrix.variant}} arm64 merge module + uses: actions/upload-artifact@v4 + with: + name: psqlODBC ${{matrix.variant}} arm64 Merge Module + path: psqlodbc/winbuild/${{matrix.variant}}/installer/arm64/*.msm + retention-days: 5 + if-no-files-found: error + - name: Upload ${{matrix.variant}} arm64 installer package + uses: actions/upload-artifact@v4 + with: + name: psqlODBC ${{matrix.variant}} arm64 Installer + path: psqlodbc/winbuild/${{matrix.variant}}/installer/arm64/*.msi + retention-days: 5 + if-no-files-found: error + # ===================================================================== # Release (only on version tags) # ===================================================================== release: - needs: build-and-test + needs: [build-and-test, build-and-test-arm] if: startsWith(github.ref, 'refs/tags/REL-') runs-on: windows-latest diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index 7ba24ba8..bb1579c9 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -31,7 +31,7 @@ # build 32bit and/or 64bit installers # Param( -[ValidateSet("x86", "x64", "both")] +[ValidateSet("x86", "x64", "arm64", "both")] [string]$cpu="both", [switch]$AlongWithDrivers, [switch]$ExcludeRuntime, @@ -131,9 +131,9 @@ function findRuntime([int]$toolset_no, [String]$pgmvc) $pgmvc = "${env:SystemRoot}\syswow64" } } else { - if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { + if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64" -or $env:PROCESSOR_ARCHITECTURE -eq "ARM64") { $pgmvc = "${env:SystemRoot}\system32" - } elseif ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { + } elseif ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64" -or $env:PROCESSOR_ARCHITEW6432 -eq "ARM64") { $pgmvc = "${env:SystemRoot}\sysnative" } else { throw "${messageSpec}`n$dllinredist doesn't exist unfortunately" diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index 60075cfd..b2b3861f 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -10,6 +10,7 @@ + @@ -18,6 +19,16 @@ + + + + + + + + + + @@ -36,7 +47,7 @@ Name="$(PKGNAME)" Version="$(VERSION)" Codepage="1252" - InstallerVersion="300" + InstallerVersion="$(PKGINSTVER)" Compressed="yes" Language="1033"> diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index e4256672..2f0dba92 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -33,6 +33,20 @@ + + + + + + + + + + + + + + @@ -139,7 +153,7 @@ - + diff --git a/winbuild/BuildAll.ps1 b/winbuild/BuildAll.ps1 index 6ede2860..729cc793 100755 --- a/winbuild/BuildAll.ps1 +++ b/winbuild/BuildAll.ps1 @@ -60,7 +60,7 @@ Param( [ValidateSet("Build", "Rebuild", "Clean", "info")] [string]$Target="Build", [string]$VCVersion, -[ValidateSet("Win32", "x64", "both")] +[ValidateSet("Win32", "x64", "ARM64", "both")] [string]$Platform="both", [string]$Toolset, [ValidateSet("", "4.0", "12.0", "14.0")] @@ -76,6 +76,8 @@ function buildPlatform([xml]$configInfo, [string]$Platform) { if ($Platform -ieq "x64") { $platinfo=$configInfo.Configuration.x64 + } elseif ($Platform -ieq "ARM64") { + $platinfo=$configInfo.Configuration.arm64 } else { $platinfo=$configInfo.Configuration.x86 } @@ -182,6 +184,15 @@ try { } } # +# build ARM64 dlls +# + if ($recordResult -and ($Platform -ieq "ARM64")) { + buildPlatform $configInfo "ARM64" + if ($LastExitCode -ne 0) { + $recordResult = $false + } + } +# # Write the result to configuration xml # $resultText="successful" diff --git a/winbuild/Psqlodbc-config.psm1 b/winbuild/Psqlodbc-config.psm1 index c6d8e0c9..264f7d77 100755 --- a/winbuild/Psqlodbc-config.psm1 +++ b/winbuild/Psqlodbc-config.psm1 @@ -106,6 +106,8 @@ function getPGDir([xml]$configInfo, [string]$Platform, [string]$kind) { if ($Platform -ieq "x64") { $platinfo=$configInfo.Configuration.x64 + } elseif ($Platform -ieq "ARM64") { + $platinfo=$configInfo.Configuration.arm64 } else { $platinfo=$configInfo.Configuration.x86 } @@ -120,7 +122,7 @@ function getPGDir([xml]$configInfo, [string]$Platform, [string]$kind) if ($result -ne "default") { return $result } - if ($Platform -ieq "x64") { + if ($Platform -ieq "x64" -or $Platform -ieq "ARM64") { if ($env:PROCESSOR_ARCHITECTURE -ieq "x86") { $pgmfs = $env:ProgramW6432 } else { diff --git a/winbuild/configuration_template.xml b/winbuild/configuration_template.xml index 78012550..0a500fb7 100755 --- a/winbuild/configuration_template.xml +++ b/winbuild/configuration_template.xml @@ -21,6 +21,16 @@ + + + default + default + default + + + + + diff --git a/winbuild/pgenlist.vcxproj b/winbuild/pgenlist.vcxproj index 4bca4fdf..f61c19d7 100755 --- a/winbuild/pgenlist.vcxproj +++ b/winbuild/pgenlist.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Debug + ARM64 + + + Release + ARM64 + {DFD90C9A-E9BA-4CA3-812B-E820EE9A3F5B} @@ -54,6 +62,21 @@ true MultiByte + + DynamicLibrary + true + true + v143 + MultiByte + + + DynamicLibrary + true + false + v143 + true + MultiByte + @@ -69,6 +92,12 @@ + + + + + + no @@ -87,7 +116,10 @@ x86 - + + arm64 + + x64 @@ -110,6 +142,12 @@ false + + true + + + false + @@ -205,6 +243,52 @@ + + + _HANDLE_ENLIST_IN_DTC_;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;PGENLIST_EXPORTS;%(PreprocessorDefinitions) + + + MachineARM64 + $(srcPath)$(targetName).def + true + + + XOLEHLP.dll;%(DelayLoadDLLs) + xolehlp.lib;$(Drivername).lib;%(AdditionalDependencies) + $(OutDir);%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + _HANDLE_ENLIST_IN_DTC_;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;PGENLIST_EXPORTS;%(PreprocessorDefinitions) + + + MachineARM64 + $(srcPath)$(targetName).def + true + + + XOLEHLP.dll;%(DelayLoadDLLs) + xolehlp.lib;$(Drivername).lib;%(AdditionalDependencies) + $(OutDir);%(AdditionalLibraryDirectories) + + + + + + diff --git a/winbuild/pgxalib.vcxproj b/winbuild/pgxalib.vcxproj index f1a16759..38cb0375 100755 --- a/winbuild/pgxalib.vcxproj +++ b/winbuild/pgxalib.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Debug + ARM64 + + + Release + ARM64 + {27D21217-BD79-4A0A-80C4-EE87C57D423F} @@ -50,6 +58,19 @@ true MultiByte + + DynamicLibrary + true + v143 + MultiByte + + + DynamicLibrary + false + v143 + true + MultiByte + @@ -65,6 +86,12 @@ + + + + + + pgxalib @@ -79,7 +106,10 @@ x86 - + + arm64 + + x64 @@ -102,6 +132,12 @@ false + + true + + + false + @@ -169,6 +205,38 @@ + + + _HANDLE_ENLIST_IN_DTC_;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;PGENLIST_EXPORTS;%(PreprocessorDefinitions) + + + wsock32.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + _HANDLE_ENLIST_IN_DTC_;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;PGENLIST_EXPORTS;%(PreprocessorDefinitions) + + + wsock32.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + + diff --git a/winbuild/psqlodbc.Cpp.props b/winbuild/psqlodbc.Cpp.props index 8100933b..9ba3bb3d 100644 --- a/winbuild/psqlodbc.Cpp.props +++ b/winbuild/psqlodbc.Cpp.props @@ -16,6 +16,10 @@ psqlodbc.Cpp.props Level3 4018 + + Level3 + 4018 + $(ADD_DEFINES);POSTGRESDRIVERVERSION="$(DRIVERVERSION)" $(RSC_DEFINES);PG_DRVFILE_VERSION=$(DRIVERVERSION.substring(0, 2)),$(DRIVERVERSION.substring(3,2)),$(DRIVERVERSION.substring(6, 2)),$(DRIVERVERSION.substring(8, 2));POSTGRES_RESOURCE_VERSION=\"$(DRIVERVERSION)\" @@ -92,4 +96,40 @@ psqlodbc.Cpp.props $(OutDir)$(TargetName)$(TargetExt) + + + NotUsing + $(WarnLvl) + Disabled + true + + $(DSpcWarn) + + + Windows + true + $(srcPath)$(TargetName).def + $(OutDir)$(TargetName)$(TargetExt) + + + + + $(WarnLvl) + NotUsing + MaxSpeed + true + true + true + + $(DSpcWarn) + + + Windows + true + true + true + $(srcPath)$(TargetName).def + $(OutDir)$(TargetName)$(TargetExt) + + diff --git a/winbuild/psqlodbc.vcxproj b/winbuild/psqlodbc.vcxproj index adf5878e..163998d5 100755 --- a/winbuild/psqlodbc.vcxproj +++ b/winbuild/psqlodbc.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Debug + ARM64 + + + Release + ARM64 + {79F872B5-9FAF-43DF-B441-9C860EAE52CF} @@ -51,6 +59,19 @@ true MultiByte + + DynamicLibrary + true + v143 + MultiByte + + + DynamicLibrary + false + v143 + true + MultiByte + @@ -66,6 +87,12 @@ + + + + + + no @@ -106,7 +133,10 @@ x86 - + + arm64 + + x64 @@ -151,6 +181,12 @@ false + + true + + + false + @@ -230,6 +266,44 @@ lib /def:$(srcPath)$(DTCDLL).def /machine:x64 /out:"$(outDir)\$(DTCDLL).lib" + + + _CRT_SECURE_NO_DEPRECATE;$(ADD_DEFINES);DYNAMIC_LOAD;WIN_MULTITHREAD_SUPPORT;WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + $(ADD_INC);%(AdditionalIncludeDirectories) + + + $(RSC_DEFINES);%(PreprocessorDefinitions) + + + $(DELAY_LOAD_DLLS);%(DelayLoadDLLs) + $(ADD_LIBPATH);$(OutDir);%(AdditionalLibraryDirectories) + $(CALL_LIB);libpq.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;wsock32.lib;ws2_32.lib;secur32.lib;winmm.lib;%(AdditionalDependencies) + $(MAINDEF) + true + + + lib /def:$(srcPath)$(DTCDLL).def /machine:arm64 /out:"$(outDir)\$(DTCLDLL).lib" + + + + + _CRT_SECURE_NO_DEPRECATE;$(ADD_DEFINES);DYNAMIC_LOAD;WIN_MULTITHREAD_SUPPORT;WIN32;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + $(ADD_INC);%(AdditionalIncludeDirectories) + + + $(RSC_DEFINES);%(PreprocessorDefinitions) + + + $(DELAY_LOAD_DLLS);%(DelayLoadDLLs) + $(ADD_LIBPATH);$(OutDir);%(AdditionalLibraryDirectories) + $(CALL_LIB);libpq.lib;winmm.lib;wsock32.lib;ws2_32.lib;secur32.lib;%(AdditionalDependencies) + $(MAINDEF) + true + + + lib /def:$(srcPath)$(DTCDLL).def /machine:arm64 /out:"$(outDir)\$(DTCDLL).lib" + + diff --git a/winbuild/psqlsetup.vcxproj b/winbuild/psqlsetup.vcxproj index 4b688296..8113a155 100644 --- a/winbuild/psqlsetup.vcxproj +++ b/winbuild/psqlsetup.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Debug + ARM64 + + + Release + ARM64 + {DFD90C9A-E9BA-4CA3-812B-E820EE9A3F5B} @@ -55,6 +63,21 @@ true MultiByte + + DynamicLibrary + + true + v143 + MultiByte + + + DynamicLibrary + + false + v143 + true + MultiByte + @@ -70,6 +93,12 @@ + + + + + + no @@ -99,7 +128,10 @@ x86 - + + arm64 + + x64 @@ -126,6 +158,12 @@ false + + true + + + false + @@ -249,6 +287,56 @@ + + + DYNAMIC_LOAD;_HANDLE_ENLIST_IN_DTC_;WIN_MULTITHREAD_SUPPORT;$(ADD_DEFINES);_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;PSQLSETUP_EXPORTS;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + + + $(RSC_DEFINES);%(PreprocessorDefinitions) + + + MachineARM64 + $(srcPath)$(targetName).def + true + $(OutDir);%(AdditionalLibraryDirectories) + + + $(DELAY_LOAD_DLLS);%(DelayLoadDLLs) + $(CALL_LIB);winmm.lib;%(AdditionalDependencies) + $(OutDir);%(AdditionalLibraryDirectories) + true + + + + + + + + + DYNAMIC_LOAD;_HANDLE_ENLIST_IN_DTC_;WIN_MULTITHREAD_SUPPORT;$(ADD_DEFINES);_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;PSQLSETUP_EXPORTS;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + + + $(RSC_DEFINES);%(PreprocessorDefinitions) + + + MachineARM64 + $(srcPath)$(targetName).def + true + $(OutDir);%(AdditionalLibraryDirectories) + + + $(DELAY_LOAD_DLLS);%(DelayLoadDLLs) + $(CALL_LIB);winmm.lib;%(AdditionalDependencies) + $(OutDir);%(AdditionalLibraryDirectories) + true + + + + + + diff --git a/winbuild/regress.ps1 b/winbuild/regress.ps1 index be33df0e..7c4d4e0f 100644 --- a/winbuild/regress.ps1 +++ b/winbuild/regress.ps1 @@ -73,7 +73,7 @@ Param( [string[]]$TestList, [switch]$Ansi, [string]$VCVersion, -[ValidateSet("Win32", "x64", "both")] +[ValidateSet("Win32", "x64", "ARM64", "both")] [string]$Platform="both", [string]$Toolset, [ValidateSet("", "4.0", "12.0", "14.0")] @@ -215,6 +215,8 @@ function RunTest($scriptPath, $Platform, $testexes) # Run regression tests if ($Platform -eq "x64") { $targetdir="test_x64" + } elseif ($Platform -eq "ARM64") { + $targetdir="test_arm64" } else { $targetdir="test_x86" } @@ -430,6 +432,11 @@ foreach ($pl in $pary) { $bit="32-bit" $dlldir="$objbase\x86_${ansi_dir_part}_$DriverConfiguration" } + "ARM64" { + $targetdir="test_arm64" + $bit="ARM64" + $dlldir="$objbase\arm64_${ansi_dir_part}_$DriverConfiguration" + } default { $targetdir="test_x64" $bit="64-bit" diff --git a/winbuild/regress_one.vcxproj b/winbuild/regress_one.vcxproj index df5f436e..64980f2c 100755 --- a/winbuild/regress_one.vcxproj +++ b/winbuild/regress_one.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Debug + ARM64 + + + Release + ARM64 + {BBD60387-0E82-48F9-A0B3-41659252D639} @@ -55,6 +63,19 @@ true Ansi + + Application + true + v143 + Ansi + + + Application + false + v143 + true + Ansi + @@ -70,10 +91,19 @@ + + + + + + x86 - + + arm64 + + x64 @@ -99,6 +129,12 @@ false + + true + + + false + NotUsing @@ -167,6 +203,40 @@ %(IgnoreSpecificDefaultLibraries) + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + + + Console + true + $(IntDir)common.obj;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + %(IgnoreSpecificDefaultLibraries) + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + $(IntDir)common.obj;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + %(IgnoreSpecificDefaultLibraries) + + From 8ac44d7ee353b3c3bb41d0c7e0d5463792780c3d Mon Sep 17 00:00:00 2001 From: Jon Raiford Date: Mon, 13 Jul 2026 17:45:42 -0400 Subject: [PATCH 2/2] Windows arm64 CI: use prebuilt slproweb OpenSSL and align arm64 build job with x64 --- .github/workflows/main.yml | 121 ++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 68 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10e34faa..c89b52ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,9 +17,6 @@ env: # PostgreSQL build from source. POSTGRESQL_SOURCE_TAG: 'REL_18_STABLE' OPENSSL_VERSION: '3_5_7' - # OpenSSL is built from source for arm64 (no reliable prebuilt arm64 installer); - # this is the git tag in https://github.com/openssl/openssl to build. - OPENSSL_ARM64_TAG: 'openssl-3.5.7' WORKFLOW_VERSION_POSTGRESQL_ARM64: '1' # increment to invalidate the arm64 cache PKGCONFIGLITE_VERSION: '0.28-1' WINFLEXBISON_VERSION: '2.5.24' @@ -398,10 +395,11 @@ jobs: if-no-files-found: error # ===================================================================== - # Build PostgreSQL arm64 (full, from source) for Windows on Arm + # Build PostgreSQL arm64 (libpq only, from source) for Windows on Arm # - # The windows-11-arm image has no prebuilt arm64 OpenSSL/PostgreSQL, so - # OpenSSL and libpq are built from source natively. Only libpq is built: + # The windows-11-arm image has no prebuilt arm64 PostgreSQL, so libpq is + # built from source natively (OpenSSL comes from the slproweb prebuilt + # arm64 installer, same as the x86/x64 jobs). Only libpq is built: # the full server does not build for aarch64 (PostgreSQL's msvc_gendef.pl # rejects the arch when generating postgres.def), and the driver only needs # libpq. The regression test server is a separate x64 EDB install (run under @@ -414,18 +412,18 @@ jobs: steps: - name: Cache libpq arm64 build output uses: actions/cache@v4 - id: cachePostgresArm + id: cachePostgres with: path: C:\postgresql_arm64 - key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_ARM64_TAG}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} + key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} # ----------------------------------------------------------------- # Source code # ----------------------------------------------------------------- - name: Cache PostgreSQL source - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' uses: actions/cache@v4 - id: cachePgSourceArm + id: cachePgSource with: path: postgres # Distinct from the x64 job's pg-source key: that cache contains an @@ -433,7 +431,7 @@ jobs: # a C:-based arm64 reconfigure. key: pg-source-arm64-${{env.POSTGRESQL_SOURCE_TAG}} - name: Get PostgreSQL source - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePgSourceArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePgSource.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: repository: "postgres/postgres.git" @@ -444,109 +442,90 @@ jobs: # Build tools # ----------------------------------------------------------------- - name: Install meson and ninja - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' run: python -m pip install meson ninja - name: Cache winflexbison - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' uses: actions/cache@v4 - id: cacheWinFlexBisonArm + id: cacheWinFlexBison with: path: C:\OTHERBIN\winflexbison key: winflexbison-${{env.WINFLEXBISON_VERSION}} env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 - name: Download winflexbison - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheWinFlexBisonArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true' uses: suisei-cn/actions-download-file@v1.6.0 + id: downloadWinFlexBison with: retry-times: 5 url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-${{env.WINFLEXBISON_VERSION}}.zip filename: win_flex_bison.zip - name: Extract winflexbison - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheWinFlexBisonArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWinFlexBison.outputs.cache-hit != 'true' shell: cmd run: | mkdir "C:\OTHERBIN\winflexbison" 7z x win_flex_bison.zip -o"C:\OTHERBIN\winflexbison" - name: Add winflexbison to PATH - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' shell: cmd run: printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH% - name: Cache pkgconfiglite - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' uses: actions/cache@v4 - id: cachePkgConfigLiteArm + id: cachePkgConfigLite with: path: C:\OTHERBIN\pkgconfiglite key: pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}-win32 env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 - name: Download pkgconfiglite - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePkgConfigLiteArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true' uses: suisei-cn/actions-download-file@v1.6.0 + id: downloadPkgConfigLite with: retry-times: 5 url: http://downloads.sourceforge.net/project/pkgconfiglite/${{env.PKGCONFIGLITE_VERSION}}/pkg-config-lite-${{env.PKGCONFIGLITE_VERSION}}_bin-win32.zip filename: pkg-config-lite_bin-win32.zip - name: Extract pkgconfiglite - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cachePkgConfigLiteArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cachePkgConfigLite.outputs.cache-hit != 'true' shell: cmd run: | mkdir "C:\OTHERBIN\pkgconfiglite" 7z x pkg-config-lite_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite" - name: Add pkgconfiglite to PATH - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' shell: cmd run: printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-%PKGCONFIGLITE_VERSION%\\bin" >> %GITHUB_PATH% # ----------------------------------------------------------------- - # Native arm64 MSVC toolchain + # OpenSSL arm64 (prebuilt slproweb installer; required for release + # installers). Mirrors the x86/x64 jobs: download the silent Inno + # Setup installer and install it. Cached so a libpq-cache miss does + # not force a re-download. # ----------------------------------------------------------------- - - name: Setup MSVC arm64 - if: steps.cachePostgresArm.outputs.cache-hit != 'true' - uses: TheMrMilchmann/setup-msvc-dev@v3 - with: - arch: arm64 - - # ----------------------------------------------------------------- - # OpenSSL arm64 (built from source; required for release installers). - # Uses the runner's Strawberry Perl + the arm64 MSVC toolset. - # - # OpenSSL has its own cache (keyed by the OpenSSL tag) and is saved - # immediately after it builds, so it survives failures in later steps - # and libpq-cache misses -- avoiding a ~9 min recompile on every - # iteration. On a hit, the compile below is skipped. - # ----------------------------------------------------------------- - - name: Restore OpenSSL arm64 from cache - if: steps.cachePostgresArm.outputs.cache-hit != 'true' - id: cacheOpenSSLArm - uses: actions/cache/restore@v4 + - name: Cache Win64ARM OpenSSL + if: steps.cachePostgres.outputs.cache-hit != 'true' + uses: actions/cache@v4 + id: cacheWin64ARMOpenSSL with: path: C:\OTHERBIN\openssl_arm64 - key: openssl-arm64-${{env.OPENSSL_ARM64_TAG}} - - name: Get OpenSSL source - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' - uses: actions/checkout@v4 + key: Win64ARMOpenSSL-${{env.OPENSSL_VERSION}} + - name: Download Win64ARM OpenSSL + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64ARMOpenSSL.outputs.cache-hit != 'true' + uses: suisei-cn/actions-download-file@v1.6.0 + id: downloadWin64ARMOpenSSL with: - repository: "openssl/openssl" - ref: ${{env.OPENSSL_ARM64_TAG}} - path: openssl - - name: Build and install OpenSSL arm64 - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' - working-directory: openssl + retry-times: 5 + url: https://slproweb.com/download/Win64ARMOpenSSL-${{env.OPENSSL_VERSION}}.exe + filename: Win64ARMOpenSSL.exe + - name: Install Win64ARM OpenSSL + if: steps.cachePostgres.outputs.cache-hit != 'true' && steps.cacheWin64ARMOpenSSL.outputs.cache-hit != 'true' shell: cmd - run: | - perl Configure VC-WIN64-ARM no-tests --prefix=c:\OTHERBIN\openssl_arm64 --openssldir=c:\OTHERBIN\openssl_arm64\ssl - nmake - nmake install_sw - - name: Save OpenSSL arm64 to cache - if: steps.cachePostgresArm.outputs.cache-hit != 'true' && steps.cacheOpenSSLArm.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: C:\OTHERBIN\openssl_arm64 - key: openssl-arm64-${{env.OPENSSL_ARM64_TAG}} + run: Win64ARMOpenSSL.exe /sp /silent /dir=c:\OTHERBIN\openssl_arm64 # ----------------------------------------------------------------- # Build libpq arm64 only (with SSL). @@ -556,23 +535,28 @@ jobs: # x86 libpq-only build in the x64 job. A minimal libpq SDK (lib + dll + # the client headers psqlodbc needs) is assembled under C:\postgresql_arm64. # ----------------------------------------------------------------- + - name: Setup MSVC arm64 + if: steps.cachePostgres.outputs.cache-hit != 'true' + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: arm64 - name: Build libpq arm64 - if: steps.cachePostgresArm.outputs.cache-hit != 'true' + if: steps.cachePostgres.outputs.cache-hit != 'true' working-directory: postgres shell: pwsh run: | # Always configure a clean arm64 build dir (never reuse a stale or # cross-arch meson configuration). if (Test-Path build) { Remove-Item -Recurse -Force build } - meson setup build -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl_arm64\lib -Dextra_include_dirs=c:\OTHERBIN\openssl_arm64\include --prefix=C:\postgresql_arm64 + meson setup build -Dssl=openssl -Dextra_lib_dirs=c:\OTHERBIN\openssl_arm64\lib\VC\arm64\MT -Dextra_include_dirs=c:\OTHERBIN\openssl_arm64\include --prefix=C:\postgresql_arm64 # Build only the libpq client library (and its dependencies). meson compile -C build src/interfaces/libpq/libpq:shared_library # Assemble a minimal libpq SDK layout at C:\postgresql_arm64. New-Item -ItemType Directory -Force -Path C:\postgresql_arm64\lib, C:\postgresql_arm64\bin, C:\postgresql_arm64\include | Out-Null - Get-ChildItem build -Recurse -Filter libpq.lib | Select-Object -First 1 | Copy-Item -Destination C:\postgresql_arm64\lib\ - Get-ChildItem build -Recurse -Filter libpq.dll | Select-Object -First 1 | Copy-Item -Destination C:\postgresql_arm64\bin\ + Get-ChildItem build -Recurse -Filter "libpq.lib" | Copy-Item -Destination C:\postgresql_arm64\lib\ + Get-ChildItem build -Recurse -Filter "libpq.dll" | Copy-Item -Destination C:\postgresql_arm64\bin\ # Headers: reproduce a PostgreSQL install-style include layout so the # driver builds. psqlodbc includes , "pqexpbuffer.h" and @@ -591,7 +575,8 @@ jobs: Copy-Item -Recurse -Force "$gen\*" "$inc\server" # OpenSSL runtime DLLs alongside libpq (needed at load time and by the installer). - Copy-Item c:\OTHERBIN\openssl_arm64\bin\*.dll C:\postgresql_arm64\bin\ + # The slproweb installer places the DLLs at the install root (like x86/x64). + Copy-Item c:\OTHERBIN\openssl_arm64\*.dll C:\postgresql_arm64\bin\ # ===================================================================== # Build and test psqlodbc arm64 (standard and mimalloc, in parallel) @@ -617,7 +602,7 @@ jobs: uses: actions/cache/restore@v4 with: path: C:\postgresql_arm64 - key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_ARM64_TAG}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} + key: postgresql-arm64-${{env.POSTGRESQL_SOURCE_TAG}}_openssl-${{env.OPENSSL_VERSION}}_pkgconfiglite-${{env.PKGCONFIGLITE_VERSION}}_winflexbison-${{env.WINFLEXBISON_VERSION}}_workflow-${{env.WORKFLOW_VERSION_POSTGRESQL_ARM64}} fail-on-cache-miss: true # -----------------------------------------------------------------