Jan Kratochvil
Projects Products GIT Resume Contact
Projects
UNIX UNIX-devel Web Amiga MS-Windows MS-DOS Patches

 

GNU Libtool fix: Handle duplicate object file names

Patch fixes linking of convenience libraries (.a) containing two conflicting name objects.


 

When you include convenience library (.a) containing two conflicting name objects (same basename from two different directories) only one of those two object files will survive in ".libs/libA.lax/" arena:

	rm -fr .libs/libA.lax/libB.a
	mkdir .libs/libA.lax/libB.a
	(cd .libs/libA.lax/libB.a && ar x /abs/path/to/A/B/.libs/libB.a)

The patch implements automatic renaming of "*.*" to "*-$seqnum.*" in such case:

	libtool: link: warning: object name conflicts; renaming object files
	libtool: link: warning: to ensure that they will not overwrite
	(cd .libs/libA.lax/libB.a && ar xN 1 /abs/path/to/A/B/.libs/libB.a 'XconflictX.o' && mv -f 'XconflictX.o' 'XconflictX-1.o')
	(cd .libs/libA.lax/libB.a && ar xN 2 /abs/path/to/A/B/.libs/libB.a 'XconflictX.o' && mv -f 'XconflictX.o' 'XconflictX-2.o')

Although renaming to a new name may be confusing IMO there is no better option. The original (conflicting) name is not left there in any instance to prevent misleading confusion of different object file found than expected.

 


EOF