WebObjects 3.5.1: Using Solaris Frameworks

Under Solaris, frameworks are a simple wrapper around standard shared libraries. Apple uses the Solaris dlopen(3x) call to load in frameworks. This document explains in more detail how to work with frameworks under Solaris. This article assumes that you are using WebObjects 3.5.1.
How Solaris Shared Libraries Work

Shared libraries are given a name during link time (see ld and the -h flag). This name can either be a path (a string with a '/') or a simple name (a string without a '/'). If the library is linked with a path then that path is the only place that the library will be searched for, no run time flags can be given to make Solaris look elsewhere. If the library is linked with a simple name then several directories are searched, starting with any directory named in the LD_LIBRARY_PATH env variable, any directory specified with the -R flag when linking the WOF app and then /usr/lib.

Default Framework Behavior in WOF 3.5.1

The default behavior in WOF 3.5.1 is to link frameworks with a hardcoded path name of:

/XXX.framework/Versions/YYY/XXX

where XXX is the framework name and YYY is the framework version. Since the framework was linked with a fully defined path name the only place that it can be installed is in the root directory.

How to Modify the Default Behavior

The shared library's name can be changed with the INSTALL_NAME_DIRECTIVE of Makefile.postamble. The format of this directive is as follows

INSTALL_NAME_DIRECTIVE = -install_name XXXX

where XXXX is the name that gets added to the -h flag. During development of your app you should set the INSTALL_NAME_DIRECTIVE to a blank string. This will cause the framework to get link in with a path that is hardcoded to whatever place the framework will be after it is linked in. This makes it easy to test out your executables without having to worry about where your frameworks should go after building.

If you know exactly where you want to install your frameworks and are not worried about moving them in the future just set the INSTALL_NAME_DIRECTIVE to a hardcoded path name. For example if you want to install version A of the DATA framework in the /opt /Frameworks directory set the directive as follows

INSTALL_NAME_DIRECTIVE = -install_name /opt/Frameworks/DATA.framework/Versions/A/DATA

If you want total freedom over where to install your frameworks you can set the INSTALL_NAME_DIRECTIVE to be a simple name. For example with the DATA framework set the directive as follows

INSTALL_NAME_DIRECTIVE = -install_name DATA

Before you run your WOF app you need to define the LD_LIBRARY_PATH env variable to the location of the framework

setenv LD_LIBRARY_PATH /opt/Frameworks/DATA.framework/Versions/A/

or you can add the following to the Makefile.preamble of your main WOF app

OTHER_LDFLAGS = -R /opt/Frameworks/DATA.framework/Versions/A

Another solution would be to provide the INSTALL_NAME_DIRECTIVE a relative path to your frameworks. For example if you are going to install the DATA framework in the same directory as the main WOF app you can set the INSTALL_NAME_DIRECTIVE as follows

INSTALL_NAME_DIRECTIVE = -install_name DATA.framework/Versions/A/DATA

Published Date: Feb 18, 2012