WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ncurses not found, trying to compile iftop  (Read 1495 times)

Offline ovacikar

  • Newbie
  • *
  • Posts: 42
ncurses not found, trying to compile iftop
« on: December 29, 2023, 10:09:17 AM »
Hi Folks,

I am trying to compile iftop on picore 14 running on Rpi model B , last source release was from 2014 : https://pdw.ex-parrot.com/iftop/download/iftop-1.0pre4.tar.gz

I am not able to get the configure script to detect ncurses. I have ncurses-dev extension installed, and even copied ncursesw folder to curses and ncurses

Code: [Select]
tc@box:/mnt/mmcblk0p2/tce/iftop-1.0pre4$ sudo find / -name *curses*.h
/usr/local/include/ncurses/curses.h
/usr/local/include/ncurses/cursesapp.h
/usr/local/include/ncurses/cursesf.h
/usr/local/include/ncurses/cursesm.h
/usr/local/include/ncurses/cursesp.h
/usr/local/include/ncurses/cursesw.h
/usr/local/include/ncurses/ncurses.h
/usr/local/include/ncurses/ncurses_dll.h
/usr/local/include/curses/curses.h
/usr/local/include/curses/cursesapp.h
/usr/local/include/curses/cursesf.h
/usr/local/include/curses/cursesm.h
/usr/local/include/curses/cursesp.h
/usr/local/include/curses/cursesw.h
/usr/local/include/curses/ncurses.h
/usr/local/include/curses/ncurses_dll.h
/usr/local/include/ncursesw/ncurses_dll.h
/usr/local/include/ncursesw/ncurses.h
/usr/local/include/ncursesw/cursesw.h
/usr/local/include/ncursesw/cursesp.h
/usr/local/include/ncursesw/cursesm.h
/usr/local/include/ncursesw/cursesf.h
/usr/local/include/ncursesw/cursesapp.h
/usr/local/include/ncursesw/curses.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/curses.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/cursesapp.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/cursesf.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/cursesm.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/cursesp.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/cursesw.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/ncurses.h
/tmp/tcloop/ncurses-dev/usr/local/include/ncursesw/ncurses_dll.h

and the configure script checks for all three variants:
Code: [Select]
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a curses library containing mvchgat" >&5
$as_echo_n "checking for a curses library containing mvchgat... " >&6; }
oldLIBS=$LIBS
for curseslib in ncursesw curses ncurses ; do
    LIBS="$oldLIBS -l$curseslib"
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <$curseslib.h>

And config.log shows it is failing for all 3:
Code: [Select]
configure:5740: checking for a curses library containing mvchgat
configure:5760: gcc -o conftest -g -O2   conftest.c -lpcap -lm  -lncursesw >&5
conftest.c:45:10: fatal error: ncursesw.h: No such file or directory
   45 | #include <ncursesw.h>
      |          ^~~~~~~~~~~~
compilation terminated.

configure:5760: gcc -o conftest -g -O2   conftest.c -lpcap -lm  -lcurses >&5
conftest.c:45:10: fatal error: curses.h: No such file or directory
   45 | #include <curses.h>
      |          ^~~~~~~~~~
compilation terminated.

configure:5760: gcc -o conftest -g -O2   conftest.c -lpcap -lm  -lncurses >&5
conftest.c:45:10: fatal error: ncurses.h: No such file or directory
   45 | #include <ncurses.h>
      |          ^~~~~~~~~~~
compilation terminated.

What is happening? I will try to attach the complete config.log

Thanks in advance!

    [EDIT]: Added  code  tags.  Rich
« Last Edit: December 29, 2023, 05:15:19 PM by Rich »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: ncurses not found, trying to compile iftop
« Reply #1 on: December 29, 2023, 11:34:23 AM »
The includes are incorrect, they should read, for example:

#include <ncursesw/ncursesw.h>
#include <ncursesw/curses.h>

Offline ovacikar

  • Newbie
  • *
  • Posts: 42
Re: ncurses not found, trying to compile iftop
« Reply #2 on: December 29, 2023, 12:41:39 PM »
The includes are incorrect, they should read, for example:

#include <ncursesw/ncursesw.h>
#include <ncursesw/curses.h>

And what would be the remedy?  I tried with
1- ./configure --includedir=/usr/local/include/ncursesw/ , same error
2- modified the configure script line #include <$curseslib.h> to #include <ncursesw/$curseslib.h> , same error
3- hard coded the include line to #include <ncursesw/curses.h> , which passed the configure.

checking for a curses library containing mvchgat... -lncursesw

But then make failed with:
Code: [Select]
gcc -DHAVE_CONFIG_H -I.     -g -O2  -MT edline.o -MD -MP -MF .deps/edline.Tpo -c -o edline.o edline.c
edline.c:10:10: fatal error: curses.h: No such file or directory
   10 | #include <curses.h>

    [EDIT]: Added  code  tags.  Rich
« Last Edit: December 29, 2023, 05:13:26 PM by Rich »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: ncurses not found, trying to compile iftop
« Reply #3 on: December 29, 2023, 01:49:05 PM »
You could symlink the contents of /usr/local/include/ncursesw to /usr/local/include

Offline ovacikar

  • Newbie
  • *
  • Posts: 42
Re: ncurses not found, trying to compile iftop
« Reply #4 on: December 29, 2023, 02:42:33 PM »
You could symlink the contents of /usr/local/include/ncursesw to /usr/local/include

Do I do that using the default configure script or the modified one (hardcoded option 3) ?


Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14756
Re: ncurses not found, trying to compile iftop
« Reply #5 on: December 29, 2023, 03:49:14 PM »
It should work with the default configure script.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11516
Re: ncurses not found, trying to compile iftop
« Reply #6 on: December 29, 2023, 05:14:20 PM »
Hi ovacikar
Welcome to the forum.

Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly. Code tags also automatically add horizontal and or vertical scrollbars
to accommodate long lines and listings.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: ncurses not found, trying to compile iftop
« Reply #7 on: December 29, 2023, 11:44:51 PM »
Here's the script for x86 and 64: https://github.com/andyj713/tinycorelinux-build-scripts/blob/master/build-iftop.sh. It has fixes for curses, but I haven't tried it on Pi.

Offline ovacikar

  • Newbie
  • *
  • Posts: 42
Re: ncurses not found, trying to compile iftop
« Reply #8 on: December 30, 2023, 10:04:23 AM »
Here's the script for x86 and 64: https://github.com/andyj713/tinycorelinux-build-scripts/blob/master/build-iftop.sh. It has fixes for curses, but I haven't tried it on Pi.

Thanks a lot! Worked like a charm.

Code: [Select]
export CFLAGS="$CFLAGS -fcommon"
sudo ln -fs /usr/local/include/ncursesw/ncurses.h /usr/local/include/ncursesw.h
./configure
for a in $(grep -l -r '<ncurses.h>' *); do sed -i 's#<ncurses.h>#<ncursesw/ncurses.h>#' $a; done
for a in $(grep -l -r '<curses.h>' *); do sed -i 's#<curses.h>#<ncursesw/curses.h>#' $a; done
make