[Gmsh] 64bit build under windows

Serban.Georgescu at uk.fujitsu.com Serban.Georgescu at uk.fujitsu.com
Thu Sep 22 17:10:02 CEST 2011


Hi,

I need the 64bit version of Gmsh for basically the same reason, lack of memory. I have some pretty large meshes and 32bit is just not enough.

I don’t have documentation  … I just tried step by step until finally it compiled.
I’ll try to explain what I did and maybe in the process we can spot some problems … maybe I can actually get my build working correctly as well.

Step 1: 64bit OCC -------------------------------------

So, the 1st step was getting a 64bit OCC build. I built one myself from the OCC sources, but for some reason, although the build was successful, Gmsh crashed. So I finally downloaded OCE 0.3.0 already built from here: https://github.com/tpaviot/oce/wiki/Download

Step 2: 64bit BLAS  -------------------------------------
I don’t have a Fortran compiler for Windows, so I got CLapack 3.2.1 from here http://www.netlib.org/clapack/clapack-3.2.1-CMAKE.tgz and built it with VS2010. Had no problems.

Step 3: Hacking a bit the CMake script
So Gmsh kept looking for MKL and the Intel Fortran compiler, so I just hard-coded CLAPACK in the CMakeLists.txt you find in the root Gmsh directory.

So, my BLAS detection section now looks like the following (starting at line 189 in CMakeLists.txt):

if(ENABLE_BLAS_LAPACK)
  if(MSVC)
    # on Windows with Visual C++ try really hard to find blas/lapack
    # *without* requiring a Fortran compiler: 1) try to find the Intel
    # MKL libs using the standard search path; if not found 2) try to
    # get the reference blas/lapack libs (useful for users with no
    # Fortran compiler and no MKL license, who can just download our
    # precompiled "gmsh-dep" package)
    if(HAVE_64BIT_SIZE_T)
      set(MKL_PATH em64t/lib)
    else(HAVE_64BIT_SIZE_T)
      set(MKL_PATH ia32/lib)
    endif(HAVE_64BIT_SIZE_T)
        set(MKL_PATH "C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\lib\intel64")
    set(MKL_LIBS_REQUIRED libguide40 mkl_intel_c mkl_intel_thread mkl_core)
        MESSAGE(${MKL_PATH})
    find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED "" ${MKL_PATH})
    if(LAPACK_LIBRARIES)
      set_config_option(HAVE_BLAS "Blas(IntelMKL)")
      set_config_option(HAVE_LAPACK "Lapack(IntelMKL)")
    else(LAPACK_LIBRARIES)
      #set(REFLAPACK_LIBS_REQUIRED lapack blas g2c gcc)
      #find_all_libraries(LAPACK_LIBRARIES REFLAPACK_LIBS_REQUIRED "" "")
      #if(REFLAPACK_LIBS_REQUIRED)
      #  set_config_option(HAVE_BLAS "Blas(Ref)")
      #  set_config_option(HAVE_LAPACK "Lapack(Ref)")

          SET(LAPACK_LIBRARIES "C:\\Users\\SGeorgescu\\Programs\\clapack-3.2.1-CMAKE\\build64\\SRC\\Release\\lapack.lib"
                               "C:\\Users\\SGeorgescu\\Programs\\clapack-3.2.1-CMAKE\\build64\\BLAS\\SRC\\Release\\blas.lib"
                              "C:\\Users\\SGeorgescu\\Programs\\clapack-3.2.1-CMAKE\\build64\\F2CLIBS\\libf2c\\Release\\libf2c.lib")
          if(CLAPACK_LIBS_REQUIRED)
              set_config_option(HAVE_BLAS "Blas(cblas)")
              set_config_option(HAVE_LAPACK "Lapack(clapack)")
         endif(CLAPACK_LIBS_REQUIRED)
    endif(LAPACK_LIBRARIES)
  elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
…………………………

where “C:\\Users\\SGeorgescu\\Programs\\clapack-3.2.1-CMAKE\\build64” is the folder where I built CLAPACK.

I had to do the same for OCC, since CMake kept detecting my 32bit installation of OCC instead of the 64bit one …

So, instead of the cmake code you get starting from line 715, which is
  foreach(OCC ${OCC_LIBS_REQUIRED})
    find_library(OCC_LIB ${OCC} PATHS ENV CASROOT PATH_SUFFIXES lib
                 ${OCC_SYS_NAME}/lib ${OCC_SYS_NAME}/vc8/lib)
    if(OCC_LIB)
      list(APPEND OCC_LIBS ${OCC_LIB})
    else(OCC_LIB)
      message(STATUS "OCC lib " ${OCC} " not Found")
    endif(OCC_LIB)
    set(OCC_LIB OCC_LIB-NOTFOUND CACHE INTERNAL "")
    # unset(OCC_LIB CACHE) # cleaner, but only available in cmake >= 2.6.4
  endforeach(OCC)

now I have:

  foreach(OCC ${OCC_LIBS_REQUIRED})
    find_library(OCC_LIB ${OCC} PATHS ENV CASROOT PATH_SUFFIXES lib
                 ${OCC_SYS_NAME}/lib ${OCC_SYS_NAME}/vc8/lib)
    if(OCC_LIB)
           SET(OCC_LIB_W64 "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKSTEP.lib"
            "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKSTEP209.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKSTEPAttr.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKSTEPBase.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKIGES.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKXSBase.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKOffset.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKFeat.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKFillet.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKBool.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKShHealing.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKMesh.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKHLR.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKBO.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKPrim.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKTopAlgo.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKGeomAlgo.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKBRep.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKGeomBase.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKG3d.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKG2d.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKAdvTools.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKMath.lib"
                        "C:\\Users\\SGeorgescu\\Programs\\oce-0.3\\Win64\\lib/TKernel.lib")
      list(APPEND OCC_LIBS ${OCC_LIB})
    else(OCC_LIB)
      message(STATUS "OCC lib " ${OCC} " not Found")
    endif(OCC_LIB)
    set(OCC_LIB OCC_LIB-NOTFOUND CACHE INTERNAL "")
    # unset(OCC_LIB CACHE) # cleaner, but only available in cmake >= 2.6.4
  endforeach(OCC)

Step 4: Building Gmsh ………………………………..

After generating the 64bit VS2010 solution using the CMake GUI and the hacked CMakeLists.txt, I opened the gmsh.sln project and built it.
I think I did some small things here as well, but I don’t remember all of them know.
I can try to help you as problems appear.

I know the explanation is messy, still, hope it helps.

Cheers,
Serban

From: Sina haeri [mailto:sina_haery at yahoo.com]
Sent: Thursday, September 22, 2011 3:30 PM
To: Serban Georgescu
Subject: Re: [Gmsh] 64bit build under windows

Hi,

I tried to use both cygwin and mingw both of which failed,
I thought this would be the easier way to do it but it would be great if I could build it using VS2010
Do you have any docs for building it using vs2010?

What I need to do is to partition a large mesh which requires lots of memory, with 32 bit version the grid generation part has no problem, but when it gets to the partitioning the program crashes exactly when the memory usage reaches 2GB so I thought maybe a 64bit build might solve the problem.

your help is greatly appreciated.

Thank you


From: "Serban.Georgescu at uk.fujitsu.com" <Serban.Georgescu at uk.fujitsu.com>
To: sina_haery at yahoo.com
Cc: gmsh at geuz.org
Sent: Thursday, 22 September 2011, 15:15
Subject: RE: [Gmsh] 64bit build under windows

Hi Sina,

I have successfully compiled a 64bit version of Gmsh for Windows, however it seems to have problems.
I found cases where the 64bit Windows version gives some meshing errors when the 32bit version or the 64bit Linux version do not. I did not do a thorough investigation for the cause though, just stuck to the Linux version.

I see you are trying to build v2.5.0, my built is based on the SVN version.
I used VS2010 for compilation on Windows 7 – 64bit.

May I ask you how are trying to build Gmsh?
(GCC toolchain? VS?)

Cheers,
Serban

From: gmsh-bounces at ace20.montefiore.ulg.ac.be [mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] On Behalf Of Sina haeri
Sent: Thursday, September 22, 2011 3:01 PM
To: gmsh at geuz.org
Subject: [Gmsh] 64bit build under windows

Dear developers,

Is there any document on building a 64 bit version of gmsh under windows?
I tried to build using cygwin but when making I get these errors:


Scanning dependencies of target gmsh
[  0%] Building CXX object CMakeFiles/gmsh.dir/Common/Main.cpp.o
[  0%] Building CXX object CMakeFiles/gmsh.dir/Common/Gmsh.cpp.o
In file included from /C/Users/Administrator/Downloads/gmsh-2.5.0-source/Geo/GFa
ceCompound.h:14:0,
                 from /C/Users/Administrator/Downloads/gmsh-2.5.0-source/Mesh/me
shPartition.h:11,
                 from /C/Users/Administrator/Downloads/gmsh-2.5.0-source/Common/
Gmsh.cpp:25:
/C/Users/Administrator/Downloads/gmsh-2.5.0-source/Numeric/simpleFunction.h:33:1
4: error: expected unqualified-id before numeric constant
/C/Users/Administrator/Downloads/gmsh-2.5.0-source/Numeric/simpleFunction.h:33:1
4: error: expected ‘;’ before numeric constant
make[2]: *** [CMakeFiles/gmsh.dir/Common/Gmsh.cpp.o] Error 1
make[1]: *** [CMakeFiles/gmsh.dir/all] Error 2
make: *** [all] Error 2

Thank you

Sina

______________________________________________________________________



 Fujitsu Laboratories of Europe Limited

 Hayes Park Central, Hayes End Road, Hayes, Middlesex, UB4 8FE

 Registered No. 4153469



 This e-mail and any attachments are for the sole use of addressee(s) and

 may contain information which is privileged and confidential. Unauthorised

 use or copying for disclosure is strictly prohibited. The fact that this

 e-mail has been scanned by Trendmicro Interscan does not guarantee that

 it has not been intercepted or amended nor that it is virus-free.



______________________________________________________________________
                                        
 Fujitsu Laboratories of Europe Limited
 Hayes Park Central, Hayes End Road, Hayes, Middlesex, UB4 8FE
 Registered No. 4153469
 
 This e-mail and any attachments are for the sole use of addressee(s) and
 may contain information which is privileged and confidential. Unauthorised
 use or copying for disclosure is strictly prohibited. The fact that this
 e-mail has been scanned by Trendmicro Interscan does not guarantee that 
 it has not been intercepted or amended nor that it is virus-free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20110922/f9d7051c/attachment.html>