Option A · Automated Script (recommended)
Download and run the setup script — it handles all four steps automatically.
📄 Download setup-hdf5.shbash setup-hdf5.sh
An optional install prefix can be passed as the first argument (default: $HOME/tools/hdf5-1.8.23).
Or follow Option B below to run each step manually.
Option B · Manual Steps
This guide walks through installing dependencies, building HDF5 from source, and compiling the loadmatrix_geno program step by step.
0 Install Required Software
Update package lists and install bcftools and the C++ build tools:
sudo apt update sudo apt install -y bcftools build-essential
1 Obtain HDF5
Download the HDF5 1.8.23 source package from the HDF Group:
https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.23/src/hdf5-1.8.23.tar.gz
Or download directly from the terminal:
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.23/src/hdf5-1.8.23.tar.gz
2 Extract and Navigate
Extract the archive and change into the source directory:
tar -xzvf hdf5-1.8.23.tar.gz cd hdf5-1.8.23
3 Configure and Build HDF5
Run the standard build sequence. This may take several minutes:
./configure make make install
The library will be installed under hdf5-1.8.23/hdf5/ by default. Note the path to the lib/ and include/ subdirectories — you will need them in the next step.
4 Compile Roven's Program
Download the source file
Download loadmatrix_SNP-annot.cpp and place it in your working directory:
Create the build script
Create a file named build.sh with the following content. Change the lib variable to match the directory where you installed the HDF5 library on your system (e.g., /home/yourname/Tools/hdf5-1.8.23/hdf5/lib):
#!/bin/bash main=/home/riza/Tools/hdf5-1.8.23 lib=$main/hdf5/lib include=$main/hdf5/include header=$include export PATH=$main/hdf5/bin:$PATH export LD_RUN_PATH=$lib export LDFLAGS="-L$lib" export CPPFLAGS="-I$include" g++ -Wno-narrowing -o loadmatrix_geno -I $header loadmatrix_SNP-annot.cpp -lhdf5 -L$lib
lib variable to match the directory where you installed the HDF5 library on your system.
Make executable and run
chmod u+x build.sh ./build.sh
Verify the build
Run the compiled program to confirm it built successfully. It should display usage parameters and an error indicating it requires arguments — this is expected:
./loadmatrix_geno