Skip to content

Building on windows with msys2 and mingw64 (WIP)

Regina Obe edited this page Apr 6, 2023 · 5 revisions
  1. Download msys2 from https://www.msys2.org/ and run the exe installer
  2. After installing, launch the mingw64.exe
  3. Run the following commands
pacman -Syu
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman --needed -S git mingw-w64-x86_64-cmake mingw-w64-x86_64-postgresql mingw-w64-x86_64-postgis
  1. Launch PostgreSQL
#now initialize postgresql cluster
initdb -D C:/temp/pgsql

# start the cluster
pg_ctl -D C:/temp/pgsql -l logfile start
  1. Connect to PostgreSQL and create test db
psql -d postgres #connect to postgres database
# in psql shell
SELECT version(); -- outputs the version 

CREATE DATABASE gisdb;
\c gisdb
CREATE EXTENSION postgis;
SELECT postgis_full_version();
exit
  1. Build pgtap - this is needed for testing
#back in shell
mkdir C:/projects
cd C:/projects
git clone https://github.com/theory/pgtap.git
cd pgtap
cpan CPAN::DistnameInfo
cpan TAP::Parser::SourceHandler::pgTAP
make
make installcheck
  1. Download and try to build pgrouting
# back in shell
mkdir C:/projects
cd C:/projects 
git clone https://github.com/pgRouting/pgRouting.git
cd pgRouting
cmake --version #returns cmake version 3.25.2

rm -rf build
mkdir build
cd build
cmake -G"Unix Makefiles" ..
cmake --build .
make install

pgTap tests

psql -c "CREATE DATABASE ___pgr___test___;" -d postgres
cd /c/projects/pgrouting
bash ./tools/testers/pg_prove_tests.sh
Clone this wiki locally