Subject: Re: pkg/29030
To: None <,,>
From: John D. Baker <>
List: pkgsrc-bugs
Date: 12/13/2005 21:50:02
The following reply was made to PR pkg/29030; it has been noted by GNATS.

From: "John D. Baker" <>
Subject: Re: pkg/29030
Date: Tue, 13 Dec 2005 15:47:17 -0600 (CST)

 After some experimentation, I believe I have determined is the root of
 the issue with the multiply-defined symbols.  'libtool' is constructing
 a command line with the libraries in the wrong order.
 MacOS X 'ld' is a single-pass linker.  As such, program object modules,
 local libraries (static or dynamic) should be specified first, and system
 libraries and frameworks should be specified last.  This is documented in
 Apple's Developer Documentation for Mac OS X and the 'ld' man page on
 MacOS X systems.
 The command line used to link 'scanimage' is of the form:
     gcc -pipe -o .libs/scanimage scanimage.o stiff.o -framework CoreServices \
       -framework IOKit -L <path to sane-backends local library> \
       ../lib/liblib.a <...>
 'liblib.a' contains local implementations of variables and functions about
 which the linker is complaining.  The error occurs because the library is
 specified AFTER the -framework directives, which satisifies the references
 from the system libraries.  When it then encounters 'liblib.a', it finds
 multiple definitions of the symbols.
 If the -framework directives are moved to the end of the command line,
 linking proceeds without error as the locally-defined symbols satisfy
 the references before the system libraries are searched, as is appropriate.
 So, this PR is not a problem with graphics/sane-backends per se, but a
 problem with libtool's behavior/implementation when used on MacOS X.
 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