Skip to content

Unable to pick up correct include paths on MinGW #49

@LordAro

Description

@LordAro

I've been on a bit of a journey today trying to get XML::LibXML to build for Windows perl on a UCRT64 (MSYS2 subsystem). It's proving quite difficult.

The core of the issue is that Alien::LibXML2 is unable to find the existing libxml install so the -I/ucrt64/include/libxml paths passed to gcc don't work (because it has no idea what to do with them). I've spent quite a lot of time (and debug prints) working out why this is. This is quite similar to a number of issues

The alienfile defines several probe methods:

  • vcpkg - not installed, not used
  • xml2-config - this doesn't work because it's a shell script, so calling via system on Windows doesn't find anything even though the directory is on the PATH. Not sure if there's a way of calling via the MSYS-bash shell, but it'd probably have to be explicitly listed (sh -c 'xml2config...')
  • pkgconfig - main one I've focused on, see below
  • Probe::CBuilder - try_flags only lists Linux paths, never going to work

By default, the Alien::Build::Plugin::PkgConfig module uses the PP submodule, which looks at the PkgConfig library. As the libxml-2.0.pc file specifies prefix=/ucrt64, this results in the same incorrect path. I've left a comment on PerlPkgConfig/perl-PkgConfig#27 which mentions this

It should be noted at this point that actual pkg-config works fine, as it has an implicit --define-path which does path rewriting into the Windows path. Which leads into the CommandLine submodule, which does call the actual pkg-config, ...but doesn't work as it explicitly calls pkg-config with --dont-define-path when $meta->prop->{platform}->{system_type} eq 'windows-mingw' for whatever reason and can't be disabled. Sigh.

The only remaining option is PkgConfig::LibPkgConf which isn't a listed dependency and isn't installed, so I've not tested it (yet?)

I'm not sure if this is just "Alien::Build's issue to fix" or elsewhere, or if there's some other workaround possible, or if the alienfile should "try harder" to find the xml library, but I just thought I'd write it down and I'm all ears if there's some other workaround I've missed. I'm trying to install in an automated script with cpanm XML::LibXML so while modifying the Makefile.PL or other sources I guess are possible, it's not ideal...

(oh, and setting ALIEN_INSTALL_TYPE=share results in a Mozilla::CA module not found error for some reason?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions