pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/32887: libtool mis-orders -framework directives building sane-backends on MacOS X



>Number:         32887
>Category:       pkg
>Synopsis:       libtool mis-orders -framework directives building 
>sane-backends on MacOS X
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 20 23:50:00 +0000 2006
>Originator:     John D. Baker
>Release:        MacOS X 10.4.5
>Organization:
>Environment:
Darwin ed.local 8.5.0 Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 
2006; root:xnu-792.6.61.obj~1/RELEASE_PPC Power Macintosh powerpc

>Description:
Building graphics/sane-backends fails linking the 'scanimage'
program because libtool re-orders -framework directives to the
beginning of list of objects and libraries instead of leaving
them at the end:

[...]
gcc -pipe -o .libs/scanimage scanimage.o stiff.o -framework CoreFoundation 
-framework IOKit  
-L/Volumes/NetBSD/pkgsrc/graphics/sane-backends/work/.buildlink/lib 
../lib/liblib.a ../backend/.libs/libsane.dylib 
/Volumes/NetBSD/pkgsrc/graphics/sane-backends/work/.buildlink/lib/libusb.dylib 
-lpthread -lm 
/Volumes/NetBSD/pkgsrc/graphics/sane-backends/work/.buildlink/lib/libjpeg.dylib
/usr/bin/ld: multiple definitions of symbol _getopt
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(getopt.So) 
definition of _getopt
../lib/liblib.a(getopt.o) definition of _getopt in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _opterr
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(getopt.So) 
definition of _opterr
../lib/liblib.a(getopt.o) definition of _opterr in section (__DATA,__data)
/usr/bin/ld: multiple definitions of symbol _optind
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(getopt.So) 
definition of _optind
../lib/liblib.a(getopt.o) definition of _optind in section (__DATA,__data)
/usr/bin/ld: multiple definitions of symbol _optopt
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(getopt.So) 
definition of _optopt
../lib/liblib.a(getopt.o) definition of _optopt in section (__DATA,__data)
collect2: ld returned 1 exit status
gnumake[1]: *** [scanimage] Error 1
gnumake: *** [all-recursive] Error 1
*** Error code 2

Stop.
bmake: stopped in /usr/pkgsrc/graphics/sane-backends
[...]


Notice the -framework directives coming _before_ the reference to
local library "liblib.a".  The original command in the Makefile is:

scanimage: $(SCAN_OBJS) $(LIBSANE) $(LIBLIB)
        @$(LIBTOOL) $(MLINK) $(LINK) $(SCAN_OBJS) $(LIBLIB) $(LIBSANE)  $(LIBS)

where $(LIBS) is further defined as:

LIBS = -lusb  -lpthread -lm  -framework CoreFoundation -framework IOKit -ljpeg

Clearly, the -framework directives come after (most) of the other
libraries and objects, as they should, but the resulting command
line (at the top) has them moved up ahead of nearly everything else.

The documentation for Apple's 'ld' clearly states that -framework
directives should be last.
>How-To-Repeat:
On MacOS X 10.x.x:

cd .../graphics/sane-backends
bmake


>Fix:
Wish I knew.  This is libtool magic that needs adjusting.
See also PR pkg/29030.  The problem persists on all versions
of MacOS X, but seems only to be fatal to sane-backends and
xsane.  If the library order can be fixed, the (possibly wrong)
workaround in pkg/29030 can be eliminated.




Home | Main Index | Thread Index | Old Index