Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 249507 - gnustep-base/mknfonts: fails with forced --as-needed
Summary: gnustep-base/mknfonts: 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 QA (vote)
Assignee: Gentoo Gnustep project
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2008-12-01 18:31 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2008-12-03 14:42 UTC (History)
0 users

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


Attachments
Build log (mknfonts-0.5-r1:20081201-182303.log,4.38 KB, text/plain)
2008-12-01 18:33 UTC, Diego Elio Pettenò (RETIRED)
Details

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-12-01 18:31:55 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).

Please note that this bug _might_ apply to -Wl,--as-needed in LDFLAGS as well; in both cases it should be fixed. Also, if this is due to the package in question not respecting user-defined LDFLAGS, you should get to fix that too.

Check the attached build log.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-12-01 18:33:19 UTC
Created attachment 173990 [details]
Build log
Comment 2 Bernard Cafarelli gentoo-dev 2008-12-03 12:52:28 UTC
The problem is hidden in gnustep-make itself (the make wrapper for most gnustep projects), in mknfonts case it's in /usr/GNUstep/System/Library/Makefiles/Instance/tool.make
Here is the original compilation target:
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK)
	$(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) $(CC_LDFLAGS) -o $(LDOUT)$@ \
		$(OBJ_FILES_TO_LINK) \
		$(ALL_LIB_DIRS) $(ALL_LIBS)$(END_ECHO)
mknfonts specifies "-lfreetype" in $ADDITIONAL_LDFLAGS, which is then merged in $ALL_LDFLAGS

However moving $ALL_LDFLAGS after $(OBJ_FILES_TO_LINK) results in -Wl,--as-needed appearing later on the line, example output:
i686-pc-linux-gnu-gcc -fgnu-runtime -o obj/mknfonts \
                ./obj/mknfonts.o  -rdynamic `freetype-config --libs`  -Wl,-O1 -Wl,--as-needed -Wl,-rpath=/usr/GNUstep/System/Library/Libraries   -Wl,-O1 -Wl,--as-needed  -shared-libgcc -fexceptions \
                   -L/usr/GNUstep/System/Library/Libraries/./obj  -L/var/tmp/portage/gnustep-base/mknfonts-0.5-r1/temp/GNUstep/Library/Libraries -L/usr/GNUstep/Local/Library/Libraries -L/usr/GNUstep/System/Library/Libraries     -lgnustep-base    -lobjc   -lm

Is it a problem, i.e does "-Wl,--as-needed" must appear before obj files to apply correctly, or does the place not matter?
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-12-03 13:09:43 UTC
The guide states the correct order

$(LD) $(LDFLAGS) $(OBJFILES) $(LIBRARIES)

yes order does matter ;)
Comment 4 Bernard Cafarelli gentoo-dev 2008-12-03 14:42:22 UTC
Fixed in CVS, in fact the incorrect ADDITIONAL_* variable was used, now the order is correct :)

Now let's check what's wrong with gorm