libtool is excessively copying objects to resolve name conflicts

313 views Asked by At

I often rebuild Midnight Commander and I've had enough staring at the make message:

copying selected object files to avoid basename conflicts...

so I've decided to fix it – i.e.: to make the names of objects unique – patch is attached. It renames things such as lib/util.c and src/util.c so that their basename is unique (lib/sub-util.c in this case, for subroutine library…).

However, this is not enough to make the message (and the >10 seconds pause) go away. I've added following snippet into mc/libtool at line 11122 to get the names of the objects that still conflict:

for obj in $oldobjs
do
  func_basename "$obj"
  $ECHO "$func_basename_result"
done | sort >/tmp/libtool-info.txt 2>&1

and it turned out that there are plenty of such files. It looks like if some internal static library has been linked twice. I cannot go further than this point. Could anyone help?

I've tried removing libmc.la from:

  • src/diffviewer/Makefile.am,
  • src/filemanager/Makefile.am,
  • src/viewer/Makefile.am,

the only places where it is (excessively, apparently) added to the linked libs but the effect is the same and the libtool-info.txt list doesn't change. Funny, isn't it?

Also, it looks like the main libmc.la reference is also not needed somehow, because changing:

mc_LDADD = \
    libinternal.la \
    $(top_builddir)/lib/libmc.la

to:

mc_LDADD = \
    libinternal.la

doesn't result in any build or runtime error. Funny again, isn't it?

From where do the duplicates come from? Has anyone some idea?

Update: After revisiting the patch everything worked correctly, i.e.: removing libmc.a from libviewer.a and libdiffviewer.a caused the copy stage to not appear!

0

There are 0 answers