Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Tools >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

'dynamic shared library not made a weak library in output with MACOSX_DEPLOYMENT_TARGET...' bug


Q: Why does 'ld' give me a warning about my MACOSX_DEPLOYMENT_TARGET environment variable and failing to weak link when I try to build?

A: When building in Project Builder using the December 2002 Mac OS X Developer Tools, you may get the following warning:

ld: warning dynamic shared library:

/path/to/a/library/or/framework/that/you/link/against not made a weak library in output with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1

This is most likely due to bug #3094497, which should be fixed in the next major release of the Mac OS X Developer Tools. Here is what is happening: the framework or library (call it library A) listed by ld is linked by your application, but you use no symbols directly from it. Another framework or library (call it library B) that you link against and use DOES use symbols from library A. The linker gets confused, and tries to weak link library A, when it should instead be linking it strongly. Since by default the MACOSX_DEPLOYMENT_TARGET environment variable (which controls binary features introduced in specific OS versions) is set to 10.1, and weak linking was introduced in 10.2, the warning is generated.

Here are two suggested workarounds in the meantime:

1) If you do not mind weak linking against library A and do not mind requiring Mac OS X 10.2 or higher to run, you can set the MACOSX_DEPLOYMENT_TARGET to 10.2 in a target build setting in Project Builder. Note that after doing this, if you are using cpp-precomp precompiled header technology (instead of newer precompiled header technology like the PFE) you may see lots of warnings about your precompiled headers being broken. To fix this, you need to rebuild your precompiled headers like so from Terminal:

setenv MACOSX_DEPLOYMENT_TARGET 10.2

sudo fixPrecomps -force

2) If you do in fact need to continue building for Mac OS X 10.1 and higher, or don't wish to start weak linking against library A, then you can make a gratuitous reference to a symbol in the library to get the linker to strongly link against it.


[Apr 01, 2003]