Linuxbrew-core: Warning: perl formula fails to find xlocale.h during post_install

Created on 9 Aug 2020  ·  13Comments  ·  Source: Homebrew/linuxbrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [ y] ran brew update and can still reproduce the problem?
  • [ y] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ y] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
    ubuntu server on Linode
    ubuntu desktop in a VirtualBox VM

  • [N/A ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

I was trying to install perl. (Ultimately, I want to install pyenv, but perl is a prerequisite).

What happened (include command output)

perl formula failed during "post_install.01.cpan:"

Command output is below in details.


Command output

~$ brew update
Already up-to-date.
~$ brew update
Already up-to-date.
~$ brew doctor
Your system is ready to brew.
~$ brew install perl
==> Downloading https://linuxbrew.bintray.com/bottles/libbsd-0.10.0.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/68/68ac94cf2b7530dcb4b678402d37d7fce907cd628821d5b7549b644146947951?__gda__=exp=1596941315~hmac=87f96a10ced7f4aaf225

################################################################## 100.0%

==> Downloading https://linuxbrew.bintray.com/bottles/expat-2.2.9.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5d/5d0281695b1febb80cb2dc3c64d61e586ebe1870202d4f763650ab127d2b9f01?__gda__=exp=1596941316~hmac=42cfbace0fe791198448

################################################################## 100.0%

==> Downloading https://linuxbrew.bintray.com/bottles/gdbm-1.18.1_1.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/dd/dd00a26fa20413f81477af032587de19bb620eef352a6d8dd3d9c3a176f6bd5a?__gda__=exp=1596941316~hmac=5619edbad13fd97121a7

################################################################## 100.0%

==> Downloading https://linuxbrew.bintray.com/bottles/openssl%401.1-1.1.1g.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/64/6487415cb2902e5837927427a6b93a579bf5481652e526422d73f687bef41d3e?__gda__=exp=1596941317~hmac=15b09b37fe841f3873d4

################################################################## 100.0%

==> Downloading https://linuxbrew.bintray.com/bottles/berkeley-db-18.1.32_1.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/a6/a61c738d8e2597fe1e662c1eda22005d1c846b2dee3516c89506c16d09fd0012?__gda__=exp=1596941317~hmac=2bf5b876aff033146044

################################################################## 100.0%

==> Downloading https://linuxbrew.bintray.com/bottles/perl-5.32.0.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/82/82ccac650bfefacad6b1ce088d3b612c16ae3677cb0d3c3ea52a2d4f786a1cd8?__gda__=exp=1596941318~hmac=7b6379afdf2067f6b09d

################################################################## 100.0%

==> Installing dependencies for perl: libbsd, expat, gdbm, [email protected] and berkeley-db
==> Installing perl dependency: libbsd
==> Pouring libbsd-0.10.0.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/libbsd/0.10.0: 261 files, 961.2KB
==> Installing perl dependency: expat
==> Pouring expat-2.2.9.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/expat/2.2.9: 18 files, 757.3KB
==> Installing perl dependency: gdbm
==> Pouring gdbm-1.18.1_1.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/gdbm/1.18.1_1: 40 files, 1MB
==> Installing perl dependency: [email protected]
==> Pouring [email protected]_64_linux.bottle.tar.gz
==> Downloading https://curl.haxx.se/ca/cacert-2020-01-01.pem

################################################################## 100.0%

==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/home/linuxbrew/.linuxbrew/etc/[email protected]/certs

and run
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/c_rehash
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/1.1.1g: 8,060 files, 21.4MB
==> Installing perl dependency: berkeley-db
==> Pouring berkeley-db-18.1.32_1.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/berkeley-db/18.1.32_1: 5,673 files, 128.3MB
==> Installing perl
==> Pouring perl-5.32.0.x86_64_linux.bottle.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/cpan -i XML::Parser
Last 15 lines from /home/mln02/.cache/Homebrew/Logs/perl/post_install.01.cpan:
chmod 644 "Expat.bs"
"/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs 644
"/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/perl" "/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/ExtUtils/xsubpp" -noprototypes -typemap '/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/ExtUtils/typemap' -typemap '/home/mln02/.cpan/build/XML-Parser-2.46-0/Expat/typemap' Expat.xs > Expat.xsc
mv Expat.xsc Expat.c
cc -c -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/home/linuxbrew/.linuxbrew/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.46\" -DXS_VERSION=\"2.46\" -fPIC "-I/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE" Expat.c
In file included from Expat.xs:15:
/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE/perl.h:861:13: fatal error: xlocale.h: No such file or directory
861 | # include
| ^~~
compilation terminated.
make[1]: * [Makefile:321: Expat.o] Error 1
make[1]: Leaving directory '/home/mln02/.cpan/build/XML-Parser-2.46-0/Expat'
make: *
[Makefile:540: subdirs] Error 2
TODDR/XML-Parser-2.46.tar.gz
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/make -- NOT OK
Warning: The post-install step did not complete successfully
You can try again using brew postinstall perl
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using local::lib.

You can set that up like this:
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.profile
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0: 2,669 files, 73.0MB
==> Caveats
==> [email protected]
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/home/linuxbrew/.linuxbrew/etc/[email protected]/certs

and run
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/c_rehash
==> perl
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using local::lib.

You can set that up like this:
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.profile

Since it's a warning, it appears to have installed, so I try a reinstall.

~$ brew install perl
Warning: perl 5.32.0 is already installed and up-to-date
To reinstall 5.32.0, run brew reinstall perl
mln02@localhost:~$ brew reinstall perl
==> Downloading https://linuxbrew.bintray.com/bottles/perl-5.32.0.x86_64_linux.bottle.tar.gz
Already downloaded: /home/mln02/.cache/Homebrew/downloads/6b76ba66192a64f545283afed14b01bca1fa9c071c0a88a909108c5142a25f2d--perl-5.32.0.x86_64_linux.bottle.tar.gz
==> Reinstalling perl
==> Pouring perl-5.32.0.x86_64_linux.bottle.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/cpan -i XML::Parser
Last 15 lines from /home/mln02/.cache/Homebrew/Logs/perl/post_install.01.cpan:
chmod 644 "Expat.bs"
"/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs 644
"/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/bin/perl" "/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/ExtUtils/xsubpp" -noprototypes -typemap '/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/ExtUtils/typemap' -typemap '/home/mln02/.cpan/build/XML-Parser-2.46-1/Expat/typemap' Expat.xs > Expat.xsc
mv Expat.xsc Expat.c
cc -c -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/home/linuxbrew/.linuxbrew/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.46\" -DXS_VERSION=\"2.46\" -fPIC "-I/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE" Expat.c
In file included from Expat.xs:15:
/home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE/perl.h:861:13: fatal error: xlocale.h: No such file or directory
861 | # include
| ^~~
compilation terminated.
make[1]: * [Makefile:321: Expat.o] Error 1
make[1]: Leaving directory '/home/mln02/.cpan/build/XML-Parser-2.46-1/Expat'
make: *
[Makefile:540: subdirs] Error 2
TODDR/XML-Parser-2.46.tar.gz
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/make -- NOT OK
Warning: The post-install step did not complete successfully
You can try again using brew postinstall perl
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using local::lib.

You can set that up like this:
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.profile
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0: 2,669 files, 73.0MB


What you expected to happen

I expected perl to install without warnings or error.

Step-by-step reproduction instructions (by running brew install commands)

brew install perl
or
brew reinstall perl
or
brew postinstall perl

outdated stale

Most helpful comment

Yes, this is the issue.

And this makes perl not portable at all: our perl bottle is built on Ubuntu 16.04, with glibc 2.23. So perl.h in the bottle will contain "xlocale.h". If you now try to use that perl on Ubuntu 18.04, which has glibc 2.27, it will fail because xlocale.h does not exist for that version (the xlocale.h removal was done in glibc 2.26).

I think we should revert https://github.com/Homebrew/linuxbrew-core/pull/20811, and make the replacement conditional based on the glibc version.

Once we build on Ubuntu 18.04 (maybe next year when we migrate stuff), we will be able to remove that patch as it will not be necessary anymore.

All 13 comments

FWIW the dirty workaround is sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
but a proper fix should probably be running a sed "s/xlocale.h/locale.h/" over the respective file /home/linuxbrew/.linuxbrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/x86_64-linux-thread-multi/CORE/perl.h

We had a patch in place which I removed lately, because it broke on our CI: #20811
It would be great if we could find something which works for everyone and is portable.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@iMichka do you have more context to the exact failure? which OS? what was the error message?

because I tried on my usual suspects: ubuntu 16.04/18.04/20.04, and all is good with the inreplace patch.

And I tried finding the failing CI job, but couldn't.

@stephengroat correct me if I'm wrong but I believe that's the failure that @mikeneumann reported above, which I'm experiencing as well, AFTER @iMichka's fix. I'm interested in details as to what error was experienced BEFORE @iMichka's fix.

So, the fix that was in place since some time was to replace "include <xlocale.h>" by "include <locale.h>" in perl.h".

But at one point that failed too, as there was no "include <xlocale.h>" in that file anymore, so I remove that replacement. That was my second fix.

But it looks like for some people "include <xlocale.h>" is still there, which breaks it again for those.

Got it!
I guess the root cause is best described here
https://bugzilla.redhat.com/show_bug.cgi?id=1464244
with people on 3 different setups - old without xlocale.h but not locale.h,
new with locale.h AND a 3rd one: new with locale.h but with a broken glibc
that makes perl revert to looking for xlocale.h

From the look of it, it is the right thing not to have any monkeypatching
in place.

On Tue, Sep 8, 2020 at 11:41 PM Michka Popoff notifications@github.com
wrote:

So, the fix that was in place since some time was to replace "include
" by "include " in perl.h".

But at one point that failed too, as there was no "include "
in that file anymore, so I remove that replacement. That was my second fix.

But it looks like for some people "include " is still there,
which breaks it again for those.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Homebrew/linuxbrew-core/issues/20914#issuecomment-689151348,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAFM4QPLDGVZFYOVUZW52GDSE2QJJANCNFSM4PY7A3JQ
.

--
andreineculau.com http://www.andreineculau.com

Yes, this is the issue.

And this makes perl not portable at all: our perl bottle is built on Ubuntu 16.04, with glibc 2.23. So perl.h in the bottle will contain "xlocale.h". If you now try to use that perl on Ubuntu 18.04, which has glibc 2.27, it will fail because xlocale.h does not exist for that version (the xlocale.h removal was done in glibc 2.26).

I think we should revert https://github.com/Homebrew/linuxbrew-core/pull/20811, and make the replacement conditional based on the glibc version.

Once we build on Ubuntu 18.04 (maybe next year when we migrate stuff), we will be able to remove that patch as it will not be necessary anymore.

Despite your clear explanation @iMichka, wouldn't this still work as fallback for Ubuntu 18.04? Or would it simply break downstream anyway? As it wouldn't touch xlocale.h if it already exists, it should be a safe operation right?

https://github.com/Homebrew/linuxbrew-core/pull/21097

What would be the tradeoff of not having a linux bottle for perl at all? As installing from source solves the issue as well afaik.

I opened another PR to fix this: #21111

By the way: building perl from source is too slow and we would like to avoid that.

Was this page helpful?
0 / 5 - 0 ratings