[vtkusers] Building VTK 5.0.2 on cygwin with '-mno-cygwin'

Klaus Nowikow klaus.nowikow at tuwien.ac.at
Wed Mar 14 07:46:53 EDT 2007


I am trying to build VTK 5.0.2 on cygwin using the '-mno-cygwin'
option.
Using cygwin's cmake didn't work, as was already stated in an older
message on this group. So I used CMake for Windows, yet the build
still failes. Let me explain what I already found out and what is
still failing (sorry for the long post):

These are the parameters I changed in CMake:
BUILD_SHARED_LIBS          ON
BUILD_TESTING              OFF
CMAKE_BUILD_TYPE           Release
CMAKE_CXX_FLAGS            -mno-cygwin
CMAKE_C_FLAGS              -mno-cygwin
CMAKE_EXE_LINKER_FLAGS     -mno-cygwin -mwindows
CMAKE_SHARED_LINKER_FLAGS  -Wl,--enable-stdcall-fixup
                              -Wl,--add-stdcall-alias
                              -Wl,--export-all-symbols
                              -mno-cygwin -mwindows
CMAKE_THREAD_LIBS          <empty>
CMAKE_USE_PTHREADS         OFF
CMAKE_USE_WIN32_THREADS    ON
OPENGL_INCLUDE_DIR         C:/cygwin/usr/include/w32api
OPENGL_gl_LIBRARY          C:/cygwin/lib/w32api/libopengl32.a
OPENGL_glu_LIBRARY         C:/cygwin/lib/w32api/libglu32.a
VTK_LEGACY_REMOVE          ON

Problem (1)
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/kwsys/ProcessUNIX.c:54:37:
sys/wait.h: No such file or directory
[snip lots of subsequent error messages].

Solution for (1) I found out that this error can be avoided when editing
the files
CMakeFiles/CMakeCCompiler.cmake and CMakeFiles/CMakeCXXCompiler.cmake:

--- /tmp/CMakeCCompiler.cmake	2007-03-14 09:22:13.484375000 +0100
+++ CMakeFiles/CMakeCCompiler.cmake	2007-03-14 11:27:28.328125000 +0100
@@ -8,7 +8,8 @@
  SET(CMAKE_COMPILER_IS_CYGWIN 1)
  IF(CMAKE_COMPILER_IS_CYGWIN)
    SET(CYGWIN 1)
-  SET(UNIX 1)
+  SET(UNIX 0)
+  SET(WIN32 1)
  ENDIF(CMAKE_COMPILER_IS_CYGWIN)

 > ENDIF(UNIX OR CYGWIN)

Problem (2)
In file included from 
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtkjpeg/jpeglib.h:27,
                  from c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtk_jpeg.h:35,
                  from 
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtktiff/tif_jpeg.c:52:
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtkjpeg/jmorecfg.h:247: error: 
conflicting types for 'boolean'
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/rpcndr.h:52: 
error: previous declaration of 'boolean' was here

Solution for (2)
After changing Utilities/vtkjpeg/jconfig.h this works:

--- /tmp/jconfig.h	2004-04-28 12:49:22.000000000 +0200
+++ ../VTK/Utilities/vtkjpeg/jconfig.h	2007-03-14 11:29:04.156250000 +0100
@@ -21,7 +21,7 @@
  #undef INCOMPLETE_TYPES_BROKEN


-#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
+#if defined(_WIN32)
  /* Define "boolean" as unsigned char, not int, per Windows custom */

Problem (3)
In file included from 
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtknetcdf/ncio.c:8:
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtknetcdf/posixio.c: In function 
`blksize':
c:/cygwin/src/vtk-5.0.2/VTK/Utilities/vtknetcdf/posixio.c:133: error: 
structure has no member named `st_blksize'
make[2]: *** [Utilities/vtknetcdf/CMakeFiles/vtkNetCDF.dir/ncio.obj] Error 1

In <sys/stat.h> I found that struct stat does contain a member
'st_blksize', but only if the symbol '__CYGWIN__' is defined
(in this case <cygwin/stat.h> is included). Here I am stuck.
I think that '__CYGWIN__' is defined because Problem (2) would not
hit otherwise. Adding '-D__CYGWIN__' to CMAKE_C_FLAGS and
CMAKE_CXX_FLAGS didn't help, either.

Any ideas how to fix that?

Kind regards,
Klaus




More information about the vtkusers mailing list