Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Update XML::LibXML - can't find "xlocale.h"

by kcott (Archbishop)
on Jan 01, 2021 at 06:03 UTC ( [id://11126068]=perlquestion: print w/replies, xml ) Need Help??

kcott has asked for the wisdom of the Perl Monks concerning the following question:

G'day All and Happy New Year,

Background: I'm running Cygwin on Win10; Perl (5.32.0) is running on Cygwin using Perlbrew. I've just run a full update of Cygwin: no problems running; required some minor tweaks (e.g. copying a file from 'vim81' to 'vim82') but everything seems to be generally fine. The previous version of Cygwin was 3.0.7; the new version just installed is 3.1.6. I was looking at some Perl modules I had installed, thinking to maybe update them to take advantage of newer library versions; this is where I hit the problem with XML::LibXML.

I currently have:

$ perl -E 'use XML::LibXML; say $XML::LibXML::VERSION' 2.0205

The latest version is 2.0206, so I attempted to update:

cpan[1]> install XML::LibXML Reading '/home/ken/.cpan/Metadata' Database was generated on Fri, 01 Jan 2021 04:29:02 GMT Running install for module 'XML::LibXML' Fetching with LWP: http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0206.tar.gz Fetching with LWP: http://www.cpan.org/authors/id/S/SH/SHLOMIF/CHECKSUMS Checksum for /home/ken/.cpan/sources/authors/id/S/SH/SHLOMIF/XML-LibXM +L-2.0206.tar.gz ok Scanning cache /home/ken/.cpan/build for sizes ...................................................................... +......DONE Configuring S/SH/SHLOMIF/XML-LibXML-2.0206.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for XML::LibXML Writing MYMETA.yml and MYMETA.json SHLOMIF/XML-LibXML-2.0206.tar.gz /home/ken/perl5/perlbrew/perls/perl-5.32.0/bin/perl Makefile.PL -- O +K Running make for S/SH/SHLOMIF/XML-LibXML-2.0206.tar.gz cp lib/XML/LibXML/DocumentFragment.pod blib/lib/XML/LibXML/DocumentFra +gment.pod ... almost a screenful of successful 'cp' comands, then: cp lib/XML/LibXML/Dtd.pod blib/lib/XML/LibXML/Dtd.pod Running Mkbootstrap for LibXML () chmod 644 "LibXML.bs" "/home/ken/perl5/perlbrew/perls/perl-5.32.0/bin/perl.exe" -MExtUtils:: +Command::MM -e 'cp_nonempty' -- LibXML.bs blib/arch/auto/XML/LibXML/L +ibXML.bs 644 gcc -c -I/usr/include/libxml2 -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI_ +_ -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector- +strong -D_FORTIFY_SOURCE=2 -DUSEIMPORTLIB -O3 -DVERSION=\"2.0206\" +-DXS_VERSION=\"2.0206\" "-I/home/ken/perl5/perlbrew/perls/perl-5.32. +0/lib/5.32.0/cygwin-thread-multi/CORE" -DHAVE_UTF8 Av_CharPtrPtr.c In file included from Av_CharPtrPtr.c:7: /home/ken/perl5/perlbrew/perls/perl-5.32.0/lib/5.32.0/cygwin-thread-mu +lti/CORE/perl.h:861:13: fatal error: xlocale.h: No such file or direc +tory 861 | # include <xlocale.h> | ^~~~~~~~~~~ compilation terminated. make: *** [Makefile:438: Av_CharPtrPtr.o] Error 1 SHLOMIF/XML-LibXML-2.0206.tar.gz /usr/bin/make -- NOT OK Failed during this command: SHLOMIF/XML-LibXML-2.0206.tar.gz : make NO

I checked and have a plethora of xlocale.h in various places (see spoiler):

I'm looking for some advice on how to handle this:

  • Reinstall Perl 5.32.0 — as far as I can tell, that's the latest stable release and what I have currently.
  • Copy one of the many xlocale.hs I already have to somewhere (?).
  • Install a new copy of xlocale.h from somewhere (?) to somewhere (?).
  • Do something completely different.

Other Perl programs seem to working fine, including Tk under Cygwin-X. Ask if you'd like additional information. Any help appreciated.

— Ken

Replies are listed 'Best First'.
Re: Update XML::LibXML - can't find "xlocale.h"
by syphilis (Archbishop) on Jan 01, 2021 at 08:55 UTC
    In file included from Av_CharPtrPtr.c:7: /home/ken/perl5/perlbrew/perls/perl-5.32.0/lib/5.32.0/cygwin-thread-mu +lti/CORE/perl.h:861:13: fatal error: xlocale.h: No such file or direc +tory


    Looks like a perlbrew or perl bug to me.
    It's actually /home/ken/perl5/perlbrew/perls/perl-5.32.0/lib/5.32.0/cygwin-thread-multi/CORE/perl.h that's trying to include the non-existent xlocale.h.
    This should mean that you are unable to build any perl extension at all on this build of perl - because every time you try to build such a module, perl.h is going to include a file (xlocale.h) that it can't find.

    You might find that simply creating a file named xlocale.h (that does nothing useful, if anything at all) and placing it in a location where it can be found by default, will fix the problem.

    Dunno ... seems pretty weird ... maybe I'm not diagnosing it correctly ...

    Cheers,
    Rob

      Ah, I obviously did not read the error message close enough. Thanks for pointing out that problem was not in LibXML::XML.

Re: Update XML::LibXML - can't find "xlocale.h" [workaround]
by kcott (Archbishop) on Jan 02, 2021 at 00:55 UTC

    Thanks to all who offered advice (upvotes all round). I took bits of information from various responses; this is a general reply to everyone. I determined a workaround, which I'll document below for anyone encountering the same problem. I suspect an actual solution would be to rebuild Perl and reinstall all modules (a fairly lengthy task which I really don't have time for right now).

    Information regarding the missing xlocale.h: "glibc wiki: Removal of 'xlocale.h'".
    Information about how this affects Perl: "glibc-2.26 removed xlocale.h".
    Based on that information, I edited config.h (which is in the same directory as perl.h in the error message).

    $ ls -al config.h* -r--r--r-- 1 ken None 164422 Jun 23 2020 config.h $ cp config.h config.h-20210102a $ chmod +w config.h $ vi config.h $ chmod -w config.h $ ls -al config.h* -r--r--r-- 1 ken None 164425 Jan 2 10:55 config.h -r--r--r-- 1 ken None 164422 Jan 2 10:51 config.h-20210102a $ diff config.h config.h-20210102a 3096c3096 < /*#define I_XLOCALE / **/ --- > #define I_XLOCALE /**/

    Now back to cpan:

    cpan[1]> install XML::LibXML ... SHLOMIF/XML-LibXML-2.0206.tar.gz /usr/bin/make install -- OK cpan[2]>

    And a very quick confirmation:

    $ perl -E 'use XML::LibXML; say $XML::LibXML::VERSION' 2.0206

    — Ken

Re: Update XML::LibXML - can't find "xlocale.h"
by parv (Parson) on Jan 01, 2021 at 07:49 UTC

    I don't have a solution or workaround.

    As you are compiling C or C++ components, I would avoid any xlocale.h path which is not available on (Cygwin or MinGW) system-wide basis; that includes all the Perl & Wx specific ones.

    Per Cygwin Package search, the file is in "cygwin-devel-3.0.7-1" (your older version) and 3 "libc++-devel" Clang packages (but GCC is being used per your output). Seems like either LibXML::XML has be to be updated for this (possibly things have moved to "locale.h"; in which case replace all "xlocale" with "locale") or downgrade to 3.0.7 Cygwin. :-(

Re: Update XML::LibXML - can't find "xlocale.h" [solution]
by kcott (Archbishop) on Jan 02, 2021 at 07:57 UTC

    As mentioned in the workaround post, "I suspect an actual solution would be to rebuild Perl and reinstall all modules ...". Doing that with 5.32.0 would have been very disruptive to other tasks I'm currently working on; so I decided to install the latest development version, 5.33.5 (https://metacpan.org/pod/release/CORION/perl-5.33.5/pod/perl.pod) — it's got "CORION" plastered all over it, so it has to be good; right? :-)

    Installation worked. I checked for I_XLOCALE in config.h; it was commented out:

    ken@titan ~/perl5/perlbrew/perls/perl-5.33.5/lib/5.33.5/cygwin-thread- +multi/CORE $ grep 'I_XLOCALE' config.h /* I_XLOCALE: /*#define I_XLOCALE / **/

    I've now installed lots of modules — many with XS components, including XML::LibXML — and there's been no recurrence of the earlier problem.

    It would seem this is a solid solution; although, the workaround is still working, and possibly a much faster solution for anyone encountering the same problem with xlocale.h.

    — Ken

      Installation worked. I checked for I_XLOCALE in config.h; it was commented out

      Did you build 5.33.5 in the same way as you had built 5.32.0 ?
      If so, then we can say that the bug has been fixed.
      Otherwise, the jury is still out.

      Cheers,
      Rob
        "Did you build 5.33.5 in the same way as you had built 5.32.0 ?"

        I built 5.33.5 using the basic instructions in Perlbrew:

        perlbrew install perl-5.33.5

        I built 5.32.0 over six months ago. I'm somewhat loathe to say I have perfect recollection; however, I'm almost 100% certain I built that in exactly the same way:

        perlbrew install perl-5.32.0

        I can say that I didn't use any options affecting compilation, such as -D (see "perlbrew: Options for install command" for a full list).

        I can also say that I didn't use any wildly different method, such as downloading a tarball and installing manually.

        All modules were installed in exactly the same way, for both versions, using the cpan utility. Just a very basic:

        $ cpan ... cpan[1]> install Some::Module ... cpan[2]> install Other::Module ...

        — Ken

      "it's got "CORION" plastered all over it, so it has to be good; right? :-)

      He's been helping people here for so very long now, perhaps he's gained the ability of reading Perlmonks questions in advance long before they're posted, so he can fix problems silently before they are run into, saving himself time from having to fix the problems *and* respond.

        Heh, no - a Perl development release is "just" working through the steps of the Release Manager's Guide. There is very little creative input there, just some judgement on how bad errors are (if any). Maybe someday, all these steps will be automated.

        Eventual bug fixes have likely been contributed by somebody other than me to Perl 5.33.x :)

Re: Update XML::LibXML - can't find "xlocale.h"
by Anonymous Monk on Jan 01, 2021 at 08:58 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11126068]
Approved by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found