[Insight-users] Solved {sort of} Compile problems - Red Hat Enterprise WS-3; cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory

Atwood, Robert C r.atwood at imperial.ac.uk
Tue Jul 6 07:27:25 EDT 2004


Completely updating and reinstalling the gcc seems to remove the
problem. 



Therefore it must have been a configuration problem with the new
installation of Red Hat Enterprise but fixed in the latest updates? 

I could not have  figured this out without your pointers to the Cmake
files, thanks! 

I am unsure whether I can look back after updating and find out what WAS
the problem exaclty, and I would actually rather go on and do what I was
planning to do with using ITK now that it is rebuilt.


One suggestion would be to somehow have Cmake distinguish between a real
error, and the expected error received in the case where std: is not
supported; but I am sure this is not so easy! 

I have had similar problems with other pre-make configuring systems
('autoconf' genereated scripts,for example) where an error from a test
program is used to determine some settings, but a different, unexpeccted
error occurred so the message from 'configure' was misleading -- eg. if
Xm.h was completely missing, the test for whether its version was (
Openmotif, or lesstif version equal or greater than [xxx.xx])  failed,
so the message said 'you need version [xxx.xx] or later of lesstif' even
though a compatible version of OpenMotif was installed (but not the
-devel.rpm)  

The quick solution in that case was to change the message so that it
said 'Either you are missing the header files for Xm.h , or the version
is too old...' 

Thanks

Robert





-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv at crd.ge.com] 
Sent: 02 July 2004 18:21
To: Atwood, Robert C
Cc: Insight-users (E-mail)
Subject: RE: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory


This is a bit strange.  The DICOM_NO_STD_NAMESPACE should have been
commented out for the compiler you are using.  This flag is set by
CMake.  From the Insight/Utilities/DICOMParser/CMakeLists.txt file

INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
SET(DICOM_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})

So, CMake should be testing whether the compiler has an std:: namespace 
or not.  One of your messages indicated that you were having problems 
installing CMake.  Does the TestForSTDNamespace.cmake module exist in 

${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake

Jim

-----Original Message-----
From: Atwood, Robert C [mailto:r.atwood at imperial.ac.uk]
Sent: Friday, July 02, 2004 12:17 PM
To: Miller, James V (Research)
Cc: Insight-users (E-mail)
Subject: RE: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory


Jim: 

Yes, here is the information (plus the command I used to echo it)

I can see that this differes from the same file on another system where
I have previously compiled the ITK (a while ago) ,ie. the
DICOM_NO_STD_NAMESPACE is not defined in the other system, it is
commented out. 


Thanks


Robert



sh-2.05b# cat DICOMCMakeConfig.h

#ifndef __DICOMCMakeConfig_h_
#define __DICOMCMakeConfig_h_

/* #undef DICOM_DLL */
/* #undef DICOM_STATIC */
#define DICOM_ANSI_STDLIB
#define DICOM_NO_STD_NAMESPACE

#define DICOMPARSER_NAMESPACE itkdicomparser
#endif

sh-2.05b#



-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv at crd.ge.com] 
Sent: 02 July 2004 16:39
To: Atwood, Robert C; Insight-users (E-mail)
Subject: RE: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory


Robert,

In your build tree, is there a file under Utilities/DICOMParser called
DICOMCMakeConfig.h?

Can you send us the contents of that file?

Jim	

-----Original Message-----
From: Atwood, Robert C [mailto:r.atwood at imperial.ac.uk]
Sent: Friday, July 02, 2004 10:57 AM
To: ITK Users (E-Mail)
Subject: RE: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory


Original message attatchemnts were too big for the list, here are just
the initial make output and only the cvs tags for the entries related to
DICOM 



-----Original Message-----
From: Atwood, Robert C 
Sent: 02 July 2004 14:48
To: 'Luis Ibanez'
Cc: ITK Users (E-Mail)
Subject: RE: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory


Example error message: 

Building object file DICOMFile.o...
In file included from
/sources/local/ITK_cvs/Utilities/DICOMParser/DICOMFile.cxx:29:
/sources/local/ITK_cvs/Utilities/DICOMParser/DICOMFile.h:51: error:
parse error
   before `&' token

(several more like this)



OKAY! OKAY! I am beginning to hate C++ already. Give me plain C! 

>You should *NEVER* use "using namespace std;"
I said it 'might' be solved this way... not that it 'should' be solved
this way :-). 

sh-2.05b# grep -r 'using namespace std' *
Code/Algorithms/itkGradientDifferenceImageToImageMetric.txx:using
namespace std;
Code/Common/itkWindowedSincInterpolateImageFunction.txx:using namespace
std; ... Someone uses this method...



The version of ITK, as I mentioned in the subject, was checked out via
anonymous CVS. This was originally done yesterday (July 1 2004) CVS
status results attatched for more detail. This was created with

cvs upd -C 
cvs status > itk_version.txt 

(so the examples are with TODAY's cvs July 2 2004 but there is no change
in the results)

I had some other problems to do with updating the previous checkout and
recompiling, I am not yet sure if it is a cmake issue or just me doing
something incorrect. However, ignoring this, I just checked out a whole
fresh tree which I called ITK_cvs, and created a fresh new build
directory which I called ITK_build

I used:

 
cd ITK_build
ccmake ../ITK_cvs

 BUILD_EXAMPLES                   ON
 BUILD_SHARED_LIBS                ON
 BUILD_TESTING                    ON
 CMAKE_BACKWARDS_COMPATIBILITY    2.0
 CMAKE_BUILD_TYPE                 Release
 CMAKE_INSTALL_PREFIX             /usr/local/encap/ITK-1.8.0.4

[c]
[g]
make >& make_output.txt
make clean
make -k >make_k_output.txt

(-k to 'keep going' after the error, to find more errors


These files, itk_version.txt, make_output.txt, and make_k_output.txt are
attatched and contain all the error messages Here is the first one,
there are many more.



Building object file DICOMFile.o...
In file included from
/sources/local/ITK_cvs/Utilities/DICOMParser/DICOMFile.cxx:29:
/sources/local/ITK_cvs/Utilities/DICOMParser/DICOMFile.h:51: error:
parse error
   before `&' token


The ccmake problem is that the process did not seem to honour a new
CMAKE_INSTALL_PREFIX set via ccmake, for an updated version; ie

ccmake 
...
CMAKE_INSTALL_PREFIX             /usr/local/encap/ITK-1.8.0.4
...
[c]
[g]
make 
make install

just installed into the last prefix I had set a while ago
(/usr/local/encap/ITK-1.8.0.2) Fortunately I still have the base
ITK-1.8.0  (I use 1.8 for cvs checkouts of the head revision that are
later than the 1.6, and .0.n for each time I check out from CVS and
recompile and install but this may not be consistent with your usage,
please see the itk_version.txt file for the cvs revision numbers of
specific files)   

Now I cannot tell if ccmake 2.0.2 does this or not because I have not
managed a successful build of ITK after upgrading the ccmake
 

Robert



-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: 01 July 2004 21:25
To: Atwood, Robert C
Cc: ITK Users (E-Mail)
Subject: Re: [Insight-users] Compile problems - Red Hat Enterprise WS-3;
cmake 2.0.2 ; ITK from CVS ; DICOM parser subdirectory




Hi Robert,

Please *NEVER* open namespaces !

That defeats the purpose of using namespaces.

You should *NEVER* use

         "using namespace std;"

or

         "using namespace itk;"


Please post the errors messages that you are getting.

If the compiler is complainng about "string", the real
solution is to specify its namespace like

                   std::string


instead of opening the namespace and exposing all the
symbols

In what version of ITK are you encountering this problem ?


Please let us know.


    Thanks


      Luis



-----------------------
Atwood, Robert C wrote:

> Dear ITK folks
> 
> I get several messages due to the compiler not recognizing the
> 'string' macro/datatype/whatever it is; this might be solved by 
> putting
> 
> using namespace std;
> 
> into the top of several files in the Utilities/DICOMParser .
> 
> 
> Here are some details (I tried  using ccmake 1.8 first, then upgraded
> to see if that was the problem)
> 
> sh-2.05b# ccmake --version
> ccmake version 2.0.2
> 
> sh-2.05b# rpm -q glibc
> glibc-2.3.2-95.20
> 
> sh-2.05b# rpm -q gcc
> gcc-3.2.3-24
> 
> 
> I seem to recall having this problem before, but I cannot remember if
> it was with this (ITK) or some other software package..I think it also

> has something to do with the level of gcc or glibc ?
> 
> Robert
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 




More information about the Insight-users mailing list