Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgRouting not available in pg_available_extensions even after installation. #399

Open
abrahamarslan opened this issue Dec 29, 2024 · 1 comment

Comments

@abrahamarslan
Copy link

I'm trying to install pgrouting extension on postgres using docker.
Here is the complete dockerfile

https://paste.gd/rc8cpoBN#

I don't get any errors and the image builds successfully. At entrypoint, I enable the extensions required using

CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder CASCADE;
CREATE EXTENSION IF NOT EXISTS address_standardizer;
CREATE EXTENSION IF NOT EXISTS pg_repack;
CREATE EXTENSION IF NOT EXISTS pgrouting;

But I do not see pgrouting enabled in the database, nor it is available in pg_available_extensions.

Is there a step I'm missing or is the Dockerfile wrong?

Kindly help.

@ImreSamu
Copy link
Member

Is there a step I'm missing or is the Dockerfile wrong?

It seems the installation settings might be misconfigured, which could result in pgRouting being installed in the wrong directory.
Specifically, the following settings in your Dockerfile seem unusual, especially considering you’re using Alpine and not Debian/Ubuntu:

&& cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DPOSTGRESQL_INCLUDE_DIR=/usr/include/postgresql \
    -DPOSTGRESQL_LIBRARIES=/usr/lib/postgresql \
    -DBoost_INCLUDE_DIR=/usr/include/boost \
    -DPOSTGRESQL_SHARE_DIR=/usr/local/share/postgresql \

I suggest using the default settings provided in the https://github.com/pgRouting/pgrouting?tab=readme-ov-file#compilation
to ensure proper installation.


Here’s a tiny working example that includes a workaround using -DCMAKE_CXX_FLAGS="-include cstdint " .

FROM postgis/postgis:15-3.5-alpine

RUN apk add --no-cache \
    boost-dev \
    cmake \
    g++ \
    make \
    perl  

ENV PGROUTING_VERSION 3.7.1
RUN wget -O pgrouting.tar.gz https://github.com/pgRouting/pgrouting/archive/v${PGROUTING_VERSION}.tar.gz

RUN echo "Extracting pgrouting" \
    && tar -xvzf pgrouting.tar.gz \
    && cd pgrouting-* \
    && mkdir build \
    && cd build \
    && cmake -DCMAKE_CXX_FLAGS="-include cstdint" .. \
    && make -j4 \
    && make install \
    && cd ../.. \
    && rm -rf pgrouting*
    

and my test results:

postgres=# \dx
                                        List of installed extensions
          Name          | Version |   Schema   |                        Description                         
------------------------+---------+------------+------------------------------------------------------------
 fuzzystrmatch          | 1.1     | public     | determine similarities and distance between strings
 pgrouting              | 3.7.1   | public     | pgRouting Extension
 plpgsql                | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis                | 3.5.1   | public     | PostGIS geometry and geography spatial types and functions
 postgis_tiger_geocoder | 3.5.1   | tiger      | PostGIS tiger geocoder and reverse geocoder
 postgis_topology       | 3.5.1   | topology   | PostGIS topology spatial types and functions
(6 rows)

Let me know if you continue to encounter problems, and I’ll be happy to assist further!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants