WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: trouble with ncursesw-dev when compiling for Pure64 11.0-beta  (Read 3888 times)

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« on: January 17, 2020, 11:15:46 AM »
I'm trying to compile lftp 4.9.1 for Pure64 11.x
The source code is here: https://lftp.tech/get.html

All the build dependencies (and then some) are already in the 11.x repository, but I can't make it work:

Code: [Select]
$ tce-load -wi compiletc readline-dev gettext-dev openssl-1.1.1-dev ncursesw-dev libidn2-dev pkg-config zlib_base-dev libtool-dev expat2-dev autoconf automake
$ export CFLAGS="-mtune=generic -Os -pipe -I/usr/local/include/ncursesw"
$ export CXXFLAGS="-mtune=generic -Os -pipe -I/usr/local/include/ncursesw"
$ export CPPFLAGS="-I/usr/local/include/ncursesw"
$ export LDFLAGS="-Wl,-O1"
$ cd lftp-4.9.1
$ ./configure --prefix=/usr/local --without-gnutls --with-openssl=/usr/local/include/openssl
---snip---
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking term.h usability... yes
checking term.h presence... yes
checking for term.h... yes
checking ncurses/curses.h usability... no
checking ncurses/curses.h presence... no
checking for ncurses/curses.h... no
checking ncurses/term.h usability... no
checking ncurses/term.h presence... no
checking for ncurses/term.h... no
checking termcap.h usability... yes
checking termcap.h presence... yes
checking for termcap.h... yes
checking for library containing tigetstr... no
checking for library containing tgetstr... no
configure: error: No terminfo, termcap or curses library found. Install ncurses-devel.
It seems that ncursesw provides the tigetstr and tgetstr functions, so I'm not sure why configure is giving this error.

I'm stuck and going around in circles. Please help if you know what's going on.
« Last Edit: January 17, 2020, 11:18:07 AM by GNUser »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #1 on: January 17, 2020, 11:51:10 AM »
Hi, GNUser!

Sometimes configure don't know, that ncursesw have its own directory "ncursesw" inside /usr/local/include. Making search in "configure" of lftp on the keyword "ncurses" shows, that it expects, that headers are located in "ncurses" directory.
I've not tried, but I think You can  make soft link ncurses->ncursesw in Your /usr/local/include.

If this will not help, please tell.

Good luck!

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #2 on: January 17, 2020, 11:58:53 AM »
That's a good idea, jazzbiker, so I gave it a shot.
I tried # ln -s /usr/local/include/ncursesw /usr/local/include/ncurses before the above steps. Alas, configure quits with the same exact error.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #3 on: January 17, 2020, 01:12:02 PM »
Hi, GNUser!

I've achieved configure to accept ncursesw library by manual editing of configure file. If this way is acceptable for You edit the following string in configure:

Code: [Select]
for ac_lib in '' tinfo curses ncurses; do

to make it

Code: [Select]
for ac_lib in '' tinfo curses ncursesw; do

configure can't find ncurses library itself, because it is named ncursesw.

I don't made the whole build, I only achieved configure to accept ncursesw. TC10.1 x86, but I think it will work the same for TC11.


Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #4 on: January 17, 2020, 02:21:01 PM »
jazzbiker, THANK YOU! Yes, that edit allows the configure step to complete. Nice!

Now I can get as far as make, but it errors out with this:

Code: [Select]
$ make
---snip---
lftp_tinfo.cc:40:3: error: #error No header file for tigetstr or tgetstr found. Install ncurses-dev or termcap-dev.
   40 | # error No header file for tigetstr or tgetstr found. Install ncurses-dev or termcap-dev.
      |   ^~~~~
lftp_tinfo.cc: In function ‘void init_terminfo()’:
lftp_tinfo.cc:55:7: error: ‘setupterm’ was not declared in this scope
   55 |    if(setupterm(NULL, 1, &errret) == ERR)
      |       ^~~~~~~~~
lftp_tinfo.cc:55:38: error: ‘ERR’ was not declared in this scope
   55 |    if(setupterm(NULL, 1, &errret) == ERR)
      |                                      ^~~
lftp_tinfo.cc: In function ‘const char* get_string_term_cap(const char*, const char*)’:
lftp_tinfo.cc:73:22: error: ‘tigetstr’ was not declared in this scope
   73 |    const char *ret = tigetstr(const_cast<char *>(terminfo_cap));
      |                      ^~~~~~~~
make[2]: *** [Makefile:2332: lftp_tinfo.lo] Error 1
make[2]: Leaving directory '/home/bruno/Downloads/lftp-4.9.1/src'
make[1]: *** [Makefile:1740: all-recursive] Error 1
make[1]: Leaving directory '/home/bruno/Downloads/lftp-4.9.1'
make: *** [Makefile:1685: all] Error 2

In addition to your suggestion, I changed this line in configure:
Code: [Select]
for ac_header in curses.h term.h ncurses/curses.h ncurses/term.h termcap.h
to this:
Code: [Select]
for ac_header in curses.h term.h ncursesw/curses.h ncursesw/term.h termcap.h
and these lines in src/lftp_tinfo.cc
Code: [Select]
#  include <ncurses/term.h>
# include <ncurses/curses.h>
#  include <ncurses/term.h>

to this:
Code: [Select]
#  include <ncursesw/term.h>
# include <ncursesw/curses.h>
#  include <ncursesw/term.h>

But the pesky make error does not go away.
« Last Edit: January 17, 2020, 02:23:07 PM by GNUser »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #5 on: January 17, 2020, 02:37:02 PM »
Damn. Maybe termcap.h must be changed to ncursesw/termcap.h too?

Code: [Select]
for ac_header in curses.h term.h ncursesw/curses.h ncursesw/term.h ncursesw/termcap.h

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #6 on: January 17, 2020, 02:48:10 PM »
We have three curses in repo - ncurses5, ncurses and ncursesw. I am not sure but ncursesw have the full set of ncurses features. Is it possible to rebuild ncursesw simply naming it ncurses? Some software builds are looking exceptionally for ncurses.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #7 on: January 17, 2020, 03:14:20 PM »
Maybe termcap.h must be changed to ncursesw/termcap.h too?

Good thought. Alas, no joy.

Maybe you're right in that lftp needs ncurses-dev to compile and not ncursesw-dev. I don't know.

I'm throwing in the towel for now :'(

P.S. The Pure64 11.x repository only has ncursesw-dev.tcz. If and when ncurses-dev.tcz shows up in the repo, I'll give it another shot.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #8 on: January 17, 2020, 03:38:50 PM »
From the ncurses-6.1/README:
 "The wide-character library interfaces are not binary-compatible with the non-wide-character       
version. "
But all non-wide functions are present in wide library, so there is no reason not to be able to link non-wide software with wide-char library.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #9 on: January 17, 2020, 04:27:08 PM »
Hi, GNUser!

I've started with the clean lftp-4.9.1 sources, made link ncurses->ncursesw in /usr/local/include/, then corrected only library name in configure and got after ./configure --without-gnutls:
Code: [Select]
tc@box:/tmp/lftp-4.9.1$ make
... a lot of ...
tc@box:/tmp/lftp-4.9.1$ echo $?
0


Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #10 on: January 17, 2020, 04:59:41 PM »
Thank you, jazzbiker. Thanks to you I was also able to figure it out using a different approach:

In configure I changed these lines:
Code: [Select]
for ac_lib in '' tinfo curses ncurses; do
...
   for ac_header in curses.h term.h ncurses/curses.h ncurses/term.h termcap.h

to this:
Code: [Select]
for ac_lib in '' tinfo curses ncursesw; do
...
   for ac_header in curses.h term.h ncursesw/curses.h ncursesw/term.h ncursesw/termcap.h

In src/lftp_tinfo.cc I changed these lines:

Code: [Select]
#else
# error No header file for tigetstr or tgetstr found. Install ncurses-dev or termcap-dev.
#endif
...
   if(setupterm(NULL, 1, &errret) == ERR)

To this:
Code: [Select]
#else
#  include <ncursesw/term.h>
#endif
...
   if(setupterm(NULL, 1, &errret) == -1)

The change to the else clause was key because it's where the logic was going and because the infamous tigetstr function header is in ncursesw/term.h only. ERR is not defined in term.h but is defined elsewhere as -1.

After those changes to the source code (to configure and src/lftp_tinfo.cc), things were straight-forward:
Code: [Select]
$ tce-load -i compiletc gettext-dev libidn2-dev ncursesw-dev readline-dev pkg-config openssl-1.1.1-dev
$ export CFLAGS="-mtune=generic -Os -pipe"
$ export CXXFLAGS="-mtune=generic -Os -pipe"
$ export LDFLAGS="-Wl,-O1"
$ ./configure --prefix=/usr/local --without-gnutls --with-openssl
$ make

There's no way I would have been able to crack this without your help. THANK YOU! :D


« Last Edit: January 17, 2020, 05:09:05 PM by GNUser »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #11 on: January 17, 2020, 05:25:27 PM »
Oh, no thanks, I'm glad to help a little bit when I'm able to. Its pleasant when the job is done, but its double pleasant if something was taught along the way. Thank You for giving such a possibility )))

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1343
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #12 on: January 17, 2020, 07:19:49 PM »
But all non-wide functions are present in wide library, so there is no reason not to be able to link non-wide software with wide-char library.
This was key. Before you found it and shared it, I wasn't even sure I was on the right track.
Thanks again :)
I'm rocking lftp 4.9.1 now, and will contribute it as an extension in the near future.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1020
Re: trouble with ncursesw-dev when compiling for Pure64 11.0-beta
« Reply #13 on: January 18, 2020, 06:45:05 AM »
I feel your pain. PHP, net-snmp, and iftop also require hacks in their build scripts to compile with ncursesw. Finding those hacks takes a while, and can change with versions.