Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 246970 - net-libs/libwww: fails with forced --as-needed
Summary: net-libs/libwww: fails with forced --as-needed
Status: RESOLVED DUPLICATE of bug 323531
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Text-Markup Team (OBSOLETE)
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2008-11-15 18:55 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-06-28 08:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build log (net-libs:libwww-5.4.0-r7:20081115-185330.log,241.10 KB, text/plain)
2008-11-15 18:56 UTC, Diego Elio Pettenò (RETIRED)
Details
Patch to libwww-5.4.0-r7.ebuild to (mostly) fix missed linking (libwww-5.4.0-r7.ebuild.patch,1.13 KB, patch)
2009-07-11 03:01 UTC, Kevin Pyle
Details | Diff
patch to remove --as-needed flag (libwww-5.4.0-r7.ebuild.patch,455 bytes, text/plain)
2009-09-27 15:34 UTC, Andrew Savchenko
Details
add --no-as-needed flag (libwww-5.4.0-r7.ebuild.patch,458 bytes, patch)
2009-09-28 07:57 UTC, Andrew Savchenko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-15 18:55:58 UTC
I'm reporting this bug because the package in summary fails to build when forcing --as-needed on through spec files (check out http://blog.flameeyes.eu/2008/11/14/problems-and-mitigation-strategies-for-as-needed for details).

Check the attached build log.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-15 18:56:44 UTC
Created attachment 171898 [details]
Build log
Comment 2 Kevin Pyle 2009-07-11 03:01:12 UTC
Created attachment 197500 [details, diff]
Patch to libwww-5.4.0-r7.ebuild to (mostly) fix missed linking

This patch extends the ebuild to add echo statements which append necessary dependencies to various Makefile.am before regenerating the autotools files.  Addressing the problem reported in comment #0 was relatively easy, though I had to use --no-undefined to make it visible since I did not build the entire test area with forced --as-needed.

Unfortunately, --no-undefined revealed additional linking problems in the libwww*.la family.  I fixed most of them, but one will require restructuring of the libwww modules, and so is left unaddressed.  The problem is that libwwwdir needs functions from libwwwfile, and libwwwfile needs functions from libwwwdir.  Since both of these are installed libraries, it is not possible to declare them each to be a dependency of the other.  Moving the required functions to a convenience library would work, but would result in the installation of duplicate code.  The proper fix, if anyone wants to do it, would be to move the required functionality to some other library, possibly creating one, and use that to avoid the circular dependency.
Comment 3 Andrew Savchenko gentoo-dev 2009-09-27 15:30:32 UTC
The same problem here with --as-needed via LDFLAGS.

Because there is no full and workable fix for this issue, I filtered -Wl,--as-needed from LDFLAGS for this package.
Comment 4 Andrew Savchenko gentoo-dev 2009-09-27 15:34:40 UTC
Created attachment 205391 [details]
patch to remove --as-needed flag

Proposed solution is acceptable in this case due to bad library design.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-09-27 15:37:10 UTC
Comment on attachment 205391 [details]
patch to remove --as-needed flag

Never do that.
Comment 6 Andrew Savchenko gentoo-dev 2009-09-27 21:02:25 UTC
(In reply to comment #5)
> (From update of attachment 205391 [details] [edit])
> Never do that.

According to your own howto this should be done if library is badly broken and can't be fixed without redesign:
http://www.gentoo.org/proj/en/qa/asneeded.xml
Quote: "Please consider using this filtering only if you know that the design of the software conflicts with --as-needed."
So, please, be consistent.

This library requires redesign, this is not just bug to fix.

And you're arrogantly saying "Never do that". OK. And what should I do to make my system work if "--as-needed" is present in the LDFLAGS? There are no other way at this moment to fix this. Sincerely, I do not want to rewrite the whole library myself. What is your WORKING proposal to keep system running? Just leave it badly broken with preserved libs because current fix is not good enough? OK, it's bad, but according to howto pointed above this bad solution is still acceptable in some cases.

And please, do not reject things so perkily if you do not have other solution.
Comment 7 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-09-27 21:10:18 UTC
Just like I have said many times, the correct filtering is NOT using filter-flags.

You linked my own guide yourself: http://www.gentoo.org/proj/en/qa/asneeded.xml maybe try reading it? You quoted two paragraphs and totally IGNORED the presence of a code example?
Comment 8 Andrew Savchenko gentoo-dev 2009-09-28 07:55:09 UTC
(In reply to comment #7)
> maybe try reading it? You quoted two paragraphs and totally IGNORED the
> presence of a code example?
 
I read it, but I disagree with your arguments about forcing --no-as-needed, instead of filtering:

1) The only way to add --as-needed via LDFLAGS is "-Wl,--as-needed", it can't be concatenated to previos ld flag because according to gcc manual in the construction "-Wl,-param,--as-needed" '--as-needed' will be treated like option of '-param' thus effectively broking things up.

2) Messing with gcc specs is a very bad idea, it is good only for extreme testing. In the same way you may force -funsafe-math-optimizations or just -O3 via gcc specs and require from every package failing to compile with it to remove flags filtering and effectively cancel dangerous flags via those opposite to them.
Comment 9 Andrew Savchenko gentoo-dev 2009-09-28 07:57:11 UTC
Created attachment 205445 [details, diff]
add --no-as-needed flag

In this particular case I do not really care about ideological background behind patches. I just need this package to work, so you have it.
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-09-28 09:03:03 UTC
(In reply to comment #8)
> 1) The only way to add --as-needed via LDFLAGS is "-Wl,--as-needed", it can't
> be concatenated to previos ld flag because according to gcc manual in the
> construction "-Wl,-param,--as-needed" '--as-needed' will be treated like option

No you got it wrong, indeed you _can_ concatenate it:

-Wl,--as-needed,--hash-style=gnu,--no-undefined

This will work just as much as

-Wl,--as-needed -Wl,--hash-style=gnu -Wl,--no-undefined

so you cannot just _filter_ it out, you got to toggle it off!
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2010-01-08 14:50:25 UTC
Comment on attachment 205445 [details, diff]
add --no-as-needed flag

Bogus. Only a workaround and a wrong one, because you'd be breaking non-GNU linkers.

append-ldflags $(no-as-needed)
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2010-06-28 08:23:09 UTC
Fix for bug 323531 appears to have fixed this, just built fine here with forced asneeded.

*** This bug has been marked as a duplicate of bug 323531 ***