1

The cpan command enters module exploration and installation mode.
>i/Modulo/ informs the modules and their author in the database.
When I say >i/Curses/ several curses appear but not what I need.
I'm trying to add Curses-1.06 from William Setzer (WPS).
Informing cpan> i /wps/ shows me the author but not its module. AND...
cpan> i /WPS/Curses-1.06/
No objects found of any type for argument /WPS/Curses-1.06
I managed to download by
cpan> install WPS/Curses-1.06.tar.gz
Saving to: '/data/data/com.termux/files/home/.cpan/sources/authors/id/W/WP/WPS/CHECKSUMS.tmp6759' And then fails in perl Makefile.PL guess_cfg...

Configuring W/WP/WPS/Curses-1.06.tar.gz with Makefile.PL
FATAL: internal error: guess_cfg is bad
Warning: No success on
command[/data/data/com.termux/files/usr/bin/perl Makefile.PL]
WPS/Curses-1.06.tar.gz
/data/data/com.termux/files/usr/bin/perl
Makefile.PL -- NOT OK
Failed during this command:
WPS/Curses-1.06.tar.gz
: writemakefile NO '/data/data/com.termux/files/usr/bin/perl Makefile.PL' returned status 65280

I opened the Makefile.PL file and I'm trying to add an Android as I don't see one. And I don't know if I'm doing it right.
SCREENSHOT

Notes for Solaris:
# In 2.3, it was reported that to make the module compile correctly
# with gcc, you must add `-DSYSV=1' to $inc. This will disable the
# reset memcpy to bcopy which is present in /usr/include/curses.h.
# [Courtesy of Dave Blaszyk <dvb@ycc.Kodak.COM>]
#
# $inc also contained "-I/usr/include", but this seems to cause a huge
# too many problems for gcc in perl5.002 so i removed it by default.
# I tested Curses-a9 with perl5.002 and gcc263 and Sun's unbundled
# cc on Solaris 2.4 with $inc empty and no problems, but your
# mileage may vary.
#
# If you are having problems compiling on Solaris, try several
# combinations of "-I/usr/include" and "-DSYSV=1" in $inc to see if
# it fixes things.
Cmistry
  • 173
  • 7
  • 1
    Hi I tried to install termux on my android phone. Then ran `pkg install perl` and then downloaded https://cpan.metacpan.org/authors/id/G/GI/GIRAFFED/Curses-1.44.tar.gz with curl. Then ran `perl Makefile.PL`. But I think it is missing the ncurses c libraries and headers. How did you install those? Here is a screenshot: https://imgur.com/a/Bz8jZVI – Håkon Hægland May 01 '23 at 20:12
  • 1
    *"But I think it is missing the ncurses c libraries and headers. How did you install those?"* I found that you can install those with `pkg install ncurses`. The header files will then end up in `/data/data/com.termux/files/usr/include` and the libraries in `/data/data/com.termux/files/usr/lib` – Håkon Hægland May 01 '23 at 20:58
  • If I export those paths in the previous comment to the environment variables `CURSES_CFLAGS` and `CURSES_LDFLAGS` and rerun `perl Makefile.PL` I get another error: "I'm sorry I couldn't find a hints file that was configured for your OS", see this screenshot: https://imgur.com/a/u3m02gg – Håkon Hægland May 01 '23 at 21:03
  • [screenshot](https://i.imgur.com/US30Jmu.jpg) First open cpan and tried to install giraffes 1.44 but da fuction not enable like yours @HåkonHægland . I inform `perl Makefile.PL` That tells me prerequisites curses-1.06 not found Then I do `cpan>install WPS/Curses-1.06.tar.gz` and I get on installation `FATAL: internal error: guess_cfg.` @ikegami `perl -le'print $^O'` android – Cmistry May 01 '23 at 21:11
  • 1
    @ikegami *"Might suffice to copy c-linux.ncurses.h"* : Indeed! I just did `cd hints; cp c-linux.ncurses.h c-android.h; cd ..; perl Makefile.PL` and it worked, see screenshot: https://imgur.com/a/GnxIJIx – Håkon Hægland May 01 '23 at 21:14
  • 1
    After running `perl Makefile.PL` the next problem is to run `make`, and I needed to install `make` with `pkg install make` first. Then running `make` produced an error due to missing c compiler, see screenshot: https://imgur.com/a/oFG487Z – Håkon Hægland May 01 '23 at 21:18
  • @ikegami because I'm trying to use another Term::Animation module that depends on curses. and when I do cpanm installdeps . it returns failed installing dependencies module curses. And then perl Makefile.PL says prerequisite Curses-1.06 – Cmistry May 01 '23 at 21:23
  • 1
    *"Then running make produced an error due to missing c compiler"* The c compiler can be installed with `pkg install clang`, and then `make` runs successfully – Håkon Hægland May 01 '23 at 21:24

1 Answers1

2

First of all, note that you will need to install the ncurses C library before you can install (any version of) this module since it's merely an interface to that C library.

This can be done as follows:

pkg install ncurses

Secondly, you don't need version 1.06 specifically.

You're trying to install WPS/Curses-1.06.tar.gz. This version dates back to 2001, which is ancient.

Thankfully, you don't need that version specifically. That is the minimum version you need. We will focus on installing the latest version, 1.44.


Finally, time to install the module.

While the installation process has become less platform-dependent since 1.06, there's still some platform-dependent aspects in the installer.

Unfortunately, the latest version at this time does not support termux, but it's not hard to add the support manually.

First, obtain the distribution.

wget https://cpan.metacpan.org/authors/id/G/GI/GIRAFFED/Curses-1.44.tar.gz
tar xzf Curses-1.44.tar.gz
cd Curses-1.44

Secondly, add support for your OS.

cp -i hints/c-linux.ncurses.h hints/c-android.h

Third, we need to tell the installer where to find the ncurses C library since the installer doesn't find them.

export CURSES_CFLAGS="-I/data/data/com.termux/files/usr/include"
export CURSES_LDFLAGS="-L/data/data/com.termux/files/usr/lib -lncurses"

Finally, complete the installation.

perl Makefile.PL && make test && make install
ikegami
  • 367,544
  • 15
  • 269
  • 518