MantisBT - CMake
View Issue Details
0004810CMakeCMakepublic2007-04-08 15:432012-07-09 06:52
Benjamin Reed 
Brad King 
lowminoralways
closedfixed 
 
 
0004810: OSX linker fails with too many duplicate -lfoo arguments
I'm having an interesting issue building libkorganizer in KDE because of ld (I think) running out of mmap'd memory or something similar.

See the URL, but essentially, it bombs out with:
  /usr/bin/libtool: can't map file: /opt/kde4/lib/libkio.dylib
  ((os/kern) no space available)

If I remove the extra -lkio lines from the compilation, the compile passes.

Is there a way to remove duplicate -l (and presumably -L) options from the link line?
No tags attached.
related to 0010179closed Kitware Robot Duplicate libraries appearances in link command line 
Issue History
2008-01-07 15:14Benjamin ReedNote Added: 0010090
2008-01-30 18:09Brad KingNote Added: 0010350
2008-01-30 18:09Brad KingAssigned ToBill Hoffman => Brad King
2011-02-03 19:36David ColeNote Added: 0025273
2012-02-09 10:03Brad KingRelationship addedrelated to 0010179
2012-02-09 10:05Brad KingNote Added: 0028542
2012-02-09 10:05Brad KingStatusassigned => resolved
2012-02-09 10:05Brad KingResolutionopen => fixed
2012-07-09 06:52David ColeNote Added: 0029969
2012-07-09 06:52David ColeStatusresolved => closed

Notes
(0010090)
Benjamin Reed   
2008-01-07 15:14   
This is still an issue and is now hitting a critical point, at least in a number of places in kdepim. Here's my recent post to kde-buildsystem:

So a side-effect of OSX's crappy linker is that when you have a
library specified multiple times on the command-line (-lkdecore
-lkdecore) it actually tries to mmap them twice when linking, even
though the resulting binary only has one link (as it should).

I'm hitting an issue now where it's impossible to link
libkmailprivate, even with the tricky KDEPIM4_LINK_UNIQUE_LIBRARIES
macro which deduplicates anything specified in a TARGET_LINK_LIBRARIES
command:

---(snip!)---
Linking CXX shared library ../lib/libkmailprivate.dylib
cd /Users/ranger/cvs/kde-mac/compile.build/kdepim/kmail &&
/usr/bin/cmake -P CMakeFiles/kmailprivate.dir/cmake_clean_target.cmake
cd /Users/ranger/cvs/kde-mac/compile.build/kdepim/kmail &&
/usr/bin/cmake -E cmake_link_script
CMakeFiles/kmailprivate.dir/link.txt --verbose=1
/usr/bin/c++ -arch i386 -arch ppc -isysroot
/Developer/SDKs/MacOSX10.4u.sdk
-B/Users/ranger/cvs/kde-mac/compile.build/kdepim/../bin -fno-common
-Woverloaded-virtual -O2 -g -dynamiclib -headerpad_max_install_names
-single_module -multiply_defined suppress -L/opt/kde4-deps/lib
-L/opt/kde4/lib -L/opt/qt4/lib -o ../lib/libkmailprivate.4.0.0.dylib
-install_name /Users/ranger/cvs/kde-mac/compile.build/kdepim/lib/libkmailprivate.4.dylib
"CMakeFiles/kmailprivate.dir/kmailprivate_automoc.o"
"CMakeFiles/kmailprivate.dir/kmmessage.o"
"CMakeFiles/kmailprivate.dir/kmmainwin.o"
"CMakeFiles/kmailprivate.dir/configuredialog.o"
"CMakeFiles/kmailprivate.dir/configuredialog_p.o"
"CMakeFiles/kmailprivate.dir/simplestringlisteditor.o"
"CMakeFiles/kmailprivate.dir/identitylistview.o"
"CMakeFiles/kmailprivate.dir/identitydialog.o"
"CMakeFiles/kmailprivate.dir/kmfolderdialog.o"
"CMakeFiles/kmailprivate.dir/kmfoldertree.o"
"CMakeFiles/kmailprivate.dir/kmfoldercombobox.o"
"CMakeFiles/kmailprivate.dir/foldertreebase.o"
"CMakeFiles/kmailprivate.dir/favoritefolderview.o"
"CMakeFiles/kmailprivate.dir/kmaccount.o"
"CMakeFiles/kmailprivate.dir/kmheaders.o"
"CMakeFiles/kmailprivate.dir/headeritem.o"
"CMakeFiles/kmailprivate.dir/listjob.o"
"CMakeFiles/kmailprivate.dir/kmcomposewin.o"
"CMakeFiles/kmailprivate.dir/kmfolder.o"
"CMakeFiles/kmailprivate.dir/kmmsgpartdlg.o"
"CMakeFiles/kmailprivate.dir/kmreaderwin.o"
"CMakeFiles/kmailprivate.dir/htmlstatusbar.o"
"CMakeFiles/kmailprivate.dir/kmmsgdict.o"
"CMakeFiles/kmailprivate.dir/kmgroupware.o"
"CMakeFiles/kmailprivate.dir/folderstorage.o"
"CMakeFiles/kmailprivate.dir/csshelper.o"
"CMakeFiles/kmailprivate.dir/actionscheduler.o"
"CMakeFiles/kmailprivate.dir/messageproperty.o"
"CMakeFiles/kmailprivate.dir/kmmsgpart.o"
"CMakeFiles/kmailprivate.dir/kmmsginfo.o"
"CMakeFiles/kmailprivate.dir/accountmanager.o"
"CMakeFiles/kmailprivate.dir/kmacctfolder.o"
"CMakeFiles/kmailprivate.dir/kmdict.o"
"CMakeFiles/kmailprivate.dir/kmsystemtray.o"
"CMakeFiles/kmailprivate.dir/kmacctlocal.o"
"CMakeFiles/kmailprivate.dir/kmfolderdir.o"
"CMakeFiles/kmailprivate.dir/kmfoldermgr.o"
"CMakeFiles/kmailprivate.dir/kmfoldernode.o"
"CMakeFiles/kmailprivate.dir/kmsender.o"
"CMakeFiles/kmailprivate.dir/kmacctseldlg.o"
"CMakeFiles/kmailprivate.dir/kmfiltermgr.o"
"CMakeFiles/kmailprivate.dir/kmsearchpatternedit.o"
"CMakeFiles/kmailprivate.dir/kmfilteraction.o"
"CMakeFiles/kmailprivate.dir/kmsearchpattern.o"
"CMakeFiles/kmailprivate.dir/folderselectiondialog.o"
"CMakeFiles/kmailprivate.dir/kmfilter.o"
"CMakeFiles/kmailprivate.dir/kmfilterdlg.o"
"CMakeFiles/kmailprivate.dir/kmmsgbase.o"
"CMakeFiles/kmailprivate.dir/kmmsglist.o"
"CMakeFiles/kmailprivate.dir/kmaddrbook.o"
"CMakeFiles/kmailprivate.dir/signatureconfigurator.o"
"CMakeFiles/kmailprivate.dir/xfaceconfigurator.o"
"CMakeFiles/kmailprivate.dir/networkaccount.o"
"CMakeFiles/kmailprivate.dir/imapaccountbase.o"
"CMakeFiles/kmailprivate.dir/kmacctimap.o"
"CMakeFiles/kmailprivate.dir/kmacctcachedimap.o"
"CMakeFiles/kmailprivate.dir/kmfawidgets.o"
"CMakeFiles/kmailprivate.dir/kmfoldermbox.o"
"CMakeFiles/kmailprivate.dir/kmfolderimap.o"
"CMakeFiles/kmailprivate.dir/undostack.o"
"CMakeFiles/kmailprivate.dir/kmfoldercachedimap.o"
"CMakeFiles/kmailprivate.dir/kmfoldermaildir.o"
"CMakeFiles/kmailprivate.dir/popaccount.o"
"CMakeFiles/kmailprivate.dir/kmkernel.o"
"CMakeFiles/kmailprivate.dir/accountdialog.o"
"CMakeFiles/kmailprivate.dir/searchwindow.o"
"CMakeFiles/kmailprivate.dir/vcardviewer.o"
"CMakeFiles/kmailprivate.dir/vacationdialog.o"
"CMakeFiles/kmailprivate.dir/vacation.o"
"CMakeFiles/kmailprivate.dir/sievedebugdialog.o"
"CMakeFiles/kmailprivate.dir/sieveconfig.o"
"CMakeFiles/kmailprivate.dir/sievejob.o"
"CMakeFiles/kmailprivate.dir/kmpopheaders.o"
"CMakeFiles/kmailprivate.dir/kmpopfiltercnfrmdlg.o"
"CMakeFiles/kmailprivate.dir/kmmimeparttree.o"
"CMakeFiles/kmailprivate.dir/mailinglist-magic.o"
"CMakeFiles/kmailprivate.dir/kmacctmaildir.o"
"CMakeFiles/kmailprivate.dir/attachmentstrategy.o"
"CMakeFiles/kmailprivate.dir/headerstrategy.o"
"CMakeFiles/kmailprivate.dir/headerstyle.o"
"CMakeFiles/kmailprivate.dir/khtmlparthtmlwriter.o"
"CMakeFiles/kmailprivate.dir/filehtmlwriter.o"
"CMakeFiles/kmailprivate.dir/teehtmlwriter.o"
"CMakeFiles/kmailprivate.dir/objecttreeparser.o"
"CMakeFiles/kmailprivate.dir/attachmentcollector.o"
"CMakeFiles/kmailprivate.dir/bodypartformatter.o"
"CMakeFiles/kmailprivate.dir/bodypartformatterfactory.o"
"CMakeFiles/kmailprivate.dir/partNode.o"
"CMakeFiles/kmailprivate.dir/mailsourceviewer.o"
"CMakeFiles/kmailprivate.dir/kmcommands.o"
"CMakeFiles/kmailprivate.dir/kmreadermainwin.o"
"CMakeFiles/kmailprivate.dir/kmstartup.o"
"CMakeFiles/kmailprivate.dir/kmmainwidget.o"
"CMakeFiles/kmailprivate.dir/kmfolderindex.o"
"CMakeFiles/kmailprivate.dir/kmfoldersearch.o"
"CMakeFiles/kmailprivate.dir/folderjob.o"
"CMakeFiles/kmailprivate.dir/cachedimapjob.o"
"CMakeFiles/kmailprivate.dir/maildirjob.o"
"CMakeFiles/kmailprivate.dir/mboxjob.o"
"CMakeFiles/kmailprivate.dir/imapjob.o"
"CMakeFiles/kmailprivate.dir/subscriptiondialog.o"
"CMakeFiles/kmailprivate.dir/kmailicalifaceimpl.o"
"CMakeFiles/kmailprivate.dir/aboutdata.o"
"CMakeFiles/kmailprivate.dir/mailserviceimpl.o"
"CMakeFiles/kmailprivate.dir/attachmentlistview.o"
"CMakeFiles/kmailprivate.dir/kmcomposereditor.o"
"CMakeFiles/kmailprivate.dir/kmlineeditspell.o"
"CMakeFiles/kmailprivate.dir/kmatmlistview.o"
"CMakeFiles/kmailprivate.dir/composer.o"
"CMakeFiles/kmailprivate.dir/isubject.o"
"CMakeFiles/kmailprivate.dir/bodyvisitor.o"
"CMakeFiles/kmailprivate.dir/antispamwizard.o"
"CMakeFiles/kmailprivate.dir/urlhandlermanager.o"
"CMakeFiles/kmailprivate.dir/dictionarycombobox.o"
"CMakeFiles/kmailprivate.dir/secondarywindow.o"
"CMakeFiles/kmailprivate.dir/filterlog.o"
"CMakeFiles/kmailprivate.dir/filterlogdlg.o"
"CMakeFiles/kmailprivate.dir/messagecomposer.o"
"CMakeFiles/kmailprivate.dir/keyresolver.o"
"CMakeFiles/kmailprivate.dir/globalsettings.o"
"CMakeFiles/kmailprivate.dir/regexplineedit.o"
"CMakeFiles/kmailprivate.dir/rulewidgethandlermanager.o"
"CMakeFiles/kmailprivate.dir/headerlistquicksearch.o"
"CMakeFiles/kmailprivate.dir/acljobs.o"
"CMakeFiles/kmailprivate.dir/folderdialogacltab.o"
"CMakeFiles/kmailprivate.dir/partnodebodypart.o"
"CMakeFiles/kmailprivate.dir/expirejob.o"
"CMakeFiles/kmailprivate.dir/compactionjob.o"
"CMakeFiles/kmailprivate.dir/jobscheduler.o"
"CMakeFiles/kmailprivate.dir/callback.o"
"CMakeFiles/kmailprivate.dir/searchjob.o"
"CMakeFiles/kmailprivate.dir/renamejob.o"
"CMakeFiles/kmailprivate.dir/annotationjobs.o"
"CMakeFiles/kmailprivate.dir/accountcombobox.o"
"CMakeFiles/kmailprivate.dir/redirectdialog.o"
"CMakeFiles/kmailprivate.dir/foldershortcutdialog.o"
"CMakeFiles/kmailprivate.dir/folderrequester.o"
"CMakeFiles/kmailprivate.dir/spamheaderanalyzer.o"
"CMakeFiles/kmailprivate.dir/antispamconfig.o"
"CMakeFiles/kmailprivate.dir/recipientseditor.o"
"CMakeFiles/kmailprivate.dir/recipientspicker.o"
"CMakeFiles/kmailprivate.dir/kwindowpositioner.o"
"CMakeFiles/kmailprivate.dir/distributionlistdialog.o"
"CMakeFiles/kmailprivate.dir/expirypropertiesdialog.o"
"CMakeFiles/kmailprivate.dir/mailinglistpropertiesdialog.o"
"CMakeFiles/kmailprivate.dir/newfolderdialog.o"
"CMakeFiles/kmailprivate.dir/accountwizard.o"
"CMakeFiles/kmailprivate.dir/textsource.o"
"CMakeFiles/kmailprivate.dir/managesievescriptsdialog.o"
"CMakeFiles/kmailprivate.dir/chiasmuskeyselector.o"
"CMakeFiles/kmailprivate.dir/util.o"
"CMakeFiles/kmailprivate.dir/kmmessagetag.o"
"CMakeFiles/kmailprivate.dir/templateparser.o"
"CMakeFiles/kmailprivate.dir/templatesconfiguration.o"
"CMakeFiles/kmailprivate.dir/templatesinsertcommand.o"
"CMakeFiles/kmailprivate.dir/customtemplates.o"
"CMakeFiles/kmailprivate.dir/customtemplatesmenu.o"
"CMakeFiles/kmailprivate.dir/quotajobs.o"
"CMakeFiles/kmailprivate.dir/folderdialogquotatab.o"
"CMakeFiles/kmailprivate.dir/folderdialogquotatab_p.o"
"CMakeFiles/kmailprivate.dir/folderadaptor.o"
"CMakeFiles/kmailprivate.dir/copyfolderjob.o"
"CMakeFiles/kmailprivate.dir/messagecopyhelper.o"
"CMakeFiles/kmailprivate.dir/localsubscriptiondialog.o"
"CMakeFiles/kmailprivate.dir/groupwareadaptor.o"
"CMakeFiles/kmailprivate.dir/editorwatcher.o"
"CMakeFiles/kmailprivate.dir/scalix.o"
"CMakeFiles/kmailprivate.dir/kmailadaptor.o"
"CMakeFiles/kmailprivate.dir/mailcomposeradaptor.o"
"CMakeFiles/kmailprivate.dir/kmailinterface.o"
"CMakeFiles/kmailprivate.dir/mailcomposerinterface.o"
"CMakeFiles/kmailprivate.dir/calendarinterface.o"
"CMakeFiles/kmailprivate.dir/serviceadaptor.o"
"CMakeFiles/kmailprivate.dir/globalsettings_base.o"
"CMakeFiles/kmailprivate.dir/replyphrases.o"
"CMakeFiles/kmailprivate.dir/custommimeheader.o"
"CMakeFiles/kmailprivate.dir/templatesconfiguration_kfg.o"
"CMakeFiles/kmailprivate.dir/customtemplates_kfg.o"
-L/Users/ranger/cvs/kde-mac/compile.build/kdepim/lib -L/opt/kde4/lib
-L/opt/kde4-deps/lib -lkhtml -lthreadweaver -lkmime -lkpimidentities
-lphonon -lknotifyconfig -lktnef -lkutils -lmailtransport -lkimap
-lkleo -lmimelib -lksieve -lkpgp -lkdepim -F/opt/qt4/lib -framework
Qt3Support -lnepomuk -lqgpgme -lgpgme++-pthread -lgpgme-pthread
-lpthread -lgpg-error -lkdecore -lkdeui -lkparts -lkdecore -lkpty
-lkdecore -lkdeui -lkfile -F/opt/qt4/lib -framework QtDesigner
-lkdecore -lkdeui -lstreamanalyzer -lstreams -lkdecore -lsolid -lfam
-lkio -lkresources -lkabc -lkdecore -lkabc -lkresources -lkldap
-lkde3support -lkpimutils -lkcal -lkimproxy -lkio -lkdecore
-lkpimutils -lkdecore -lkdeui -lstreamanalyzer -lstreams -lkdecore
-lsolid -lfam -lkio -framework LDAP -lsasl2 -lkdecore -lkldap
-lkpimutils -lkdeui -lkdecore -lkdeui -F/opt/qt4/lib -framework QtSvg
-lstreamanalyzer -lstreams -lkdecore -F/opt/qt4/lib -framework
QtNetwork -lz -lbz2 -lintl -lresolv -framework Carbon -lsolid
-F/opt/qt4/lib -framework QtCore -lpthread -F/opt/qt4/lib -framework
QtDBus -F/opt/qt4/lib -framework QtXml -F/opt/qt4/lib -framework QtGui
-lfam -lkio -lkpimidentities
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool:
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: can't map file:
/Developer/SDKs/MacOSX10.4u.sdk/opt/kde4/lib/libkio.dylibcan't map
file: /Developer/SDKs/MacOSX10.4u.sdk/opt/kde4/lib/libkio.dylib
((os/kern) no space available)
 ((os/kern) no space available)
---(snip!)---

The cmake macro is this:

kdepim4_link_unique_libraries(kmailprivate ${KDE4_KHTML_LIBRARY}
${KDE4_THREADWEAVER_LIBRARY} ${KDE4_KMIME_LIBRARY}
${KDE4_KPIMIDENTITIES_LIBRARY} ${KDE4_PHONON_LIBRARY}
${KDE4_KNOTIFYCONFIG_LIBRARY} ${KDE4_KTNEF_LIBRARY}
${KDE4_KUTILS_LIBRARY} ${KDE4_MAILTRANSPORT_LIBRARY}
${KDE4_KIMAP_LIBRARY} kleo ${QGPGME_LIBRARY} mimelib ksieve kpgp
kdepim ${QT_QT3SUPPORT_LIBRARY})

You'll notice that basically everything is already using *_LIBRARY
instead of the normal _LIBRARIES stuff and it's still not enough.
There are a bunch of -lkdecore references, -lkdeui references, etc.

Is there any solution other than making a patch to deduplicate the
linker line at the cmake level? Right now kdepim is unlinkable on Mac
OS X, and it will only get worse if more dependencies are added.
(0010350)
Brad King   
2008-01-30 18:09   
Try CMake from CVS. It has a new cmComputeLinkDepends class that formalizes the library ordering as a graph problem. It may be able to produce a link line that has no duplicates.
(0025273)
David Cole   
2011-02-03 19:36   
Is this still an issue....?
(0028542)
Brad King   
2012-02-09 10:05   
As noted in 0004810:0010350 this issue was probably fixed by CMake 2.6 and nothing has been posted to the contrary in 4 years. Resolving as fixed.

Issue 0010179 describes a related but different problem.
(0029969)
David Cole   
2012-07-09 06:52   
Closing resolved issues that have not been updated in more than 4 months.