I was noticing that relocate() was failing to produce a sensible answer on
MSYS2's mingw64 for library paths (relocatable-lib-lgpl).

On investigation, compute_curr_prefix was returning NULL, because
orig_installprefix was /mingw64, while orig_installdir was
C:/msys64/ming64/bin: that is, the former was not a prefix of the latter as
expected.

orig_installprefix is set to INSTALLPREFIX
orig_installdir is set to INSTALLDIR

If in the Makefile I add a rule to print these two variables:

foo:
        echo $(INSTALLPREFIX) $(INSTALLDIR)

I get:

/mingw64 /mingw64/bin

as you might hope. Note: INSTALLDIR is set from bindir, while INSTALLPREFIX
is set in config.h.

The problem appears to be that INSTALLDIR is passed to the compiler on the
command line, and something in the mingw64 machinery says "aha! it's a
path!" and transforms it to Windows style.

Meanwhile, INSTALLPREFIX is set in config.h, so does not undergo the
transformation.

As a result, the two paths end up in different forms, and relocate cannot
do its job.

There are various options to fix this, but they seem to boil down to either
setting INSTALLDIR in such a way that it is not transformed (preferable!),
or by setting INSTALLPREFIX in such a way that it *is* transformed.

I tried setting "MSYS_NO_PATHCONV=1", but this caused the compilation of
relocatable.c to hang!

In the end my workaround was to use this way to set INSTALLDIR in the
Makefile.am for gnulib:

AM_CPPFLAGS += -DINSTALLDIR=BINDIR -include configmake.h

Since I am using configmake anyway, this means I can get the right setting
without exposing it to Mingw's command-line (or environment variable)
transformation.

I don't know if there's anything to be done here, beyond perhaps warn about
it?


-- 
https://rrt.sc3d.org

Reply via email to