Found a bug in one of the depend scripts

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Found a bug in one of the depend scripts

Post by J.F. »

In the check-ncurses.sh depend script, it does this:

Code: Select all

#!/bin/sh
# check-ncurses.sh by Dan Peori ([email protected])

 ## Check for a ncurses library.
 ls /usr/lib/libncurses.a 1> /dev/null || ls /usr/lib/libncurses.dll.a || { echo "ERROR: Install ncurses before continuing."; exit 1; }
That won't work on linux systems. It needs to be "/usr/lib/libncurses.so". I noticed this was changed since I ran the toolchain last - probably to make it work with CygWin. You need to add libncurses.so to those or you're breaking all the linux folks.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Of course, the real right way to do it would be to just try to link a test program against "-lncurses". Has anyone considered using autoconf to do the detection?
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

As I'm on a linux system, I'm fairly sure it will indeed work on linux systems.

Generally, libncurses.so is always available. You need it to run ncurses-linked programs. But libncurses.a is there only when the ncurses development package is installed. That's why the test is written the way it is.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

ooPo wrote:As I'm on a linux system, I'm fairly sure it will indeed work on linux systems.

Generally, libncurses.so is always available. You need it to run ncurses-linked programs. But libncurses.a is there only when the ncurses development package is installed. That's why the test is written the way it is.
No. I'm on linux (Fedora 7), and have ncurses and ncurses-devel installed, so I KNOW there's no .a file. .a files were abandoned a couple years ago in favor of .so. The only .a files you'll find these days are a couple old, backwards-compatibility libs for really old apps.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Old old apps? Being a static library, they wouldn't come with .a files - the code has already been statically linked into the app.

Most linux distributions give you .a files when you install the development package because static linking is still relevant and very useful in many cases. Saying it has been abandoned reflects a very narrow viewpoint.

Here's some more info:
http://tldp.org/HOWTO/Program-Library-H ... aries.html

Still, you have a valid point about a bug if Fedora sees fit to not include the file. Can you tell me what it does install so we can pick a file to check for?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

ooPo wrote:Old old apps? Being a static library, they wouldn't come with .a files - the code has already been statically linked into the app.

Most linux distributions give you .a files when you install the development package because static linking is still relevant and very useful in many cases. Saying it has been abandoned reflects a very narrow viewpoint.

Here's some more info:
http://tldp.org/HOWTO/Program-Library-H ... aries.html

Still, you have a valid point about a bug if Fedora sees fit to not include the file. Can you tell me what it does install so we can pick a file to check for?
What can I say? I've got the latest Fedora with developer packages for almost everything and only 104 out of 2134 lib files are .a with the rest being .so. Looking at the file lists for -devel packages in the package manager, the vast majority use .so files, not .a files. It's been that way for at least a year that I'm aware of.

I stated the lib in the first post: "/usr/lib/libncurses.so"

Using that in the depends script works perfectly with Fedora 7.

A quick check of Xubuntu 7.04 minimum install set to compile the toolchain reveals only 49 out of 961 lib files are .a with the rest being .so. It also doesn't use libncurses.a. I don't think any modern linux distro does.

A closer look at Xubuntu shows they don't use an ncurses lib in /usr/lib/ at all. It uses /lib/libncurses.so.5 instead. I don't think the current ncurses depend check will work reliably on MOST systems. Jimparis has it right - the only way that stands a chance of working for everyone is to link a test program against -lncurses.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Xubuntu (and any other Ubuntu-based distro) would use this package for ncurses dev:

http://packages.ubuntu.com/feisty/libde ... urses5-dev

Which includes this file:

Code: Select all

usr/lib/libncurses.a
Regardless, I'll modify the script to look for /usr/include/ncurses.h.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

ooPo wrote:Xubuntu (and any other Ubuntu-based distro) would use this package for ncurses dev:

http://packages.ubuntu.com/feisty/libde ... urses5-dev

Which includes this file:

Code: Select all

usr/lib/libncurses.a
Regardless, I'll modify the script to look for /usr/include/ncurses.h.
Okay, I double-checked that and Ubuntu does have it, but Fedora doesn't. Odd...

I did some more checking, and the only place to get libncurses.a for Fedora 7 is

http://www-ccrma.stanford.edu/planetccr ... x86_64.rpm

They also have a 32 bit rpm as well for folks on 32 bit systems.
StrmnNrmn
Posts: 46
Joined: Wed Feb 14, 2007 11:32 pm
Location: London, UK
Contact:

Post by StrmnNrmn »

The depends script wasn't working under OSX either - it needs to look for libncurses.dylib. I wrote a bit about it here.

Checking for /usr/include/ncurses.h should work too.
Post Reply