[cairo-bugs] [Bug 13554] weak_import attribute and -no-undefined libtool option are incompatible (unresolved symbol on tiger)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Dec 21 17:35:06 PST 2007


wiml at hhhh.org changed:

           What    |Removed                     |Added
                 CC|                            |wiml at hhhh.org

------- Comment #5 from wiml at hhhh.org  2007-12-21 17:35 PST -------
I think what we're seeing here is a subtle incompatibility between weak_import
symbols and two-level namespaces (the default on OSX). Apple's docs don't
really spell it out, but it appears that with two-level namespaces, weak
symbols must be bound to a particular dylib (or framework) at *link* time, even
if their specific address (or lack of address, for weak_imports) is not
determined until run time. As a result, you can't use weak_imports to deal with
symbols which aren't there when you're compiling the program but which might be
there when you're running it --- only for the opposite situation, for symbols
which are available when compiling but might be missing from the dylib when
running the program. From Apple's point of view, you're only expected to
compile on the most recent release which you intend to use features from.

A bunch of possible solutions:

1. Switch to flat namespaces instead of two-level namespaces, which would allow
the use of "-U _CGContextDrawTiledImage" when linking.

2. Use "-undefined dynamic_lookup" to, in effect, make all undefined symbols
weakly bound. This is what Brian Tarricone's patch does, but as he notes, it
prevents the linker from warning us about truly undefined symbols, which could
conceal real problems.

3. Look up the CGContextDrawTiledImage function by hand using the NSModule(3)
API and stash it in a function pointer. This is effectively what the linker is
doing for us if we were to use "-undefined dynamic_lookup", except only for the
one symbol we want it to. I've done this on other projects and it seems to work

4. Disable the use of CGContextDrawTiledImage() if compiling on 10.4 or
previous, even if running on 10.5 (but when compiling on 10.5+, still produce a
weak reference so the program can run on older versions). This is what Anders F
Björklund's patch does.

5. Use approach #3 when compiling on old systems, #4 on 10.5.

Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the cairo-bugs mailing list