Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mrao.cam.ac.uk/~bn204/blog/2012/08/03/casa-compilation.html
Дата изменения: Mon Oct 5 13:04:45 2015
Дата индексирования: Sun Apr 10 12:58:40 2016
Кодировка: IBM-866

Поисковые слова: arp 220
Bojan Nikolic -- Compiling CASA revisited

Compiling CASA revisited

For some numerical experiments with CASA, I have recently been recompiling some parts of this package. Here are some notes on how to do this. The overall impression of this process was that the CMake build system is not as good as I expected, there do seem to be a large number of loose ends and the build process as a whole is very frustrating. That is before even touching the code!

Important notes

  1. I wrote these down while building r20489 of the CASA тАУ there seems to have been quite a number of changes recently in the build system and architecture and so very likely other revisions will need different adjustments to ones shown below

  2. I was only interested in doing some numerical analysis and did not at all check many features

Obtaining the code

I obtained the source from the subversion development directory (can be browsed here). I used the git-svn program to do this.

BUILDING CASACORE

I used the SCons build system to build the CASACORE libraries. I had initially tried the CMake system but besides being amazingly slow to start (it generates very large Makefiles) I could not CMake to correctly use WCSLib which is not in default location.

To use the SCons system I need following small adjustments:

  1. For the function vsnprintf to be used on my system it is necessary to include the stdio.h header and therefore the following patch needs to be applied:

     --- a/casacore/casa/BasicSL/String.cc
     +++ b/casacore/casa/BasicSL/String.cc
     @@ -30,6 +30,7 @@
      #include <casa/BasicSL/RegexBase.h>
      #include <algorithm>
      #include <stdarg.h>
     +#include <stdio.h>
      #include <casa/string.h>
      #include <casa/sstream.h>
    
  2. Apparently missing include for strlen:

    --- a/code/display/Display/Options.cc
    +++ b/code/display/Display/Options.cc
    @@ -30,6 +30,7 @@
     #include <sys/stat.h>
     #include <iostream>
     #include <dirent.h>
    +#include <string.h>
        
     namespace casa {
         namespace viewer {
    
  3. To be able to install the casacore at a specified location it is necessary to adjust the prefix variable within the SCons script. I did that by directly editing the script, but an environment flag could easily be set up to do this too:

     --- a/casacore/SConstruct
     +++ b/casacore/SConstruct
     @@ -9,13 +9,17 @@
         
         
      env = Environment(ENV = { 'PATH' : os.environ[ 'PATH' ],
                               'HOME' : os.environ[ 'HOME' ]
                                },
                        tools = ["default", "casaoptions", "buildenv", "casa", 
      		  	   "utils", "assaytest", "installer", "dependencies"],
                        toolpath = ["scons-tools"],
                        casashrdir="scons-tools",
                        DATA_DIR=".",
     +                  prefix= "/home/bnikolic/d/p/casadirty"
                        )
      # keep a local sconsign database, rather than one in every directory
      env.SConsignFile()
    
  4. To find a non-system find installation of WCSLib it is necessary to adjust CPPPATH and LIBPATH variables as one would expect. Again, inserting this directly into the script one gets the whole patch which is:

     --- a/casacore/SConstruct
     +++ b/casacore/SConstruct
     @@ -9,13 +9,17 @@
         
         
      env = Environment(ENV = { 'PATH' : os.environ[ 'PATH' ],
     -                          'HOME' : os.environ[ 'HOME' ]
     +                          'HOME' : os.environ[ 'HOME' ],
                                },
                        tools = ["default", "casaoptions", "buildenv", "casa", 
      		  	   "utils", "assaytest", "installer", "dependencies"],
                        toolpath = ["scons-tools"],
                        casashrdir="scons-tools",
                        DATA_DIR=".",
     +                  CPPPATH= "/home/bnikolic/d/p/wcslib-4.14bin/include",
     +                  LIBPATH= "/home/bnikolic/d/p/wcslib-4.14bin/lib",
     +                  prefix= "/home/bnikolic/d/p/casadirty"
                        )
      # keep a local sconsign database, rather than one in every directory
      env.SConsignFile()
    

After these changes, a simple scons -j 4 command can be used to build the casacore libraries.

Building AATM

I used the version in the CASA repository. I rebuild the configure script by using autoreconf -i and then did standard ./configure --with-boost=<> and make && make install.

Building main CASA part of CASA

  1. Add libpng library dependency:

     --- a/code/CMakeLists.txt
     +++ b/code/CMakeLists.txt
     @@ -580,14 +580,14 @@
           if (APPLE) 
              set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined -Wl,error -framework AppKit" )
           else()
     -        set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined -Wl,error" )
     +        set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined -Wl,error -lpng"  )
           endif()
        endif()
        casa_find( PGPLOT
          VERSION 5.3.1
          PREFIX_HINTS ${PGPLOT_ROOT_DIR}
          INCLUDES cpgplot.h
    

    This sorts out the libraries but not unfortunately the executable which are built by default. These either need to be commented out and therefore not build, or the libpng added to them like:

     --- a/code/casaqt/CMakeLists.txt
     +++ b/code/casaqt/CMakeLists.txt
     @@ -326,3 +326,13 @@
         
      install( PROGRAMS apps/qcasabrowser/casabrowser DESTINATION bin )
      casa_add_assay( casaqt QtProgressMeter/test/tProgressMeter.cc )
     +
     +target_link_libraries (casafilecatalog -lpng)
     +target_link_libraries (casalogger -lpng)
     +target_link_libraries (casapictureviewer -lpng)
     +target_link_libraries (casaplotserver -lpng)
     +target_link_libraries (casaprogresstimer -lpng)
     +target_link_libraries (qcasabrowser -lpng)
     +target_link_libraries (qwtplottertest -lpng)
     +
     +
    
  2. Search for dbus/dbus-arch-deps.h in the /usr/lib/x86_64-linux-gnu directory too:

    --- a/code/CMakeLists.txt
    +++ b/code/CMakeLists.txt
    @@ -733,12 +733,13 @@
     # Form all possible DBus prefixes and use them as hints to casa_find()
     #
     set( dbus_prefix "" )
    -foreach( _p ${CMAKE_INSTALL_PREFIX} ${casa_packages}  /sw /opt/local /usr/local /opt /usr )
    +foreach( _p ${CMAKE_INSTALL_PREFIX} ${casa_packages}  /sw /opt/local /usr/local /opt /usr /usr/lib/x86_64-linux-gnu)
       foreach( _l lib lib64 )
         list( APPEND dbus_prefix ${_p}/dbus-1.0 )
         list( APPEND dbus_prefix ${_p}/${_l}/dbus-1.0 )
         list( APPEND dbus_prefix ${_p}/${_l}/qt-4.3.4/dbus )
         list( APPEND dbus_prefix ${_p}/${_l}/qt-4.3.4/dbus/${_l}/dbus-1.0 )
       endforeach()
     endforeach()
    
  3. Fix apparent bug in FindBoost.cmake: it should be -lpthread not just pthread

  4. Adjust qwt-qt4 library check to look for library version 5.2.2 and to use qwt-qt4 as the name of the library:

     @@ -837,19 +838,20 @@
         
      # QWT (requires Qt)
      casa_find( QWT
     -  VERSION 5.1.1
     +  VERSION 5.2.2
        INCLUDES qwt_global.h
        INCLUDES_SUFFIXES qwt qwt-qt4
        PREFIX_HINTS 
          ${QWT_ROOT_DIR}
          ${casa_packages}/qwt-5.2.0
          ${casa_packages}/qwt-5.2.1-svn
          ${casa_packages}/qwt-5.2.3-svn
     -  LIBS qwt
     +  LIBS qwt-qt4
        CPP_VERSION QWT_VERSION_STR
        DEPENDS QT4 )
    
  5. Disable svn look up revisions (doesnтАЩt work because IтАЩm using git-svn):

     --- a/code/install/casadef.cmake
     +++ b/code/install/casadef.cmake
     @@ -57,21 +57,21 @@
        )
         
      execute_process( COMMAND
     -  ${casadef_perl} -e "open(INFO, 'svn info ${casadef_source_dir}/VERSION |') ; while (<INFO>){ if ( s/^Last Changed Date:[^(]+\\s+//) { print; } }"
     +  ${casadef_perl} -e "open(INFO, 'echo 9999-99-99 |') ; while (<INFO>){ print;  }"
        COMMAND  sed "s/[()]//g"
        OUTPUT_VARIABLE TAGGEDTIME 
        OUTPUT_STRIP_TRAILING_WHITESPACE
        )
         
      execute_process( COMMAND
     -  ${casadef_perl} -e "open(INFO, 'svn info |') ; while (<INFO>){ if ( s/^Last Changed Rev:\\s+//) { print; } }"
     +  ${casadef_perl} -e "open(INFO, 'echo 9 |') ; while (<INFO>){ print;  }"
        WORKING_DIRECTORY ${casadef_source_dir}
        OUTPUT_VARIABLE SVNREVISION
        OUTPUT_STRIP_TRAILING_WHITESPACE
        )
         
      execute_process( COMMAND
     -  ${casadef_perl} -e "open(INFO, 'svn info |') ; while (<INFO>){ if ( s/^URL:\\s+//) { print; } }"
     +  ${casadef_perl} -e "open(INFO, 'echo xx |') ; while (<INFO>){ print;  }"
        WORKING_DIRECTORY ${casadef_source_dir}
        OUTPUT_VARIABLE SVNURL
        OUTPUT_STRIP_TRAILING_WHITESPACE
    
  6. Invoke CMake like:

     cmake -DBOOST_ROOT=<boost dire> -DWCSLIB_ROOT_DIR=<wcslibdir>
     -DCASACORE_ROOT_DIR=<casacoredir> -DATM_ROOT_DIR=<atm dir> . 
    
blog comments powered by Disqus