bugGPSD - Bugs: bug #47349, Building with ncurses on FreeBSD...

 
 

bug #47349: Building with ncurses on FreeBSD may crash scons

Submitted by:  Fred Wright <fhgwright>
Submitted on:  Sat 05 Mar 2016 11:12:12 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Jon Schlueter <yazug>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 08 Mar 2016 12:03:44 AM UTC, comment #1:

The workaround suggested at the end of the original post has now been merged, so this bug can be marked fixed.

Fred Wright <fhgwright>
Project Member
Sat 05 Mar 2016 11:12:12 PM UTC, original submission:

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.

Fred Wright <fhgwright>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by yazug (Updated the item)
  • -unavailable- added by fhgwright (Submitted the item)
  • -unavailable- added by fhgwright
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 08 Mar 2016 12:38:47 AM UTCyazugStatusNone=>Fixed
      Assigned toNone=>yazug
      Open/ClosedOpen=>Closed
    Sat 05 Mar 2016 11:12:13 PM UTCfhgwrightCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1