Building CCMTools as required by CASA

Download

The correct version of CCMTools is available as a tar ball at: http://www.mrao.cam.ac.uk/~bn204/nvc/20090929/ccmtools-0.5.5.tar.gz

Patching

The above source code is as-supplied by NRAO. I’ve found that there are a number of fixes which need to be applied to this code to get it to a compilable state (I’ve also had lots of useful input from [MatharAips2007]).

These patches are listed below in standard diff format

Non-dependent name lookup

Illegal code which was previously accepted by g++, see http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html

--- cpp-environment/ccm/CCM_Local/CCM_OCL/OclHelpers.h	2009-09-29 08:02:04.000000000 +0100
+++ cpp-environment-mod/ccm/CCM_Local/CCM_OCL/OclHelpers.h	2009-09-29 14:30:42.000000000 +0100
@@ -123,10 +123,10 @@
     OCL_Collection<T> excluding( const T& object ) const
     {
     	OCL_Collection<T> result;
-        const int s = size();
+        const int s = vector<T>::size();
     	for( int index=0; index<s; index++ )
     	{
-    		const T& element = operator[](index);
+    		const T& element = vector<T>::operator[](index);
     		if( element!=object )
     		{
     			result.push_back(element);
@@ -142,14 +142,14 @@
 
     bool operator==( const vector<T>& ref ) const
     {
-		if( size()!=ref.size() )
+		if( vector<T>::size()!=ref.size() )
 		{
 			return false;
 		}
-        const int s = size();
+        const int s = vector<T>::size();
 		for( int index=0; index<s; index++ )
 		{
-			if( !(operator[](index)==ref[index]) )
+			if( !(vector<T>::operator[](index)==ref[index]) )
 			{
 				return false;
 			}
@@ -159,12 +159,12 @@
 
     bool isUnique() const
     {
-        const int s = size();
+        const int s = vector<T>::size();
         for( int i=0; i<s; i++ )
         {
             for( int j=i+1; j<s; j++ )
             {
-                if( operator[](i) == operator[](j) )
+                if( vector<T>::operator[](i) == vector<T>::operator[](j) )
                 {
                     return false;
                 }
@@ -197,10 +197,10 @@
     OCL_Sequence<T> excluding( const T& object ) const
     {
     	OCL_Sequence<T> result;
-        const int s = size();
+        const int s = OCL_Collection<T>::size();
     	for( int index=0; index<s; index++ )
     	{
-    		const T& element = operator[](index);
+    		const T& element = OCL_Collection<T>::operator[](index);
     		if( element!=object )
     		{
     			result.push_back(element);
@@ -257,10 +257,10 @@
     OCL_Bag<T> excluding( const T& object ) const
     {
     	OCL_Bag<T> result;
-        const int s = size();
+        const int s = OCL_Collection<T>::size();
     	for( int index=0; index<s; index++ )
     	{
-    		const T& element = operator[](index);
+    		const T& element = OCL_Collection<T>::operator[](index);
     		if( element!=object )
     		{
     			result.push_back(element);
@@ -290,17 +290,17 @@
 
     bool operator==( const OCL_Bag<T>& ref ) const
     {
-        if( size()!=ref.size() )
+        if( OCL_Collection<T>::size()!=ref.size() )
         {
             return false;
         }
         bool result = true;
-        bool* markers = new bool[size()];
-        const int s = size();
+        bool* markers = new bool[OCL_Collection<T>::size()];
+        const int s = OCL_Collection<T>::size();
         memset(markers, false, s*sizeof(bool));
         for( int index1=0; index1<s; index1++ )
         {
-            const T& element = operator[](index1);
+            const T& element = OCL_Collection<T>::operator[](index1);
             bool found = false;
             for( int index2=0; index2<s; index2++ )
             {
@@ -353,10 +353,10 @@
     OCL_Set<T> excluding( const T& object ) const
     {
     	OCL_Set<T> result;
-        const int s = size();
+        const int s = OCL_Collection<T>::size();
     	for( int index=0; index<s; index++ )
     	{
-    		const T& element = operator[](index);
+    		const T& element = OCL_Collection<T>::operator[](index);
     		if( element!=object )
     		{
     			result.push_back(element);
@@ -389,11 +389,11 @@
 
     bool operator==( const OCL_Set<T>& ref ) const
     {
-        if( ref.size()!=size() )
+      if( ref.size()!=OCL_Collection<T>::size() )
         {
             return false;
         }
-        const int s = size();
+        const int s = OCL_Collection<T>::size();
         for( int index=0; index<s; index++ )
         {
         	if( !OCL_includes(*this,ref[index]) )
@@ -407,10 +407,10 @@
     OCL_Set<T> operator-( const OCL_Set<T>& ref ) const
     {
     	OCL_Set<T> result;
-        const int s = size();
+        const int s = OCL_Collection<T>::size();
     	for( int index=0; index<s; index++ )
     	{
-    		const T& element = operator[](index);
+    		const T& element = OCL_Collection<T>::operator[](index);
         	if( !OCL_includes(ref,element) )
         	{
         	    result.push_back(element);
@@ -471,7 +471,7 @@
     template<class R>
     void sortBy( vector<R>& ref )
     {
-        const int s = size();
+      const int s = OCL_Sequence<T>::size();
         if( s<2 )
         {
             return;
@@ -496,11 +496,11 @@
             if( !(ref[start1]<ref[end2]) )
             {
                 R h1 = ref[start1];
-                T h2 = operator[](start1);
+                T h2 = OCL_Sequence<T>::operator[](start1);
                 ref[start1] = ref[end2];
-                operator[](start1) = operator[](end2);
+                OCL_Sequence<T>::operator[](start1) = OCL_Sequence<T>::operator[](end2);
                 ref[end2] = h1;
-                operator[](end2) = h2;
+                OCL_Sequence<T>::operator[](end2) = h2;
             }
             return;
         }
@@ -514,13 +514,13 @@
             if( index1>end1 )
             {
                 buffer1[index3] = ref[index2];
-                buffer2[index3] = operator[](index2);
+                buffer2[index3] = OCL_Sequence<T>::operator[](index2);
                 index2++;
             }
             else if( index2>end2 )
             {
                 buffer1[index3] = ref[index1];
-                buffer2[index3] = operator[](index1);
+                buffer2[index3] = OCL_Sequence<T>::operator[](index1);
                 index1++;
             }
             else
@@ -528,13 +528,13 @@
                 if( ref[index1]<ref[index2] )
                 {
                     buffer1[index3] = ref[index1];
-                    buffer2[index3] = operator[](index1);
+                    buffer2[index3] = OCL_Sequence<T>::operator[](index1);
                     index1++;
                 }
                 else
                 {
                     buffer1[index3] = ref[index2];
-                    buffer2[index3] = operator[](index2);
+                    buffer2[index3] = OCL_Sequence<T>::operator[](index2);
                     index2++;
                 }
             }
@@ -543,7 +543,7 @@
         for( index3=0; index3<s; index3++ )
         {
             ref[start1] = buffer1[index3];
-            operator[](start1) = buffer2[index3];
+            OCL_Sequence<T>::operator[](start1) = buffer2[index3];
             start1++;
         }
     }

Namespace not closed

--- cpp-environment/ccm/CCM_Python/Py.h	2009-09-29 08:02:04.000000000 +0100
+++ cpp-environment-mod/ccm/CCM_Python/Py.h	2009-09-29 14:42:57.000000000 +0100
@@ -65,7 +65,7 @@
 	void *operator new( size_t );
 };
 
-}
+}// /namespace CCM Python
 
 #endif
 

Confix makefile errors

The two Makefile.py files should in fact be empty. The version as originally supplied fail to build due to “undefined symbol” errors.

--- cpp-environment/wx/Makefile.py	2009-09-29 08:02:04.000000000 +0100
+++ cpp-environment-mod/wx/Makefile.py	2009-09-29 13:54:42.000000000 +0100
@@ -1,2 +0,0 @@
-PACKAGE_NAME('wx')
-PACKAGE_VERSION('0.5.1-pre5')
\ No newline at end of file
--- cpp-environment/ccm/Makefile.py	2009-09-29 08:02:04.000000000 +0100
+++ cpp-environment-mod/ccm/Makefile.py	2009-09-29 14:09:04.000000000 +0100
@@ -1,2 +0,0 @@
-PACKAGE_NAME('ccm')
-PACKAGE_VERSION('0.5.1-pre5')

Building

The executable ccmtools produced by the build process does not correclty handle the installation path (i.e., the –prefix option) and the location in which it looks for the jar files is therefore incorrect. Patch:

--- ccmtools/bin/ccmtools	2009-09-29 08:02:03.000000000 +0100
+++ bin/ccmtools	2009-09-29 16:13:45.000000000 +0100
@@ -6,7 +6,7 @@
 CCMTOOLS_LIB="/usr/share/java/ccmtools"
 CCMTOOLS_HOME="/usr"
 else
-CCMTOOLS_LIB="$CCMTOOLS_HOME/lib"
+CCMTOOLS_LIB="$CCMTOOLS_HOME/share/java/ccmtools"
 fi
 
 JAVA_OPTIONS="-Xmx512M -Xms512M -Djava.library.path=/usr/lib:$LD_LIBRARY_PATH"

Xerces

Running ccmtools depends on the java version of the Xerces parser.

Depending on the precise installation of Xerces that you have, the file in which it is may be called xercesImpl.jar, xerces-j2.jar, or something different still. The correct full path and filename needs to be supplied in the environment variable CLASSPATH for ccmtools to operate correctly. This can be implemented by directly editing the contents of the ccmtools shell script and correcting the setting of the CLASSPATH variable.

Install locations

BasicTypes.h should, it seems, be installed in the CCM_Python sub-directory. I will check this during a future test build.

[MatharAips2007]Compilation and Installation of aips++ under FC6, Richard J. Mathar, http://www.strw.leidenuniv.nl/~mathar/progs/aips++_fc6.pdf