Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 247003 - app-text/xpdf: fails with forced --as-needed
Summary: app-text/xpdf: fails with forced --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Printing Team
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2008-11-16 00:07 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2009-01-16 15:50 UTC (History)
1 user (show)

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


Attachments
Patch to Makefile to fix xpdf link line to honor $LDFLAGS and link libraries late enough that --as-needed does not break the build (xpdf-as-needed.patch,398 bytes, patch)
2009-01-01 18:22 UTC, Kevin Pyle
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-16 00:07:51 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 Kevin Pyle 2009-01-01 18:20:22 UTC
Diego, you never attached a build log.

Maintainers: this turns out to be a fairly simple fix.  xpdf uses a custom Makefile which has this rule for building xpdf:

xpdf: CoreOutputDev.o GlobalParams.o ImageOutputDev.o PDFCore.o XPDFApp.o XPDFCore.o XPDFTree.o XPDFViewer.o parseargs.o xpdf.o 
	$(CXX) -o xpdf $(LIBS) *.o

When --as-needed is passed, the linker searches the libraries specified in $(LIBS), discards them, then reaches the .o files that require the symbols.  The fix is to reorder the line to be:

	$(CXX) -o xpdf *.o $(LIBS)


xpdf also fails to honor $LDFLAGS, so normal --as-needed testing via /etc/make.conf failed to find this problem.  I will attach a patch that corrects both issues.  With it, I am able to build xpdf with --as-needed.
Comment 2 Kevin Pyle 2009-01-01 18:22:27 UTC
Created attachment 177018 [details, diff]
Patch to Makefile to fix xpdf link line to honor $LDFLAGS and link libraries late enough that --as-needed does not break the build
Comment 3 Peter Alfredsen (RETIRED) gentoo-dev 2009-01-16 15:50:20 UTC
+  16 Jan 2009; Peter Alfredsen <loki_val@gentoo.org>
+  +files/xpdf-3.02-as-needed.patch, xpdf-3.02-r1.ebuild:
+  Fix as-needed, bug 247003.
+