gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [bug #47349] Building with ncurses on FreeBSD may crash scons


From: Fred Wright
Subject: [gpsd-dev] [bug #47349] Building with ncurses on FreeBSD may crash scons
Date: Sat, 05 Mar 2016 23:12:14 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

URL:
  <http://savannah.nongnu.org/bugs/?47349>

                 Summary: Building with ncurses on FreeBSD may crash scons
                 Project: GPSD
            Submitted by: fhgwright
            Submitted on: Sat 05 Mar 2016 11:12:12 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I saw this a while back, but finally tracked down the cause.

Although FreeBSD includes ncurses and tinfo in the base install, in which case
pkg-config presumably doesn't report anything (and there's fallback code to
handle that),  if ncurses and/or tinfo is installed as a package, pkg-config
*does* provide results, which cause scons to choke.

Sample:

$ pkg-config --libs ncurses
-L/usr/local/lib -rpath /usr/local/lib  -lncurses -ltinfo  

The problem with this is the "-rpath", exacerbating a number of bugs:

1) The "-rpath" itself seems completely superfluous in this case, given that
it specifies the same path as the link-time path.  This is presumably a
problem with the packaging of ncurses and tinfo (and several other packages
not relevant here).  BTW, this is present even when "--static" is supplied to
pkg-config, which is pretty severely broken.

2) Scons's ParseFlags() doesn't recognize "-rpath" as a specially handled
option (though it does recognize "-Wl,rpath="), so it jut passes it on.  It
then assumes that the next item (not considered an option since it lacks a
leading dash) must be a file as it passes it through.

3) When it tries to create a "file" node for "/usr/local/lib", it already has
a "directory" node by that name (presumably created by the preceding -L
option), and throws an exception due to the type mismatch.

4) Nothing within ParseFlags() (or its caller) catches the exception, so it
passes up through SConstruct to the top-level scons, which treats it as a
fatal error.  Note that it doesn't matter whether the relevant target is
actually being built, since it crashes during the setup.

5) Just to make it harder to debug, "--debug=pdb" still exits on uncaught
exceptions, rather than handing them off to pdb (and making post-mortem work
properly).

Any workaround that requires massaging the flags would first need to rework
the pkg-config logic so that pkg-config is run directly in SConstruct, rather
than deferring it via the '!pkg-config ...' construct, where its results are
hidden within the innards of ParseFlags().  This is probably a good idea in
general, since it's better for debugging to be able to view the actual flags
from SConstruct breakpoints, but it's a non-trivial change.

However, it looks like there's a cheap fix by exploiting the fact that neither
the "--libs-only-L" nor" --libs-only-l" pkg-config optuons include the
superfluous "-rpath /usr/local/lib".  To wit:

$ pkg-config --libs-only-L ncurses
-L/usr/local/lib  
$ pkg-config --libs-only-l ncurses
-lncurses -ltinfo  
$ pkg-config --cflags --libs-only-L --libs-only-l ncurses
-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600
-I/usr/local/include -I/usr/local/include/ncurses -L/usr/local/lib -lncurses
-ltinfo  

So a simple tweak of the pkg-config options should be adequate.





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?47349>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]