Subject: libtool mis-orders MacOS X libraries w/-framework
To: None <>
From: John D. Baker <>
List: tech-pkg
Date: 12/13/2005 16:35:13
Revisiting pkg/29030, I think I see the root of the problem.  libtool is
putting the libraries in the wrong order.

Since MacOS X 'ld' is single-pass, library order is significant.  Apple's
own developer documentation, and the man page for 'ld' stipulate that
program objects must be specified first, followed by local libraries.
System libraries and Frameworks must be specified last.

See pkg/29030, particularly the followup I posted to it earlier today.
The Makefile for 'scanimage' specifies the -framework <Framework> directives
last, but for some reason, libtool is reordering them so that they come
ahead of the local static library 'liblib.a'.  This mis-ordering is what
ultimately results in link failure due to multiply defined symbols.

Manually running the link command as echoed results in the same error.
Re-issuing it with the -framework directives moved to the end of the
command line succeeds.

Can whoever is responsible for libtool add some logic to guarantee that
MacOS X -framework directives always come last?


John D. Baker, KN5UKS                    NetBSD     Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com                 OpenBSD            FreeBSD
BSD -- It just sits there and _works_!
GPG fingerprint:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645