Hello,
I have a question to the patch provided by the package
app-portage/elt-patches, namely the file as-needed/2.4.3
Here I can see the following being added to ltmain.sh:
+ -Wl,--as-needed|-Wl,--no-as-needed)
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
In my understanding the order must be the opposite otherwise it has no
effect to $deplibs, i.e. the line should be deplibs="$arg $deplibs".
From the man page of ld I read:
This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
on the command line after the --as-needed option.
If we add the flag after deplibs it's mostly not in effect at all.
I realized that the flag is uneffective building claws-mail which links
in the end to the library libnsl, although this dependency is
unnecessary, which can be seen with
ldd -u -r $(which claws-mail)
Unused direct dependencies:
/usr/lib64/libgthread-2.0.so.0
/usr/lib64/libatk-1.0.so.0
/usr/lib64/libpangoft2-1.0.so.0
/usr/lib64/libfontconfig.so.1
/usr/lib64/libfreetype.so.6
/usr/lib64/libnsl.so.2
/usr/lib64/libdbus-1.so.3
The link command used to build claws-mail when it is being installed using
emerge is:
libtool: link: x86_64-pc-linux-gnu-gcc -mtune=generic -O2 -pipe
-Wno-unused-function -Wno-pointer-sign -Wall -Wl,-O1 -Wl,--export-dynamic -o
claws-mail account.o action.o addrcache.o addr_compl.o addressadd.o
addrgather.o addrharvest.o addritem.o advsearch.o alertpanel.o autofaces.o
avatars.o codeconv.o compose.o crash.o customheader.o displayheader.o
edittags.o enriched.o entity.o export.o file_checker.o filtering.o folder.o
folder_item_prefs.o foldersel.o folderutils.o folderview.o grouplistdialog.o
headerview.o html.o image_viewer.o imap.o imap_gtk.o import.o inc.o
localfolder.o main.o mainwindow.o manual.o matcher.o matcher_parser_lex.o
matcher_parser_parse.o mbox.o message_search.o messageview.o mh.o mh_gtk.o
mimeview.o msgcache.o news.o news_gtk.o noticeview.o partial_download.o
password.o password_gtk.o passwordstore.o pop.o prefs_account.o prefs_actions.o
prefs_common.o prefs_compose_writing.o prefs_customheader.o
prefs_display_header.o prefs_ext_prog.o prefs_filtering_action.o
prefs_filtering.o prefs_folder_item.o prefs_fonts.o prefs_gtk.o
prefs_image_viewer.o prefs_logging.o prefs_matcher.o prefs_message.o
prefs_migration.o prefs_msg_colors.o prefs_other.o prefs_quote.o
prefs_receive.o prefs_send.o prefs_spelling.o prefs_summaries.o
prefs_summary_column.o prefs_summary_open.o prefs_folder_column.o
prefs_template.o prefs_themes.o prefs_toolbar.o prefs_wrapping.o printing.o
privacy.o procheader.o procmime.o procmsg.o quote_fmt.o quote_fmt_lex.o
quote_fmt_parse.o recv.o remotefolder.o send_message.o setup.o sourcewindow.o
ssl_manager.o statusbar.o stock_pixmap.o summary_search.o summaryview.o
textview.o toolbar.o undo.o unmime.o uri_opener.o wizard.o addrbook.o
addrclip.o addrcustomattr.o addressbook.o addressbook_foldersel.o addrindex.o
addrquery.o addrselect.o addrduplicates.o browseldap.o editaddress.o
editaddress_other_attributes_ldap.o editbook.o editgroup.o editjpilot.o
editldap_basedn.o editldap.o editvcard.o exphtmldlg.o expldifdlg.o exporthtml.o
exportldif.o importldif.o importmutt.o importpine.o jpilot.o ldapctrl.o
ldaplocate.o ldapquery.o ldapserver.o ldapupdate.o ldaputil.o ldif.o mutt.o
pine.o vcard.o -Wl,-O1 -pthread -Wl,-O1 -pthread etpan/.libs/libclawsetpan.a
-L/usr/lib64 gtk/.libs/libclawsgtk.a -lgmodule-2.0 -lgthread-2.0 -lcrypt
-lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lpangoft2-1.0
-lpango-1.0 -lfontconfig -lfreetype -lnsl -llber -lldap -lgnutls -lpthread
-lstartup-notification-1 -ldbus-glib-1 -ldbus-1 -lrsvg-2 -lgio-2.0
-lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lcairo -lm -letpan -Wl,--as-needed
-lssl -lcrypto -lz -pthread
As you can see the flag --as-needed is passed rather late on the
commandline pulling in libnsl in the final build. Passing it earlier on
the commandline, removes the dependency on libnsl. I know that it is a
"bug" of claws-mail pulling in libnsl in the first place if it is not
needed at all. But I am wondering about the order of deplibs and arg in
the above mentioned patch, that is applied in the end to a lot of
ebuilds. I assume claws-mail is not the only package suffering from a
useless --as-needed flag, since it's passed way too late.
Cheers
Andreas