1.前提条件:

CentOS Linux release 7.2.1511 (Core) X64

postgresql-9.6.1 源码安装

postgis-2.3.0 源码安装

修改环境变量文件

vi /etc/profile

export LD_LIBRARY_PATH=/opt/pgsql/9.6.1/lib:/usr/local/lib:/usr/local/lib64

export PATH=/opt/pgsql/9.6.1/bin:$PATH

export MANPATH=/opt/pgsql/9.6.1/share/man:$MANPATH

2.boost

http://jaist.dl.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz

# tar zxvf boost_1_54_0.tar.gz 

# cd boost_1_54_0

# ./bootstrap.sh 

Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2

Detecting Python version... 2.7

Detecting Python root... /usr

Unicode/ICU support for Boost.Regex?... not found.

Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2

    

To adjust configuration, edit 'project-config.jam'.

Further information:

   - Command line help:

     ./b2 --help

     

   - Getting started guide: 

     http://www.boost.org/more/getting_started/unix-variants.html

     

   - Boost.Build documentation:

     http://www.boost.org/build/doc/html/index.html

# ./b2

......

......

然后就是漫长的等待,如果最后出现:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/soft/boost_1_54_0

The following directory should be added to linker library paths:

    /home/soft/boost_1_54_0/stage/lib

# ./b2 install

3.cmake

https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz

# ./configure 

# make

......

......

[100%] Linking C executable pseudo_tidy

[100%] Built target pseudo_tidy

Scanning dependencies of target foo

[100%] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o

[100%] Linking CXX static library libfoo.a

[100%] Built target foo

# make install

......

......

- Installing: /usr/local/share/cmake-3.7/editors/emacs/cmake-mode.el

-- Installing: /usr/local/share/aclocal/cmake.m4

-- Installing: /usr/local/share/cmake-3.7/completions/cmake

-- Installing: /usr/local/share/cmake-3.7/completions/cpack

-- Installing: /usr/local/share/cmake-3.7/completions/ctest

4.GMP

https://gmplib.org/download/gmp/gmp-6.1.1.tar.bz2

sys packets

m4-1.4.16-10.el7.x86_64.rpm

# tar jxvf gmp-6.1.1.tar.bz2

# ./configure

# make

# make install

5.mpfr

http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.gz

# ./configure

# make

# make install

6.CGAL

https://github.com/CGAL/cgal/archive/releases/CGAL-4.9.tar.gz

# tar zxvf cgal-releases-CGAL-4.9.tar.gz

# cmake .

== CMake setup ==

-- The CXX compiler identification is GNU 4.8.5

-- The C compiler identification is GNU 4.8.5

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

== CMake setup (DONE) ==

== Setting paths ==

-- Build CGAL from n/a-branch: n/a

-- Removed not-a-package: .gitattributes;.gitignore;.travis.yml;CMakeFiles;Documentation;INSTALL.md;LICENSE.md;Miscellany;README.md

-- Installation package directory: /home/soft/pgrouting/cgal-releases-CGAL-4.9/Installation

-- Maintenance package directory: /home/soft/pgrouting/cgal-releases-CGAL-4.9/Maintenance

-- Core package directory: /home/soft/pgrouting/cgal-releases-CGAL-4.9/Core

-- Packagenames: AABB_tree;Advancing_front_surface_reconstruction;Algebraic_foundations;Algebraic_kernel_d;Algebraic_kernel_for_circles;Algebraic_kernel_for_spheres;Alpha_shapes_2;Alpha_shapes_3;Apollonius_graph_2;Arithmetic_kernel;Arrangement_on_surface_2;BGL;Barycentric_coordinates_2;Boolean_set_operations_2;Bounding_volumes;Box_intersection_d;CGAL_Core;CGAL_ImageIO;CGAL_ipelets;Cartesian_kernel;Circular_kernel_2;Circular_kernel_3;Circulator;Combinatorial_map;Cone_spanners_2;Conic_2;Convex_decomposition_3;Convex_hull_2;Convex_hull_3;Convex_hull_d;Distance_2;Distance_3;Envelope_2;Envelope_3;Filtered_kernel;Generator;Geomview;GraphicsView;HalfedgeDS;Hash_map;Homogeneous_kernel;Inscribed_areas;Installation;Interpolation;Intersections_2;Intersections_3;Interval_skip_list;Interval_support;Inventor;Jet_fitting_3;Kernel_23;Kernel_d;Kinetic_data_structures;Kinetic_framework;LEDA;Linear_cell_complex;MacOSX;Maintenance;Matrix_search;Mesh_2;Mesh_3;Minkowski_sum_2;Minkowski_sum_3;Modifier;Modular_arithmetic;Nef_2;Nef_3;Nef_S2;NewKernel_d;Number_types;OpenNL;Operations_on_polyhedra;Optimal_transportation_reconstruction_2;Optimisation_basic;Partition_2;Periodic_2_triangulation_2;Periodic_3_triangulation_3;Point_set_2;Point_set_processing_3;Point_set_shape_detection_3;Poisson_surface_reconstruction_3;Polygon;Polygon_mesh_processing;Polyhedron;Polyhedron_IO;Polyline_simplification_2;Polynomial;Polytope_distance_d;Principal_component_analysis;Profiling_tools;Property_map;QP_solver;Random_numbers;Ridges_3;STL_Extension;Scale_space_reconstruction_3;Scripts;SearchStructures;Segment_Delaunay_graph_2;Segment_Delaunay_graph_Linf_2;Skin_surface_3;Snap_rounding_2;Solver_interface;Spatial_searching;Spatial_sorting;Straight_skeleton_2;Stream_lines_2;Stream_support;Subdivision_method_3;Surface_mesh;Surface_mesh_deformation;Surface_mesh_parameterization;Surface_mesh_segmentation;Surface_mesh_shortest_path;Surface_mesh_simplification;Surface_mesh_skeletonization;Surface_mesher;Sweep_line_2;TDS_2;TDS_3;Testsuite;Three;Triangulation;Triangulation_2;Triangulation_3;Union_find;Visibility_2;Voronoi_diagram_2;wininst

== Setting paths (DONE) ==

== Generate version files ==

-- CGAL_VERSION is 4.9-I-900

-- CGAL_VERSION_NR is 1040900900

-- CGAL_GIT_HASH is 

-- CGAL_CREATED_SVN_REVISION is n/a (dummy)

-- CGAL_MAJOR_VERSION=4

-- CGAL_MINOR_VERSION=9

-- CGAL_BUGFIX_VERSION=0

-- CGAL_BUILD_VERSION=900

-- CGAL_SONAME_VERSION=12

-- CGAL_SOVERSION     =12.0.0

-- CGAL_REFERENCE_CACHE_DIR=

-- Building shared libraries

-- Targetting Unix Makefiles

-- Using /usr/bin/c++ compiler.

-- USING CMake version: 3.7.0

-- System: Linux

-- USING GCC_VERSION = '4.8.5 20150623 (Red Hat 4.8.5-4)'

-- Using gcc version 4 or later. Adding -frounding-math

== Generate version files (DONE) ==

== Set up flags ==

-- Build type: Release

-- USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'

-- USING LDFLAGS = ' '

== Set up flags (DONE) ==

== Detect external libraries ==

-- External libraries supported: GMP;GMPXX;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE

-- Preconfiguring library: GMP ...

-- Found GMP: /usr/local/lib/libgmp.so  

-- GMP has been preconfigured:

--   UseGMP-file:      

--   GMP include:      /usr/local/include

--   GMP libraries:    /usr/local/lib/libgmp.so

--   GMP definitions:  

-- USING GMP_VERSION = '6.1.1'

-- Preconfiguring library: MPFR ...

-- Found MPFR: /usr/local/lib/libmpfr.so  

-- MPFR has been preconfigured:

--   UseMPFR-file:      

--   MPFR include:      /usr/local/include

--   MPFR libraries:    /usr/local/lib/libmpfr.so

--   MPFR definitions:  

-- USING MPFR_VERSION = '3.1.5'

-- Looking for pthread.h

-- Looking for pthread.h - found

-- Looking for pthread_create

-- Looking for pthread_create - not found

-- Looking for pthread_create in pthreads

-- Looking for pthread_create in pthreads - not found

-- Looking for pthread_create in pthread

-- Looking for pthread_create in pthread - found

-- Found Threads: TRUE  

-- Boost version: 1.54.0

-- Found the following Boost libraries:

--   thread

--   system

--   chrono

--   date_time

--   atomic

-- Boost include:     /usr/local/include

-- Boost libraries:   /usr/local/lib/libboost_thread.so;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_chrono.so;/usr/local/lib/libboost_date_time.so;/usr/local/lib/libboost_atomic.so

-- Boost definitions: 

-- USING BOOST_VERSION = '1.54.0'

== Detect external libraries (DONE) ==

== Write compiler_config.h ==

-- Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success

-- Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success

-- Performing Test CGAL_CFG_IEEE_754_BUG - Success

-- Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success

-- Performing Test CGAL_CFG_MATCHING_BUG_5 - Success

-- Performing Test CGAL_CFG_MATCHING_BUG_6 - Success

-- Performing Test CGAL_CFG_MATCHING_BUG_7 - Success

-- Performing Test CGAL_CFG_MATCHING_BUG_8 - Success

-- Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success

-- Performing Test CGAL_CFG_NO_LIMITS - Success

-- Performing Test CGAL_CFG_NO_NEXTAFTER - Success

-- Performing Test CGAL_CFG_NO_STL - Success

-- Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success

-- Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success

-- Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success

-- Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success

-- Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success

== Write compiler_config.h (DONE) ==

== Generating build files ==

Configuring libCGAL

-- Requested component: MPFR

-- Requested component: GMP

libCGAL is configured

-- Sources for CGAL component library 'CGAL_Core' detected

Configuring libCGAL_Core

-- Requested component: MPFR

-- Requested component: GMP

libCGAL_Core is configured

-- Sources for CGAL component library 'CGAL_ImageIO' detected

Configuring libCGAL_ImageIO

-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") 

-- USING ZLIB_VERSION = '1.2.7'

-- Requested component: MPFR

-- Requested component: GMP

libCGAL_ImageIO is configured

-- Sources for CGAL component library 'CGAL_Qt5' detected

Configuring libCGAL_Qt5

-- libCGAL_Qt5 is missing the dependencies: Qt5OpenGL Qt5Svg Qt5 OpenGL cannot be configured.

-- Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt5' detected

== Generating build files (DONE) ==

-- Configuring done

-- Generating done

-- Build files have been written to: /home/soft/pgrouting/cgal-releases-CGAL-4.9

# make

# make install

7.pg_routing

# rpm -ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpm

https://github.com/pgRouting/pgrouting/archive/pgrouting-2.3.0.tar.gz

# tar zxvf pgrouting-2.3.0.tar.gz 

# mv pgrouting-pgrouting-2.3.0 pgrouting-2.3.0

# mkdir build

# cd build

# cmake .

-- CMAKE_BUILD_TYPE 

Running as: Debug

-- CMAKE_BUILD_TYPE Release

-- The C compiler identification is GNU 4.8.5

-- The CXX compiler identification is GNU 4.8.5

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- DOXYGEN_MINIMUM_VERSION=1.8.6

-- SPHINX_MINIMUM_VERSION=1.1

-- Performing Test COMPILER_SUPPORTS_CXX0X

-- Performing Test COMPILER_SUPPORTS_CXX0X - Success

-- COMPILER_SUPPORTS_CXX0X= 1

-- CMAKE_CXX_COMPILER= /usr/bin/c++

-- CMAKE_VERSION: 3.7.0

-- PGROUTING_BUILD_STRING: pgrouting-2.3.0-3977-8c86efd master

-- PGROUTING_GIT_TAG: pgrouting-2.3.0

-- PGROUTING_GIT_BUILD: 2.3.0

-- PGROUTING_GIT_HASH: 8c86efd

-- PGROUTING_GIT_BRANCH: master

-- PGROUTING_VERSION_REVISION_NAME: 8c86efd master

-- PGROUTING_SOURCE_DIR: /home/soft/pgrouting/pgrouting-2.3.0

-- CMAKE_BINARY_DIR: /home/soft/pgrouting/pgrouting-2.3.0

-- PGROUTING_VERSION_REVISION_HASH: 8c86efd

-- POSTGRESQL_BIN: 

-- Found Perl: /usr/bin/perl (found version "5.16.3") 

-- POSTGRESQL_PG_CONFIG is /opt/pgsql/9.6.1/bin/pg_config

-- POSTGRESQL_EXECUTABLE is /opt/pgsql/9.6.1/bin/postgres

-- POSTGRESQL_VERSION_STRING in FindPostgreSQL.cmake is PostgreSQL 9.6.1

-- POSTGRESQL_INCLUDE_DIR: /opt/pgsql/9.6.1/include/server

-- POSTGRESQL_LIBRARIES: /opt/pgsql/9.6.1/lib

-- Boost version: 1.54.0

-- Boost headers were found here: /usr/local/include

-- Looking for pthread.h

-- Looking for pthread.h - found

-- Looking for pthread_create

-- Looking for pthread_create - not found

-- Looking for pthread_create in pthreads

-- Looking for pthread_create in pthreads - not found

-- Looking for pthread_create in pthread

-- Looking for pthread_create in pthread - found

-- Found Threads: TRUE  

-- Boost version: 1.54.0

-- Found the following Boost libraries:

--   thread

--   chrono

--   system

--   date_time

--   atomic

CMake Warning (dev) at /usr/local/share/cmake-3.7/Modules/FindBoost.cmake:1519 (if):

  Policy CMP0054 is not set: Only interpret if() arguments as variables or

  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy

  details.  Use the cmake_policy command to set the policy and suppress this

  warning.

  Quoted variables like "thread" will no longer be dereferenced when the

  policy is set to NEW.  Since the policy is not set the OLD behavior will be

  used.

Call Stack (most recent call first):

  cmake/FindCGAL.cmake:42 (find_package)

  CMakeLists.txt:274 (find_package)

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/share/cmake-3.7/Modules/FindBoost.cmake:1561 (if):

  Policy CMP0054 is not set: Only interpret if() arguments as variables or

  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy

  details.  Use the cmake_policy command to set the policy and suppress this

  warning.

  Quoted variables like "thread" will no longer be dereferenced when the

  policy is set to NEW.  Since the policy is not set the OLD behavior will be

  used.

Call Stack (most recent call first):

  cmake/FindCGAL.cmake:42 (find_package)

  CMakeLists.txt:274 (find_package)

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Boost version: 1.54.0

-- Found the following Boost libraries:

--   thread

--   system

--   chrono

--   date_time

--   atomic

-- CGAL_INCLUDE_DIR=/usr/local/include

-- CGAL_LIBRARIES=/usr/local/lib64/libCGAL.so

-- BOOST_THREAD_LIBRARIES=/usr/local/lib/libboost_thread.so;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_chrono.so;/usr/local/lib/libboost_date_time.so;/usr/local/lib/libboost_atomic.so

-- GMP_LIBRARIES=/usr/local/lib/libgmp.so

-- Found CGAL: /usr/local/include, /usr/local/lib64/libCGAL.so, /usr/local/lib/libboost_thread.so;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_chrono.so;/usr/local/lib/libboost_date_time.so;/usr/local/lib/libboost_atomic.so, /usr/local/lib/libgmp.so

-- POSTGRESQL_VERSION_STRING is PostgreSQL 9.6.1

-- POSTGRESQL_VERSION is 9.6.1

-- PGSQL_VERSION is 96

-- Install directory for libraries is set to /opt/pgsql/9.6.1/lib

-- Extension directory for SQL files is set to /opt/pgsql/9.6.1/share/extension

-- PGROUTING_INCLUDE_DIRECTORIES = /home/soft/pgrouting/pgrouting-2.3.0/src/common/src;/home/soft/pgrouting/pgrouting-2.3.0/src/dijkstra/src

-- POSTGRESQL_INCLUDE_DIR = /opt/pgsql/9.6.1/include/server

-- Boost_INCLUDE_DIRS = /usr/local/include

-- dir='/opt/pgsql/9.6.1/include/server'

-- dir='/usr/local/include'

-- dir='/home/soft/pgrouting/pgrouting-2.3.0/src/common/src'

-- dir='/home/soft/pgrouting/pgrouting-2.3.0/src/dijkstra/src'

-- dir='/opt/pgsql/9.6.1/include/server'

-- dir='/usr/local/include'

-- dir='/usr/local/include'

-- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH

-- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH - Success

-- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH

-- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH - Success

-- CMAKE_CXX_FLAGS_DEBUG= -g -Wall -O1 -fno-implicit-inline-templates -Wconversion -pedantic -fmax-errors=10 -Wunused -Wuninitialized -Wextra

-- CMAKE_CXX_FLAGS_RELEASE= -O3 -DNDEBUG

-- CMAKE_CXX_FLAGS=  -std=c++0x -frounding-math -fPIC 

-- CMAKE_C_FLAGS_DEBUG= -g  -Wall -Wconversion -pedantic -fmax-errors=10  -Wmissing-prototypes

-- CMAKE_C_FLAGS_RELEASE= -O3 -DNDEBUG

-- CMAKE_C_FLAGS=  -DPGSQL_VERSION=96  -std=gnu99  -frounding-math -fPIC 

-- UNIX=1

-- WIN32=

-- MSVC=

Building the library names

-- Created /home/soft/pgrouting/pgrouting-2.3.0/lib/pgrouting--2.3.0.sql

-- Created /home/soft/pgrouting/pgrouting-2.3.0/lib/pgrouting.control

-- Creating lib/pgrouting--2.3.0.sig

-- LIBS_TO_INSTALL=

-- Configuring done

-- Generating done

-- Build files have been written to: /home/soft/pgrouting/pgrouting-2.3.0

#

# make

......

......

Scanning dependencies of target pickDeliver

[ 86%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/node.cpp.o

[ 87%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/tw_node.cpp.o

[ 88%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/vehicle_node.cpp.o

[ 89%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/order.cpp.o

[ 90%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/vehicle.cpp.o

[ 90%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/vehicle_pickDeliver.cpp.o

[ 91%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/solution.cpp.o

[ 92%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/initial_solution.cpp.o

[ 93%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/optimize.cpp.o

[ 94%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/pgr_pickDeliver.cpp.o

[ 95%] Building CXX object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/pickDeliver_driver.cpp.o

[ 96%] Building C object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/customers_input.c.o

[ 97%] Building C object src/pickDeliver/src/CMakeFiles/pickDeliver.dir/pickDeliver.c.o

[ 97%] Built target pickDeliver

Scanning dependencies of target vrp_basic

[ 98%] Building C object src/vrp_basic/src/CMakeFiles/vrp_basic.dir/VRP.c.o

[ 99%] Building CXX object src/vrp_basic/src/CMakeFiles/vrp_basic.dir/VRP_core.cpp.o

[ 99%] Building CXX object src/vrp_basic/src/CMakeFiles/vrp_basic.dir/VRP_Solver.cpp.o

[ 99%] Built target vrp_basic

Scanning dependencies of target pgrouting-2.3

[100%] Linking CXX shared library lib/libpgrouting-2.3.so

[100%] Built target pgrouting-2.3

#

# make install

......

......

[ 99%] Built target vrp_basic

[100%] Built target pgrouting-2.3

Install the project...

-- Install configuration: "Release"

-- Installing: /opt/pgsql/9.6.1/lib/libpgrouting-2.3.so

-- Set runtime path of "/opt/pgsql/9.6.1/lib/libpgrouting-2.3.so" to ""

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting.control

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.0.0--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.0.1--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.1.0--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.2.0--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.2.1--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.2.2--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.2.3--2.3.0.sql

-- Installing: /opt/pgsql/9.6.1/share/extension/pgrouting--2.2.4--2.3.0.sql

8.expat

http://101.96.8.138/downloads.sourceforge.net/project/expat/expat/2.2.0/expat-2.2.0.tar.bz2?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fexpat%2Ffiles%2Fexpat%2F2.2.0%2F&ts=1479373462&use_mirror=jaist

# tar -xjf expat-2.2.0.tar.bz2 

# ./configure

# make

...

...

libtool: link: gcc -shared  -fPIC -DPIC  lib/.libs/xmlparse.o lib/.libs/xmltok.o lib/.libs/xmlrole.o    -g -O2   -Wl,-soname -Wl,libexpat.so.1 -o .libs/libexpat.so.1.6.2

libtool: link: (cd ".libs" && rm -f "libexpat.so.1" && ln -s "libexpat.so.1.6.2" "libexpat.so.1")

libtool: link: (cd ".libs" && rm -f "libexpat.so" && ln -s "libexpat.so.1.6.2" "libexpat.so")

libtool: link: ar cru .libs/libexpat.a  lib/xmlparse.o lib/xmltok.o lib/xmlrole.o

libtool: link: ranlib .libs/libexpat.a

libtool: link: creating libexpat.la

libtool: link: ( cd ".libs" && rm -f "libexpat.la" && ln -s "../libexpat.la" "libexpat.la" )

gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlwf.o -c xmlwf/xmlwf.c

gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlfile.o -c xmlwf/xmlfile.c

gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/codepage.o -c xmlwf/codepage.c

gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/unixfilemap.o -c xmlwf/unixfilemap.c

/bin/sh ./libtool --verbose --mode=link gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H  -o xmlwf/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/unixfilemap.o libexpat.la

libtool: link: gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -o xmlwf/.libs/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/unixfilemap.o  ./.libs/libexpat.so -Wl,-rpath -Wl,/usr/local/lib

libtool: link: creating xmlwf/xmlwf

#

# make install

......

......

----------------------------------------------------------------------

Libraries have been installed in:

   /usr/local/lib

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the '-LLIBDIR'

flag during linking and do at least one of the following:

   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable

     during execution

   - add LIBDIR to the 'LD_RUN_PATH' environment variable

     during linking

   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag

   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

for FN in ./lib/expat.h ./lib/expat_external.h expat_config.h ; do /usr/bin/install -c -m 644 $FN /usr/local/include ; done

/usr/bin/install -c -m 644 expat.pc /usr/local/lib/pkgconfig/expat.pc

/bin/sh ./conftools/mkinstalldirs /usr/local/bin /usr/local/share/man/man1

/bin/sh ./libtool --mode=install /usr/bin/install -c xmlwf/xmlwf /usr/local/bin/xmlwf

libtool: install: /usr/bin/install -c xmlwf/.libs/xmlwf /usr/local/bin/xmlwf

/usr/bin/install -c -m 644 ./doc/xmlwf.1 /usr/local/share/man/man1

9.osm2pgrouting

# unzip osm2pgrouting-master.zip

# cd osm2pgrouting-master

# cmake -DPOSTGRESQL_LIBRARIES=/opt/pgsql/9.6.1/lib/libpq.so -DBoost_LIBRARIES=/usr/local/lib -H. -Bbuild

-- The C compiler identification is GNU 4.8.5

-- The CXX compiler identification is GNU 4.8.5

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- POSTGRESQL_PG_CONFIG is /opt/pgsql/9.6.1/bin/pg_config

-- POSTGRESQL_INCLUDE_DIR: /opt/pgsql/9.6.1/include

-- POSTGRESQL_LIBRARIES: /opt/pgsql/9.6.1/lib/libpq.so

-- Found EXPAT: /usr/local/lib/libexpat.so (found version "2.2.0") 

-- Boost version: 1.54.0

-- Boost headers were found here: /usr/local/include

-- Boost version: 1.54.0

-- Found the following Boost libraries:

--   program_options

-- POSTGRESQL_INCLUDE_DIR: /opt/pgsql/9.6.1/include

-- EXPAT_INCLUDE_DIRS: /usr/local/include

-- Boost_INCLUDE_DIRS: /usr/local/include

-- POSTGRESQL_LIBRARIES: /opt/pgsql/9.6.1/lib/libpq.so

-- Boost_LIBRARIES: 

-- Configuring done

-- Generating done

-- Build files have been written to: /home/soft/pgrouting/osm2pgrouting-master/build

# cd build/

# make

Scanning dependencies of target osm2pgrouting

[  6%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Class.cpp.o

[ 12%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Configuration.cpp.o

[ 18%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/ConfigurationParserCallback.cpp.o

[ 25%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Export2DB.cpp.o

[ 31%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Node.cpp.o

[ 37%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/OSMDocument.cpp.o

[ 43%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/OSMDocumentParserCallback.cpp.o

[ 50%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Relation.cpp.o

[ 56%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Type.cpp.o

[ 62%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/Way.cpp.o

[ 68%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/XMLParser.cpp.o

[ 75%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/osm2pgrouting.cpp.o

[ 81%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/osm_element.cpp.o

[ 87%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/osm_tag.cpp.o

[ 93%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/prog_options.cpp.o

[100%] Linking CXX executable osm2pgrouting

[100%] Built target osm2pgrouting

# make install

[100%] Built target osm2pgrouting

Install the project...

-- Install configuration: ""

-- Installing: /usr/bin/osm2pgrouting

-- Set runtime path of "/usr/bin/osm2pgrouting" to ""

-- Installing: /usr/share/osm2pgrouting/COPYING

-- Installing: /usr/share/osm2pgrouting/Readme.md

-- Installing: /usr/share/osm2pgrouting/mapconfig.xml

-- Installing: /usr/share/osm2pgrouting/mapconfig_for_cars.xml

-- Installing: /usr/share/osm2pgrouting/mapconfig_for_bicycles.xml

10.安装扩展

# su - postgres

$ createdb gisdb

$ psql gisdb -c "create extension postgis"

CREATE EXTENSION

$ psql gisdb -c "create extension pgrouting"

CREATE EXTENSION

测试参考:

https://blog.openshift.com/add-map-navigation-to-your-app-with-pgrouting-on-openshift/