postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.39k stars 466 forks source link

Packages moved from testing to community #157

Closed GammaGames closed 4 years ago

GammaGames commented 4 years ago

A handful of packages, namely gdal-dev, geos-dev, and proj-dev (and their non-dev dependencies) were moved from testing to community. Changing the apk add commands to use the correct repository, http://dl-cdn.alpinelinux.org/alpine/edge/community, instead of http://dl-cdn.alpinelinux.org/alpine/edge/testing fixes the issues.

This is likely because of something that was brought up in the mailing list, though I haven't been able to find any further discussion after that thread.

Desa007 commented 4 years ago

Thanks, it's work. But now it fails with configure error:

configure: error: could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig

Need help. Thanks

GammaGames commented 4 years ago

Did you do it for both the build-deps-edge and postgis-rundeps-edge virtual packages? The former has the dev packages, while the latter has the regular

Edit: I have done a decent amount of changes to my dockerfile, I had a similar issue that was fixed with #149

Desa007 commented 4 years ago

Yes, done for both. Also tried build with postgres:11 and got the same error

configure: error: could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig

http://i.imgur.com/XZCVk4F.png

My Dockerfile: http://pastiebin.com/embed/5dde3fcc5d54e

GammaGames commented 4 years ago

Just a few changes:

  1. I am installing g++ in the .build-deps-edge virtual package instead of the .build-deps package
  2. I am installing libstdc++ in the .postgis-rundeps-edge virtual package
  3. I am using postgis 3.0.0

My dockerfile for postgres12-postgis3 looks like the following:

FROM postgres:12-alpine

ENV POSTGIS_VERSION 3.0.0
ENV POSTGIS_SHA256 1c83fb2fc8870d36ed49859c49a12c8c4c8ae8c5c3f912a21a951c5bcc249123

RUN set -ex \
    \
    && apk add --no-cache --virtual .fetch-deps ca-certificates openssl tar \
    \
    && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
    && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
    && mkdir -p /usr/src/postgis \
    && tar \
        --extract \
        --file postgis.tar.gz \
        --directory /usr/src/postgis \
        --strip-components 1 \
    && rm postgis.tar.gz \
    \
    && apk add --no-cache --virtual .build-deps \
        autoconf automake json-c-dev libtool libxml2-dev make perl \
    \
    && apk add --no-cache --virtual .build-deps-edge \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
        g++ gdal-dev geos-dev proj-dev protobuf-c-dev \
    && cd /usr/src/postgis \
    && ./autogen.sh \
    && ./configure \
    && make \
    && make install \
    && apk add --no-cache --virtual .postgis-rundeps \
        json-c \
    && apk add --no-cache --virtual .postgis-rundeps-edge \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
        geos gdal proj protobuf-c libstdc++ \
    && cd / \
    && rm -rf /usr/src/postgis \
    && apk del .fetch-deps .build-deps .build-deps-edge
gijoe460 commented 4 years ago

GammaGames -

Your build got much further, I am getting the following error now during the build.

/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I../liblwgeom -std=gnu99 -g -O2 -fno-math-errno -fno-signed-zeros -I../libpgcommon -I../deps/wagyu -I../deps/uthash/include -I/usr/include -I/usr/include/libxml2 -I/usr/include/json-c -fPIC -DPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -flto=thin -emit-llvm -c -o postgis_module.bc postgis_module.c make[1]: /usr/bin/clang: Command not found make[1]: Leaving directory '/usr/src/postgis/postgis' make[1]: /usr/local/lib/postgresql/pgxs/src/makefiles/../../src/Makefile.global:1044:postgis_module.bc] Error 127 make: [GNUmakefile:20: all] Error 1

Any thoughts?

GammaGames commented 4 years ago

@gijoe460 Try adding an apk add clang clang-dev before compiling, what version of postgis are you building?

gijoe460 commented 4 years ago

I'm following your build exactly for now. Once i get it working i have some local files/config i do.

GammaGames commented 4 years ago

Your error message looks like clang is missing, did you try adding it as I said above?

gijoe460 commented 4 years ago

Yes. Looks like we got a little farther along, Still a new error.

cd '/usr/local/lib/postgresql/bitcode' && /usr/lib/llvm8/bin/llvm-lto -thinlto -thinlto-action=thinlink -o postgis-3.index.bc postgis-3/postgis_module.bc postgis-3/lwgeom_accum.bc postgis-3/lwgeom_spheroid.bc postgis-3/lwgeom_ogc.bc postgis-3/lwgeom_functions_analytic.bc postgis-3/lwgeom_inout.bc postgis-3/lwgeom_functions_basic.bc postgis-3/lwgeom_btree.bc postgis-3/lwgeom_box.bc postgis-3/lwgeom_box3d.bc postgis-3/lwgeom_geos.bc postgis-3/lwgeom_geos_prepared.bc postgis-3/lwgeom_geos_clean.bc postgis-3/lwgeom_geos_relatematch.bc postgis-3/lwgeom_export.bc postgis-3/lwgeom_in_gml.bc postgis-3/lwgeom_in_kml.bc postgis-3/lwgeom_in_geohash.bc postgis-3/lwgeom_in_geojson.bc postgis-3/lwgeom_in_encoded_polyline.bc postgis-3/lwgeom_triggers.bc postgis-3/lwgeom_dump.bc postgis-3/lwgeom_dumppoints.bc postgis-3/lwgeom_functions_lrs.bc postgis-3/lwgeom_functions_temporal.bc postgis-3/lwgeom_rectree.bc postgis-3/long_xact.bc postgis-3/lwgeom_sqlmm.bc postgis-3/lwgeom_rtree.bc postgis-3/lwgeom_transform.bc postgis-3/lwgeom_window.bc postgis-3/gserialized_typmod.bc postgis-3/gserialized_gist_2d.bc postgis-3/gserialized_gist_nd.bc postgis-3/gserialized_supportfn.bc postgis-3/gserialized_spgist_2d.bc postgis-3/gserialized_spgist_3d.bc postgis-3/gserialized_spgist_nd.bc postgis-3/brin_2d.bc postgis-3/brin_nd.bc postgis-3/brin_common.bc postgis-3/gserialized_estimate.bc postgis-3/geography_inout.bc postgis-3/geography_btree.bc postgis-3/geography_centroid.bc postgis-3/geography_measurement.bc postgis-3/geography_measurement_trees.bc postgis-3/geometry_inout.bc postgis-3/postgis_libprotobuf.bc postgis-3/vector_tile.pb-c.bc postgis-3/geobuf.pb-c.bc postgis-3/mvt.bc postgis-3/lwgeom_out_mvt.bc postgis-3/geobuf.bc postgis-3/lwgeom_out_geobuf.bc postgis-3/lwgeom_out_geojson.bc postgis-3/postgis_legacy.bc /bin/sh: /usr/lib/llvm8/bin/llvm-lto: not found make[1]: [/usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk:236: install] Error 127 make[1]: Leaving directory '/usr/src/postgis/postgis' make: [GNUmakefile:20: install] Error 1

gijoe460 commented 4 years ago

I think I got it- Changes made to your Dockerfile

FROM postgres:12-alpine

ENV POSTGIS_VERSION 3.0.0
ENV POSTGIS_SHA256 1c83fb2fc8870d36ed49859c49a12c8c4c8ae8c5c3f912a21a951c5bcc249123

RUN set -ex \
    \
    && apk add --no-cache --virtual .fetch-deps ca-certificates openssl tar \
    \
    && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
    && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
    && mkdir -p /usr/src/postgis \
    && tar \
        --extract \
        --file postgis.tar.gz \
        --directory /usr/src/postgis \
        --strip-components 1 \
    && rm postgis.tar.gz \
    \
    && apk add --no-cache --virtual .build-deps \
        autoconf automake json-c-dev libtool libxml2-dev make perl llvm clang clang-dev \
    \
    && apk add --no-cache --virtual .build-deps-edge \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
        g++ gdal-dev geos-dev proj-dev protobuf-c-dev \
    && cd /usr/src/postgis \
    && ./autogen.sh \
    && ./configure \
    && make \
    && make install \
    && apk add --no-cache --virtual .postgis-rundeps \
        json-c \
    && apk add --no-cache --virtual .postgis-rundeps-edge \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
        geos gdal proj protobuf-c libstdc++ \
    && cd / \
    && rm -rf /usr/src/postgis \
    && apk del .fetch-deps .build-deps .build-deps-edge

COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
COPY ./update-postgis.sh /usr/local/bin
phillipross commented 4 years ago

@GammaGames @Desa007 @gijoe460 I believe this is no longer an issue as of the current builds from the master branch can build v2.5.3 and will build v3.x as soon as some pending PRs are merged.

Can you test/confirm? Thanks!

gijoe460 commented 4 years ago

I'll check today and get back.

GammaGames commented 4 years ago

I just pulled the 12-3.0-alpine and 12-2.5-alpine tags and they seemed to be working fine. Now that the images are on dockerhub I no longer have any reason to be building it myself, so I haven't done that.

Edit: I tried to build both of the above packages, got:

ERROR: unsatisfiable constraints:
  gdal-dev (missing):
    required by: .build-deps-20200225.190532[gdal-dev]
  geos-dev (missing):
    required by: .build-deps-20200225.190532[geos-dev]
  llvm9-dev (missing):
    required by: .build-deps-20200225.190532[llvm9-dev]
  proj-dev (missing):
    required by: .build-deps-20200225.190532[proj-dev]
phillipross commented 4 years ago

@GammaGames when you try to build, are you invoking docker build directly or using make? In the case of the former, please be sure to include the --pull option so that you're sure to have the latest parent images in your local environment.

GammaGames commented 4 years ago

You're right, that worked. I can't seem to build any containers on the pi though, but that should be a separate issue.

phillipross commented 4 years ago

@GammaGames I think maybe issue #144 is tracking that, but I haven't look at it closely yet