Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building Perl on SLES15 fails because -ltermcap is not found #17373

Closed
hattom opened this issue Feb 20, 2023 · 7 comments · Fixed by #21469
Closed

Building Perl on SLES15 fails because -ltermcap is not found #17373

hattom opened this issue Feb 20, 2023 · 7 comments · Fixed by #21469

Comments

@hattom
Copy link
Contributor

hattom commented Feb 20, 2023

I usually have problems when building perl extensions on SLES15 -- I can't remember if there's an issue open, but I don't find one right now.

The problem is in Term::ReadLine::Gnu, and -ltermcap.
IIRC, I had a similar error with ncurses before on SLES15.

== installing extension Term::ReadLine::Gnu 1.42 (313/381)...
== ... (took 10 mins 24 secs)
== FAILED: Installation ended unsuccessfully (build directory: /tmp/thay/eb/Perl/5.36.0/GCCcore-12.2.0): build failed (first 300 chars): cmd " perl Makefile.PL PREFIX=/tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0 " exited with exit code 1 and output:
readdir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 22.
closedir() attempted on  (took 18 mins 37 secs)
== Results of the build can be found in the log file(s) /tmp/eb-e29gr9sa/easybuild-Perl-5.36.0-20230220.174059.Rbmgb.log
ERROR: Build of /tokp/scratch/thay/eb/software/EasyBuild/4.7.0/easybuild/easyconfigs/p/Perl/Perl-5.36.0-GCCcore-12.2.0.eb failed (err: 'build failed (first 300 chars): cmd " perl Makefile.PL PREFIX=/tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0 " exited with exit code 1 and output:\nreaddir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 22.\nclosedir() attempted on ')
== 2023-02-20 17:59:35,966 run.py:236 INFO running cmd: tar xzf /tokp/work/thay/eb/sources/p/Perl/extensions/Term-ReadLine-Gnu-1.42.tar.gz 
== 2023-02-20 17:59:36,014 run.py:236 INFO running cmd:  perl Makefile.PL PREFIX=/tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0  
== 2023-02-20 17:59:36,798 build_log.py:171 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:126 in __init__): cmd " perl Makefile.PL PREFIX=/tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0 " exited with exit code 1 and output:
readdir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 22.
closedir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 23.
readdir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 22.
closedir() attempted on invalid dirhandle $dir_fh at /tokp/work/thay/eb/software/Perl/5.36.0-GCCcore-12.2.0/lib/perl5/5.36.0/ExtUtils/Liblist.pm line 23.
/tokp/work/thay/eb/software/binutils/2.39-GCCcore-12.2.0/bin/ld: cannot find -ltermcap: No such file or directory
collect2: error: ld returned 1 exit status
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Could not compile rlver.c.

system(): No such file or directory

If you have installed the GNU Readline Library (libreadline.{a,so} and
readline/readline.h, etc.) on directories for which your perl is not
configured to search (refer the value of `ccflags' and `libpath' in
the output of `perl -V'), specify the paths as follows;

        perl Makefile.PL --includedir=/yourdir/include --libdir=/yourdir/lib
or
        perl Makefile.PL --prefix=/yourdir

Note that the GNU Readline Library version 2.0 and earlier causes error
here.  Update it to version 2.1 and/or later.

Read INSTALL for more details.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 (at easybuild/tools/run.py:643 in parse_cmd_output)
@hattom
Copy link
Contributor Author

hattom commented Feb 20, 2023

Looks like indeed a duplicate? -- I had the wrong search term.

#17201
#16014

@hattom hattom closed this as completed Feb 20, 2023
@hattom
Copy link
Contributor Author

hattom commented Feb 22, 2023

Maybe I'm just stupid, but I'm not actually sure that those duplicates solve this problem.

@hattom hattom reopened this Feb 22, 2023
@jscook2345
Copy link

I'm also hitting this problem.

In the easybuilder's slack, the following workaround was offered:

eb --skip-extensions Perl-5.36.0-GCCcore-12.2.0.eb

I looked it over and it seems like the perl module requires additional directories added that look for the stack's libraries rather than only the system ones.

Perhaps this is because I'm building everything from scratch and I don't have modules loaded for anything else?

I'd be happy to help provide a fix given a few hints on where to look. I couldn't find any similar examples.

@hattom
Copy link
Contributor Author

hattom commented Feb 28, 2023

Of possible use.

thay@toki04:~> rpm -qa --last | grep -i termc
termcap-2.0.8-150400.1037.4.x86_64            Mon 27 Feb 2023 09:25:32 AM CET
thay@toki04:~> rpm -ql termcap-2.0.8-150400.1037.4.x86_64
/usr/include/curses
/usr/include/curses/curses.h
/usr/include/termcap
/usr/include/termcap/termcap.h
/usr/lib64/curses
/usr/lib64/curses/libcurses.a
/usr/lib64/curses/libcurses.so
/usr/lib64/libcurses.so.1
/usr/lib64/libcurses.so.1.0.0
/usr/lib64/libtermcap.so.2
/usr/lib64/libtermcap.so.2.0.8
/usr/lib64/termcap
/usr/lib64/termcap/libtermcap.a
/usr/lib64/termcap/libtermcap.so

@hattom
Copy link
Contributor Author

hattom commented Apr 11, 2023

I tried also a hook:

def parse_hook(ec, *args, **kwargs):
    """Alter the parameters of easyconfigs"""
    if ec.name == 'Perl':
        # remove extensions
        ec['exts_list'] = []

But it's a bit heavy-handed. Better would probably be to only remove the offending extension.

@hattom
Copy link
Contributor Author

hattom commented Apr 12, 2023

and a less heavy-handed approach:

def parse_hook(ec, *args, **kwargs):
    """Alter the parameters of easyconfigs"""
    if ec.name == 'Perl':
        exclude_list = ["Term::ReadLine::Gnu"]
        ec['exts_list'] = [x for x in ec['exts_list'] if x[0] not in exclude_list]

@boegel
Copy link
Member

boegel commented Sep 23, 2024

I'm hitting the same problem on LUMI (SLES 15).

The problem seems to be that Term::ReadLine::Gnu first considers -ltermcap before it considers -lncurses.
If libtermcap.so is found, then the Makefile.PL script concludes that -ltermcap should be used, but that may be incorrect; see also this fix in Gentoo Prefix.

Considering -ltermcap doesn't make much sense, because it should link to the libncurses.so library provided by the ncurses library.

With that in mind, I'm testing this fix (which should be fine to use also on non-SLES systems):

    ('Term::ReadLine::Gnu', '1.42', {
        'modulename': 'Term::ReadLine',
        'source_tmpl': 'Term-ReadLine-Gnu-%(version)s.tar.gz',
        'source_urls': ['https://cpan.metacpan.org/authors/id/H/HA/HAYASHI'],
        'checksums': ['3c5f1281da2666777af0f34de0289564e6faa823aea54f3945c74c98e95a5e73'],
        'preinstallopts': "sed -s 's/-ltermcap/-lncurses/g' Makefile.PL && ",
    }),

@boegel boegel added this to the release after 4.9.4 milestone Sep 23, 2024
@boegel boegel changed the title Building Perl on SLES15 Building Perl on SLES15 fails because -ltermcap is not found Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants