amagnasco / xwpe

Upload of an abandoned ncurses-based programming environment
http://www.identicalsoftware.com/xwpe/
GNU General Public License v2.0
29 stars 6 forks source link

Compiling with ncurses6 leads to error in edit.h #2

Closed gbonnema closed 7 years ago

gbonnema commented 7 years ago

Hi Alessandro,

Today I tried compiling xwpe. First I had to add a symbolic link to get to ncurses from libncurses.so.6 to libncurses.so. Now, I find that the code lacks a way to distinguish between curses and ncurses. In edit.h on lines 35 - 37, you will find the following code:

`#ifndef TERMCAP

include

endif`

A negative to determine a positive is never a reliable. What we need is a DEF from the configure to make sure that when ncurses is available it is indeed used (as it is the most recent version of curses). If not available there should be a DEF for curses and otherwise we should be using termcap directly, which hopefully is never the case.

Do you know how to make the configure create a DEF constant if ncurses is available?

Kind regards, Guus.

P.S. not sure why the code doesn't show linefeeds.

amagnasco commented 7 years ago
  1. I'm on it, any ideas?
  2. What system are you using? How are you running the config?
  3. If on Arch or Debian-based, does the repo package work for you?
gbonnema commented 7 years ago
  1. I am just not very experienced with autoconf (or automake), but if you are not either, I can see if I can find out how to define curses and ncurses constants.
  2. I am using Fedora 25, which is rpm based. It uses utility dnf.
  3. Fedora does not have a package for xwpe unfortunately.

Let me know, and I will see if I can find out how to do stuff with autoconf. I am uncertain whether autoconf is the way to go. It seems automake is the modern variant. The difference appears to be that autoconf uses a handmade Makefile.in while automake uses a handmade Makefile.am and generates the Makefile.in.

For the time being, let's just get the system to work and we can go from there.

Does it work for you? Do you use a prepackaged version? Or do you compile with curses in stead of ncurses?

amagnasco commented 7 years ago

Do you have the -dev version of ncurses installed? It provides the 32 bit libraries required for this. For RPM, it's libncurses5-devel. I'm not sure of what libraries v6 provides. I know, it's not exactly clear. I think the INSTALL file was written last century.

As for me, works fine, clean compile of this code. Ubuntu. Worked on Arch last time I tried it, a few months ago. The install breaks without libncurses5-dev.

The negative definition is for backward compatibility, as far as I see it. There's a lot of jury-rigging involving readline, termcap, curses, and the GNU port of it, ncurses. Particularly because of copyleft and GPL restrictions for binaries, aggravated by the switch from 32 bit. Usually, what happens is individual OS' installs of ncurses (the only accessible and modern library of all of these) prelink to the other libraries to satisfy the GPL requirements. I don't have access to Fedora ATM to verify whether the libncurses5-devel package does the trick, so keep me posted.

There's definitively a way to make the whole dependency process cleaner but I'm unsure of how it would play out across existing systems, much less for backwards compatibility. Feel free to look into it, and if you find something I'll work with you to get it off the ground.

For some background, see this RHEL post from 2010:

Debian solved this problem already in the last century (archives went only to back 1997, so I don't know exactly when). As libncurses provides the libtermcap API, in Debian /usr/lib/libtermcap.so is just a symlink to /usr/lib/libncurses.so. So things built against both libtermcap and libncurses work just fine.

Therefore this is only a problem for binary-only programs. But readline is GPL, so it cannot be used in binary-only programs and therefore those cannot (legally) have this issue.

For binary-only programs that linked just libtermcap and needed its ABI, Debian had libtermcap-compat package which provided the (inferior) /etc/termcap terminal description database and ABI compatible /usr/lib/libtermcap.so.2 library. This package seems to have been dropped in Debian Etch (released 2007), so I guess all of these obsolete binary-only programs had been fixed by then.

source: https://bugzilla.redhat.com/show_bug.cgi?id=499837

amagnasco commented 7 years ago

Also, you said

I find that the code lacks a way to distinguish between curses and ncurses.

Do you have the original UNIX libcurses installed ? That would definitively break a lot of stuff, not just this program.

gbonnema commented 7 years ago

ncurses

I do have ncurses-devel installed. The symlink I made was to ncurses version 6. Ofcourse all libraries are 64 bits.

curses

I do not have curses installed. The code I show in the first message tries to include <curses.h>. I just checked: it is part of the ncurses-devel version 6 I installed. So it might be just some include path requirement that I missed.

As you have no problem compiling, linking and executing, I should be able to run this from Fedora as well.

I will check tomorrow morning what went wrong. I apologize for sending you on a wild goose chase and thanks for looking into it.

Kind regards, Guus.

amagnasco commented 7 years ago

That's fine, happy to help.

Could you please paste the output of the following commands?

ls -al /lib/*/*curses*
ls -al /usr/lib/*/*curses*

These will clarify what libraries are being linked where.

Regards as well, Alessandro

gbonnema commented 7 years ago

I only have 64 bit libraries. Copy pasted.

Goodnight and thanks again.

`gbonnema  ~  ls -al /lib/*/*curses*
ls: cannot access '/lib/*/*curses*': No such file or directory

 gbonnema  ~  ls -al /lib64/*/*curses*
-rw-r--r--. 1 root root     388 Jul 19  2016 /lib64/pkgconfig/ncurses.pc
-rw-r--r--. 1 root root     417 Jul 19  2016 /lib64/pkgconfig/ncurses++.pc
-rw-r--r--. 1 root root     423 Jul 19  2016 /lib64/pkgconfig/ncurses++w.pc
-rw-r--r--. 1 root root     390 Jul 19  2016 /lib64/pkgconfig/ncursesw.pc
lrwxrwxrwx. 1 root root      27 Apr 13 17:37 /lib64/yui/libyui-mga-ncurses.so.8 -> libyui-mga-ncurses.so.8.0.0
-rwxr-xr-x. 1 root root   68904 Apr 13 17:37 /lib64/yui/libyui-mga-ncurses.so.8.0.0
lrwxrwxrwx. 1 root root      23 Apr 14 23:49 /lib64/yui/libyui-ncurses.so.8 -> libyui-ncurses.so.8.0.0
-rwxr-xr-x. 1 root root 1169664 Apr 14 23:49 /lib64/yui/libyui-ncurses.so.8.0.0

/lib64/python2.7/curses:
total 128
drwxr-xr-x.  2 root root  4096 May 15 21:44 .
drwxr-xr-x. 27 root root 20480 May 15 21:44 ..
-rw-r--r--.  1 root root  2623 May 10 22:05 ascii.py
-rw-r--r--.  2 root root  5102 May 10 22:05 ascii.pyc
-rw-r--r--.  2 root root  5102 May 10 22:05 ascii.pyo
-rw-r--r--.  1 root root  5627 May 10 22:05 has_key.py
-rw-r--r--.  2 root root  5937 May 10 22:05 has_key.pyc
-rw-r--r--.  2 root root  5937 May 10 22:05 has_key.pyo
-rw-r--r--.  1 root root  1817 May 10 22:05 __init__.py
-rw-r--r--.  2 root root  1553 May 10 22:05 __init__.pyc
-rw-r--r--.  2 root root  1553 May 10 22:05 __init__.pyo
-rw-r--r--.  1 root root   110 May 10 22:05 panel.py
-rw-r--r--.  2 root root   277 May 10 22:05 panel.pyc
-rw-r--r--.  2 root root   277 May 10 22:05 panel.pyo
-rw-r--r--.  1 root root  7338 May 10 22:05 textpad.py
-rw-r--r--.  2 root root  6870 May 10 22:05 textpad.pyc
-rw-r--r--.  2 root root  6870 May 10 22:05 textpad.pyo
-rw-r--r--.  1 root root  1681 May 10 22:05 wrapper.py
-rw-r--r--.  2 root root  1218 May 10 22:05 wrapper.pyc
-rw-r--r--.  2 root root  1218 May 10 22:05 wrapper.pyo

/lib64/python3.5/curses:
total 40
drwxr-xr-x.  3 root root 4096 May 15 21:44 .
drwxr-xr-x. 36 root root 4096 May 15 21:44 ..
-rw-r--r--.  1 root root 2547 May 10 17:07 ascii.py
-rw-r--r--.  1 root root 5634 May 10 17:07 has_key.py
-rw-r--r--.  1 root root 3366 May 10 17:07 __init__.py
-rw-r--r--.  1 root root   87 May 10 17:07 panel.py
drwxr-xr-x.  2 root root 4096 May 15 21:44 __pycache__
-rw-r--r--.  1 root root 7657 May 10 17:07 textpad.py

 gbonnema  ~  ls -al /usr/lib64/*/*curses*
-rw-r--r--. 1 root root     388 Jul 19  2016 /usr/lib64/pkgconfig/ncurses.pc
-rw-r--r--. 1 root root     417 Jul 19  2016 /usr/lib64/pkgconfig/ncurses++.pc
-rw-r--r--. 1 root root     423 Jul 19  2016 /usr/lib64/pkgconfig/ncurses++w.pc
-rw-r--r--. 1 root root     390 Jul 19  2016 /usr/lib64/pkgconfig/ncursesw.pc
lrwxrwxrwx. 1 root root      27 Apr 13 17:37 /usr/lib64/yui/libyui-mga-ncurses.so.8 -> libyui-mga-ncurses.so.8.0.0
-rwxr-xr-x. 1 root root   68904 Apr 13 17:37 /usr/lib64/yui/libyui-mga-ncurses.so.8.0.0
lrwxrwxrwx. 1 root root      23 Apr 14 23:49 /usr/lib64/yui/libyui-ncurses.so.8 -> libyui-ncurses.so.8.0.0
-rwxr-xr-x. 1 root root 1169664 Apr 14 23:49 /usr/lib64/yui/libyui-ncurses.so.8.0.0

/usr/lib64/python2.7/curses:
total 128
drwxr-xr-x.  2 root root  4096 May 15 21:44 .
drwxr-xr-x. 27 root root 20480 May 15 21:44 ..
-rw-r--r--.  1 root root  2623 May 10 22:05 ascii.py
-rw-r--r--.  2 root root  5102 May 10 22:05 ascii.pyc
-rw-r--r--.  2 root root  5102 May 10 22:05 ascii.pyo
-rw-r--r--.  1 root root  5627 May 10 22:05 has_key.py
-rw-r--r--.  2 root root  5937 May 10 22:05 has_key.pyc
-rw-r--r--.  2 root root  5937 May 10 22:05 has_key.pyo
-rw-r--r--.  1 root root  1817 May 10 22:05 __init__.py
-rw-r--r--.  2 root root  1553 May 10 22:05 __init__.pyc
-rw-r--r--.  2 root root  1553 May 10 22:05 __init__.pyo
-rw-r--r--.  1 root root   110 May 10 22:05 panel.py
-rw-r--r--.  2 root root   277 May 10 22:05 panel.pyc
-rw-r--r--.  2 root root   277 May 10 22:05 panel.pyo
-rw-r--r--.  1 root root  7338 May 10 22:05 textpad.py
-rw-r--r--.  2 root root  6870 May 10 22:05 textpad.pyc
-rw-r--r--.  2 root root  6870 May 10 22:05 textpad.pyo
-rw-r--r--.  1 root root  1681 May 10 22:05 wrapper.py
-rw-r--r--.  2 root root  1218 May 10 22:05 wrapper.pyc
-rw-r--r--.  2 root root  1218 May 10 22:05 wrapper.pyo

/usr/lib64/python3.5/curses:
total 40
drwxr-xr-x.  3 root root 4096 May 15 21:44 .
drwxr-xr-x. 36 root root 4096 May 15 21:44 ..
-rw-r--r--.  1 root root 2547 May 10 17:07 ascii.py
-rw-r--r--.  1 root root 5634 May 10 17:07 has_key.py
-rw-r--r--.  1 root root 3366 May 10 17:07 __init__.py
-rw-r--r--.  1 root root   87 May 10 17:07 panel.py
drwxr-xr-x.  2 root root 4096 May 15 21:44 __pycache__
-rw-r--r--.  1 root root 7657 May 10 17:07 textpad.py

 gbonnema  ~  
amagnasco commented 7 years ago

I'm not seeing any of the required libraries. You should have libcurses.so soft-linking to libncurses.so.6. Can you verify your installation of libncurses6? Or preferably, try libncurses5-devel ?

What it should look like:

agm@mothership:~$ ls -al /lib/*/*curses*
lrwxrwxrwx 1 root root     17 Jul  6  2016 /lib/i386-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 148792 Jul  6  2016 /lib/i386-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     37 May 17 16:11 /lib/x86_64-linux-gnu/libcurses.so -> /lib/x86_64-linux-gnu/libncurses.so.5
lrwxrwxrwx 1 root root     37 May 17 16:09 /lib/x86_64-linux-gnu/libcurses.so.5 -> /lib/x86_64-linux-gnu/libncurses.so.5
lrwxrwxrwx 1 root root     17 Apr  5 19:02 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 137136 Jul  6  2016 /lib/x86_64-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     18 Apr  5 19:02 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 190384 Jul  6  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9

agm@mothership:~$ ls -al /usr/lib/*/*curses*
-rw-r--r-- 1 root root   4851 Sep 20  2008 /usr/lib/valgrind/ncurses.supp
lrwxrwxrwx 1 root root     12 Jul  6  2016 /usr/lib/x86_64-linux-gnu/libcurses.a -> libncurses.a
lrwxrwxrwx 1 root root     13 Jul  6  2016 /usr/lib/x86_64-linux-gnu/libcurses.so -> libncurses.so
-rw-r--r-- 1 root root 304036 Jul  6  2016 /usr/lib/x86_64-linux-gnu/libncurses.a
-rw-r--r-- 1 root root 181366 Jul  6  2016 /usr/lib/x86_64-linux-gnu/libncurses++.a
-rw-r--r-- 1 root root     31 Jul  6  2016 /usr/lib/x86_64-linux-gnu/libncurses.so
etc etc python etc

Also, I made a project page for this at https://github.com/amagnasco/xwpe/projects/1#card-2965319

Good night, Alessandro

gbonnema commented 7 years ago

Hi Alessandro,

I had installed the devel lib, but it took until this morning for it to start working. I now get a new error for which I will create a new issue.

If I am allowed to close the issue, I will. Thanks Allessandro.