金子邦彦研究室インストールWindows の種々のソフトウェア(インストール)HDF5 1.10.5 のインストール(ソースコードを使用)(Windows 上)

HDF5 1.10.5 のインストール(ソースコードを使用)(Windows 上)

HDF5 は,階層データを扱うライブラリソフトウェア.

Windows で,HDF5 をソースコードからビルドして,インストールする手順を説明する. Build Tools for Visual Studio 2022(ビルドツール for Visual Studio 2022)を使用する. configure 版よりも CMake 版の方が Windows でのインストールが簡単だと判断している.

目次

HDF の利用条件などは、利用者が確認すること。次のWeb ページを活用してください

https://support.hdfgroup.org/products/licenses.html

下に書いているように,vcpkg を利用してインストールすることができる. 特に問題がない場合には vcpkg の利用してのインストールを検討しよう. vcpkg使わずにインストールする必要がある場合は,このページの手順によりインストールを行うことができる.

HDF5 のインストール(vcpkg を利用)(Windows 上)

  1. Git のインストール

    Windows での Git のインストール: 別ページ »で説明している.

  2. Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022)のインストール

    Windows での Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022) のインストール: 別ページ »で説明している.

  3. vckpg のインストール

    Windows で,コマンドプロンプト管理者として実行.

    次のコマンドを実行

    if not exist c:\vcpkg (
      cd c:\
      rmdir /s /q vcpkg
      git clone https://github.com/microsoft/vcpkg
      cd c:\vcpkg
      git pull
      .\bootstrap-vcpkg.bat
      .\vcpkg update
      .\vcpkg integrate install  
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"VCPKG_ROOT\", \"c:\vcpkg\", \"Machine\")"
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"VCPKG_DEFAULT_TRIPLET\", \"x64-windows\", \"Machine\")"
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"CMAKE_TOOLCHAIN_FILE\", \"c:/vcpkg/scripts/buildsystems/vcpkg.cmake\", \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"LIB\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\lib\"; [System.Environment]::SetEnvironmentVariable(\"LIB\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"INCLUDE\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\include\"; [System.Environment]::SetEnvironmentVariable(\"INCLUDE\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\vcpkg\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    )
    
  4. HDF5 のインストール

    次のコマンドを実行

    c:\vcpkg\vcpkg search hdf5
    c:\vcpkg\vcpkg install --triplet x64-windows hdf5[cpp,tools,utils,zlib] zlib
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"HDF5_ROOT\", \"C:\vcpkg\installed\x64-windows\", \"Machine\")"
    

前準備

Build Tools for Visual Studio 2017 (ビルドツール for Visual Studio 2017)もしくは Visual Studio 2017 のインストール(Windows 上)

Build Tools for Visual Studio 2017 (ビルドツール for Visual Studio 2017)もしくはVisual Studio 2017 を,前もってインストールしておく.NVIDIA CUDA の nvcc を機能させるため.

Build Tools for Visual Studio 2017 (ビルドツール for Visual Studio 2017) のインストール: 別ページ »で説明

Git のインストール(Windows 上)

Gitは,バージョン管理システム.ソースコードの管理や複数人での共同に役立つ.

サイト内の関連ページ

Windows での Git のインストール: 別ページ »で説明している.

関連する外部ページ

Git の公式ページ: https://git-scm.com/

CMake のインストール(Windows 上)

CMake はビルドツールである.

サイト内の関連ページ

Windows での cmake のインストール: 別ページ »で説明している.

関連する外部ページ

CMake の公式ダウンロードページ: https://cmake.org/download/

hdf5 のインストール(Build Tools for Visual Studio を利用)(Windows 上)

  1. hdf5 のバージョン確認

    https://support.hdfgroup.org/ftp/HDF5/current/src

  2. Visual Studio の x64 Native Tools コマンドプロンプトを開く.

    Windows のスタートメニューで「Visual Studio 2017」の下の「VS2017 用 x64 Native Tools コマンドプロンプト」で起動する.(あるいは類似のものを探す)

  3. hdf5 の作業ディレクトリとインストールディレクトリを削除する
    cd %HOMEPATH%
    rmdir /s /q CMake-hdf5-1.10.5
    

    [image]
  4. hdf5 のソースコードをダウンロード
    cd %HOMEPATH%
    del CMake-hdf5-1.10.5.zip
    curl -O https://support.hdfgroup.org/ftp/HDF5/current/src/CMake-hdf5-1.10.5.zip
    rmdir /s /q CMake-hdf5-1.10.5
    powershell Expand-Archive -DestinationPath . CMake-hdf5-1.10.5.zip
    

    [image]
  5. Windows で hdf5 を ソースコードからビルドし、インストールする

    https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMakeの記載に従う

    cmake の実行手順例は次の通り

    cd %HOMEPATH%
    cd CMake-hdf5-1.10.5
    ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764,INSTALL_DIR="C:/hdf5" -C Release -V -O hdf5.log
    
  6. 結果の確認

    次のような表示になる. 「100% tests passed. 0 tests failed out of 2681」のように表示される.

    なお Build Tools for Visual Studio 2017 よりも新しいバージョン (2019 や 2022)を使うと,エラーが出て,続行できないようである.

    [image]
  7. Windowsシステム環境変数 HDF5_ROOT の設定

    次のように設定する

    %HOMEPATH%\CMake-hdf5-1.10.5\hdf5-1.10.5

  8. Windowsシステム環境変数 LIB の設定

    次のように追加する

    %HOMEPATH%\CMake-hdf5-1.10.5\build\bin\Release