Build trilinos in windows by visual studio

1. You need cmake installed in your computer.

2. You need msys installed in your computer.

3. Of course, visual studio also. The free express edition is OK.

4. You need BLAS and LAPACK compiler in you computer. I choose clapack beacuse it need no Fortran compiler which could be compiler by express edition of visual studio.

5. Optional: MPI ( MPICH2 or MS-MPI ) for parallel computation.
    And, HDF5, MUMPS、UMFPACK etc

6. Download Trilinos and  uncompress it.

7. Make a new dir in your Trilinos home, e.g. &(TRILINOS_HOME)\build

8. Write down a shell script in this new folder like below

#!/bin/sh

EXTRA_ARGS=&@
rm -r CMakeCache.txt CMakeFiles/

cmake \
-G "Visual Studio 11 Win64" \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D TPL_ENABLE_MPI:BOOL=ON \
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
-D Trilinos_ENABLE_AztecOO:BOOL=ON \
-D Trilinos_ENABLE_Amesos:BOOL=ON \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
-D Trilinos_ENABLE_FEI:BOOL=ON \
-D Trilinos_ENABLE_ML:BOOL=ON \
-D Trilinos_ENABLE_Stratimikos:BOOL=ON \
-D Trilinos_ENABLE_Fortran:BOOL=OFF \
-D TPL_ENABLE_BLAS:BOOL=ON \
-D TPL_ENABLE_LAPACK:BOOL=ON \
$EXTRA_ARGS \

${TRILINOS_HOME}

9. Just run it in msys, it will generate files neccesary for VS compiler.

10. Compile.

Compiler errors
1. Return type error in Teuchos_Array.hpp
2. std::insert not defined error in Teucho_array.hpp, Ifpack_ConfigDefs.hpp, MLAPI_MultiVector.h.
Just include <funtional> to resolve it.
3. Add the following line into file EpetraExt_ConfigDefs.h if you include both HDF5 and MPI. Otheriwise errors of H5Pset_fapl_mpio etc not defined exist.
#ifndef H5_HAVE_PARALLEL
#define H5_HAVE_PARALLEL
#endif
4. There exists many error in packages like anasazi, zoltan that is hard to resolve!

cygwin下unable to remap的对处方法

有关于fork()或dll加载的错误, 可通过执行rebaseall消除.过程如下(http://cygwin.wikia.com/wiki/Rebaseall)

1.  关闭所有cygwin程序
2. 进入cmd
3. 进入ash
4. 执行rebaseall

rebaseall似乎修正所有/bin/下dll的基地址. 对自装程序,可如

$ /bin/rebase -s -v /usr/local/lib/.../*.dll

用-s指定文件夹

Bugs in CMakeLists.txt of VTK

1. 将Utilities/MaterialLibray/CMakeLists.txt 第78_84行

IF (NOT "${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")
  # Ensure that the Source and Build dir are not same.
  # In that case we don't need to copy anything.
  COPY_FILES_TO_DIR(${MaterialLibrary_SOURCE_DIR}/Repository
    ${VTK_DEFAULT_SHADERS_DIR})
ENDIF (NOT "${VTK_BINARY_DIR}" MATCHES "^${VTK_SOURCE_DIR}$")

改写为
STRING(COMPARE EQUAL "${VTK_BINARY_DIR}" "${VTK_SOURCE_DIR}" INSOURCE)
IF (NOT INSOURCE)
  # Ensure that the Source and Build dir are not same.
  # In that case we don't need to copy anything.
  COPY_FILES_TO_DIR(${MaterialLibrary_SOURCE_DIR}/Repository
    ${VTK_DEFAULT_SHADERS_DIR})
ENDIF (NOT INSOURCE

2.  将Testing/Intsall/CMakeLists.txt内

if("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${VTK_BINARY_DIR}/InstallTest$")
  add_test(NAME Install
    COMMAND ${CMAKE_COMMAND} -DCONFIGURATION=$<CONFIGURATION>
                             -DVTK_BINARY_DIR=${VTK_BINARY_DIR}
                             -P ${CMAKE_CURRENT_SOURCE_DIR}/InstallTest.cmake
    )
endif()

改写为
STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${VTK_BINARY_DIR}/InstallTest" INSOURCE)
if(INSOURCE)
  add_test(NAME Install
    COMMAND ${CMAKE_COMMAND} -DCONFIGURATION=$<CONFIGURATION>
                             -DVTK_BINARY_DIR=${VTK_BINARY_DIR}
                             -P ${CMAKE_CURRENT_SOURCE_DIR}/InstallTest.cmake
    )
endif()

mingw64的安装方法

1. 下载ming-w64
     http://sourceforge.net/projects/mingw-w64/files/
     or x86_64-w64-mingw32-gcc-4.7.2-release-win32_rubenvb.7z from
     http://en.sourceforge.jp/projects/sfnet_mingw-w64/

2. 下载MSYS - mingw-w64
     http://sourceforge.net/apps/trac/mingw-w64/wiki/MSYS

3. 将ming-w64解压后移至/c/mingw64
     将MSYS解压后移至/c/msys

4. 双击 C:\msys\msys.bat
5.  在/c/msys下执行sh /postinstall/pi.sh, 或直接修改/c/msys/fsta如下
     c:/mingw64 mingw
  此时在msys环境下执行mount可确认mount状态.

6. 修改windows PATH路径设定或修改/c/msys/profile如下
   export PATH=".:/mingw/x86_64-w64-mingw32/lib:/mingw/libexec/gcc/x86_64-w64-mingw32/4.7.2:/mingw/x86_64-w64-mingw32/bin:/mingw/bin:/bin:$PATH"

7. 下载并安装其他工具,如gdb, make, pthread等
   ming-w64中没有find,可转用mingw32 msys中的find.

8. 编译工具为/ming64/bin下的 x86_64-w64-mingw32-gcc. 直接用gcc出错.


    


cygwin下mpich的编译

1. ./configure
2. 将PATH设定为最小
        C:\cygwin\usr\local\bin
        C:\cygwin\bin
否则回出现如
    sh 3220 child_info_fork::abort: can't commit memory for stack 0x28A000(90112), Win32 error
487
的错误.
3. make
4. make install

VS Code下cmake, c++编译,调试环境的构成步骤

1   下载必须extension      按[Ctrl+Shift+X]打开extension窗口,选择安装"C/C++", "CMake", "CMake Tools" 2   在VSCode下打开作业目录 ...