HOWTO: Static Ccaffeine Framework
The purpose of these instructions is to build a "static" CCA framework,
complete with pre-loaded "built-in" application components, using the Ccaffeine framework and your own application-specific CCA components. The only reason you would likely ever want to do this is if you are running on some HPC system (like the Cray XT or IBM BlueGene) which doesn't support "dynamic loading" of components as shared library objects, as is otherwise typically done for run-time loading of CCA components, or in the case where you are doing some other sort of software testing or analysis which requires the use of a statically linked executable. Otherwise, you probably don't need to do this. :-D But if you're one of those "lucky" souls, please read on... This process requires an initial bootstrapping stage: the user should build a "clean" (i.e. unmodified) version of the usual CCA tool chain, including Babel, a version of the CCA Specification, Ccaffeine and Bocca (if being used). You don't necessarily have to use any special version of this initial tool chain - it could be the contractor build, or from tar ball, subversion repositories, etc. Once the basic CCA Tools are built and installed on your system, then you must build your application-specific CCA components using these tools. If you are using Bocca, just do the normal project build and install, and you will produce everything you need. If you are _not_ using Bocca, then be sure to build "Static" versions of all your components (in other words, you must build libFoo.a instead of or in addition to libFoo.so... :-). Next, to build a Static Ccaffeine framework, you will need a copy of the latest and greatest version of the Ccaffeine source code, with all the necessary extensions for static building... So, (at least as of May 2009) this means using the subversion source repository, instead of any other "stable" tar balls or contractor builds. To obtain this latest version of the Ccaffeine framework, start by checking out the source from the new sourceforge repository: svn co https://cca-forum.svn.sourceforge.net/svnroot/cca-forum/ccafe/trunk/ccaffeine Now, to add your new static application components to a static Ccaffeine framewor build, you must modify the following 2 files: ccaffeine/cxx/dc/framework/BabelStaticFactory.cxx ccaffeine/cxx/Makefile.Static.in as follows. In cxx/dc/framework/BabelStaticFactory.cxx: For every static component to be included, add the following lines before the CREATEDEF() macro definition: #ifdef _CCAFE_PRELOAD #include "<bocca-project>/<namespace>_<Component>.hxx" . . . #endif For example: #ifdef _CCAFE_PRELOAD #include "sph-bocca/drivers_SPHDriver.hxx" #include "sph-bocca/erchm_ERSPChem.hxx" . . . #endif Then, add the following lines for every static component to be included after the CREATEDEF() macro definition: #ifdef _CCAFE_PRELOAD CREATEDEF(<namespace>::<Component>, <namespace>_<Component>) . . . #endif For example: #ifdef _CCAFE_PRELOAD CREATEDEF(drivers::SPHDriver, drivers_SPHDriver) CREATEDEF(erchm::ERSPChem, erchm_ERSPChem) . . . #endif Next, add the following lines for every static component to be included inside the BabelStaticFactory::addClasses() method: #ifdef _CCAFE_PRELOAD ADDCLASS("<namespace>.<Component>",create_<namespace>_<Component>); . . . #endif For example: #ifdef _CCAFE_PRELOAD ADDCLASS("drivers.SPHDriver", create_drivers_SPHDriver); ADDCLASS("erchm.ERSPChem", create_erchm_ERSPChem); . . . #endif In cxx/Makefile.Static.in: Modify the BABEL_PRELOAD_COMPONENTS define to include all the library flags needed for linking the static components; note that the *-cxx client and plain component client library flags for Ccaffeine are always required, and any language specific (e.g. *-f90) libraries for the component's implementation language are needed as well: BABEL_PRELOAD_COMPONENTS += -L/<path_to_project_install>/lib BABEL_PRELOAD_COMPONENTS += -l<namespace1>.<Component1>-cxx BABEL_PRELOAD_COMPONENTS += -l<namespace1>.<Component1>-f90 BABEL_PRELOAD_COMPONENTS += -l<namespace1>.<Component1> . . . For example: BABEL_PRELOAD_COMPONENTS += -L/scratch/scratchdirs/kohl/babel_scratch/install_sph_bocca/lib BABEL_PRELOAD_COMPONENTS += -ldrivers.SPHDriver-cxx -ldrivers.SPHDriver-f90 -ldrivers.SPHDriver BABEL_PRELOAD_COMPONENTS += -lerchm.ERSPChem-cxx -lerchm.ERSPChem-f90 -lerchm.ERSPChem And add the include path(s) for all of the static component header files: BABEL_PRELOAD_INCLUDES = -I/<path_to_project_install>/include For example: BABEL_PRELOAD_INCLUDES = -I/scratch/scratchdirs/kohl/babel_scratch/install_sph_bocca/include That should do it. Finally, build and install the framework with “make” and “make install.” The framework should work as expected, but now the component libraries are statically linked! Enjoy! :-D Created by: jeeembo last modification: Friday 01 of May, 2009 [19:41:41 UTC] by jeeembo |
Login Online users
19
online users
|