Skip to content

[GLib] Add support for MSVC with vcpkg #41134

Closed

Description

@kou

Describe the enhancement requested

I tried this before but I couldn't complete this because GLib in vcpkg was old.
See also: #6252 (comment)

It seems that we can try again this because vcpkg has gobject-introspection port https://github.com/microsoft/vcpkg/tree/master/ports/gobject-introspection now.

Component(s)

GLib

Activity

  1. adamreeve commented on May 7, 2024

    @adamreeve
    Contributor

    I had a look into this and from what I can tell, gobject-introspection is only needed if building the Vala bindings, which I didn't test, but the GLib in vcpkg seems to work. There are some minor code changes needed to get the c_glib code compiling with MSVC, but the big problem I ran into is that MSVC does not export any symbols by default, so the dll fails to build. The problem is the same as what was reported in mesonbuild/meson#8716.

    There's a Meson issue for allowing all symbols to be exported (mesonbuild/meson#2132) and this functionality exists in CMake, but unless that is added it looks like we either need to create a .def file with all of the symbols to export, or add __declspec(dllexport)/__declspec(dllimport) attributes to all of the methods that need to be exported. It seems like extending the GARROW_AVAILABLE_IN_* macros to add these might make sense, although there is also a need to add these attributes to some of the methods in the .hpp header files too, which aren't part of the GLib APIs but are used for sharing code across the different GLib library implementations.

    I have managed to build the arrow-glib library with MSVC and get the tests from #37544 passing with some hackily put together changes (main...adamreeve:arrow:windows_glib). If this general approach looks reasonable I could tidy this up and make a PR?

  2. kou commented on May 7, 2024

    @kou
    MemberAuthor

    Thanks! Could you open a PR?

  3. added 2 commits that reference this issue on May 22, 2024
  4. kou commented on May 24, 2024

    @kou
    MemberAuthor

    Issue resolved by pull request 41599
    #41599

  5. added this to the 17.0.0 milestone on May 24, 2024
  6. added 2 commits that reference this issue on May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions