Skip to content

Conversation

@IIFE
Copy link
Contributor

@IIFE IIFE commented May 25, 2025

Hi.

This is to address building binaries and LIBs on Windows. The PR is mainly for consideration purposes, as it's my first PR against this repo so not necessarily a complete one. Following are the changes I needed to make:

  • Disable ASAN/UBSAN builds configs as they require GCC/Clang, and on Windows we're building with MSVC.
  • An environment variable to vcpkg root is expected so that third party packages (sqlite, postgres etc) can be installed and found via vcpkg.
  • Disable some warnings for testing code that are safe to ignore for MSVC builds.
  • Ensure the generated binaries have file level details (Details tab on the file properties in Windows) for the version. This is required by Windows MSIs that may be used to install the adbc DLLs in order to detect if the DLL being installed is a newer or older version.
  • Generate import LIB file for drivers built with go build, which includes flight SQL and Snowflake drivers. This allows the testing projects referencing those DLLs to built on Windows.
  • The GoUtils.cmake is not automatically copying the driver DLLs to the location of the test executables, causing the tests for those drivers to fail. Added a post build command to ensure the DLLs are copied.
  • Fix some type casting mismatch (casting between size_t and int).
  • Fix warnings where a variable is hiding a previous one with the same name. Appended 2 to the second variable name.

What I haven't done is update the GitHub actions to verify a complete build on a Windows machine as I'm not too familiar with the CI/CD pipeline in this repo.

Hopefully this is a good start to get everything building successfully and Windows.

Closes #2846

@IIFE IIFE requested a review from lidavidm as a code owner May 25, 2025 21:36
@github-actions github-actions bot added this to the ADBC Libraries 19 milestone May 25, 2025
@IIFE IIFE changed the title Generate versioned DLLs and import LIBs when building with MSVC fix(c): Generate versioned DLLs and import LIBs when building with MSVC May 25, 2025
@lidavidm
Copy link
Member

Thanks for figuring this out. Overall this looks reasonable. If you don't mind I can attempt to push a Windows pipeline to this PR so we can test it.

@IIFE
Copy link
Contributor Author

IIFE commented May 26, 2025

Thanks for figuring this out. Overall this looks reasonable. If you don't mind I can attempt to push a Windows pipeline to this PR so we can test it.

Yes please @lidavidm that would be helpful.

@lidavidm
Copy link
Member

Got it - I'll try to get to it soon

@IIFE
Copy link
Contributor Author

IIFE commented May 27, 2025

pre-commit issues addressed

@Kakolukia91
Copy link

Hmm not sure why the pre-commit is still failing. Is it because I've run mine on a Windows machine so it's not capturing everything the CI does (which runs on Ubuntu from the looks of it)? 🤔

@lidavidm
Copy link
Member

How are you running it?

@IIFE
Copy link
Contributor Author

IIFE commented May 27, 2025

Using this command:
pre-commit run --show-diff-on-failure --color=always --all-files

@lidavidm
Copy link
Member

I don't see a problem. I guess it could be Windows.

@lidavidm lidavidm requested a review from zeroshade as a code owner May 30, 2025 05:16
@amoeba
Copy link
Member

amoeba commented Dec 21, 2025

Hi @IIFE! I'd like to give @lidavidm or @kou a chance to review before merge.

Re: packaging, maybe you could file a new issue describing the packaging changes as a next step.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have some questions but they aren't blockers.

DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# If we're building on Windows using vcpkg, ensure the runtime dependencies of binaries are copied to the install folder.
if(ADBC_BUILD_VCPKG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this automatically be detected somehow? e.g. by checking CMake's platform property and something the vcpkg-cmake integration sets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm had a quick look but can't see a better way at the moment. The problem is that runtime dependencies copying doesn't work for other builds like python/conda etc. Maybe we can spend more time investigating in a separate PR if that's OK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

id: winlibs-version
shell: pwsh
run: |
$winlibs_asset_name = "winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-13.0.0-r4.7z"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this has to be updated periodically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We can always get the latest, but I think it's safer pinning the version and updating manually.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

IIFE and others added 14 commits December 22, 2025 15:11
Co-authored-by: David Li <li.davidm96@gmail.com>
Co-authored-by: David Li <li.davidm96@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@IIFE
Copy link
Contributor Author

IIFE commented Dec 22, 2025

Thanks for the comments @lidavidm @kou - Think I've addressed all comments now.

@lidavidm
Copy link
Member

I'll take one last look but also I wanna make sure we file any follow up issues that were mentioned here 😅

Thanks again for figuring out all of this!

IIFE and others added 2 commits December 23, 2025 14:26
Removed Windows configuration handling for test binaries.
Co-authored-by: David Li <li.davidm96@gmail.com>
@IIFE
Copy link
Contributor Author

IIFE commented Dec 23, 2025

I'll take one last look but also I wanna make sure we file any follow up issues that were mentioned here 😅

Thanks again for figuring out all of this!

Thanks @lidavidm, I see you've created the relevant issues.

Regarding packaging the debug and release binaries, do you have anything specific in mind, as I'm not sure what the packaging patterns are in this rep. We can update the vcpkg job to upload the artifacts, but not sure how these will make it to the tagged release as assets. Thanks

@lidavidm
Copy link
Member

We don't actually ship Windows packages, only wheels. (We do ship packages for some Linux distros, but not macOS either.) So I'm not sure there's too much to do here in terms of packaging.

@lidavidm lidavidm merged commit 22b954d into apache:main Dec 26, 2025
78 of 79 checks passed
@amoeba
Copy link
Member

amoeba commented Dec 26, 2025

Thanks for all your work on this PR, @IIFE, especially picking it back up and responding to the final round of reviews here. Thanks for the reviews too @lidavidm and @kou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Building ADBC and flightsql driver on Windows

5 participants