docker-postgis icon indicating copy to clipboard operation
docker-postgis copied to clipboard

Missing postgis_sfcgal in alpine image

Open Cactusbone opened this issue 2 years ago • 1 comments

Using docker run --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis:14-3.2-alpine AND docker run -it --rm --link some-postgres postgres psql postgresql://postgres:mysecretpassword@some-postgres -c "CREATE EXTENSION postgis_sfcgal;" -c "SELECT ST_AsGeoJSON(ST_StraightSkeleton(ST_GeomFromText('POLYGON (( 190 190, 10 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190 ))')))"

I end up with

ERROR:  could not open extension control file "/usr/local/share/postgresql/extension/postgis_sfcgal.control": No such file or directory
ERROR:  function st_straightskeleton(geometry) does not exist
LINE 1: SELECT ST_AsGeoJSON(ST_StraightSkeleton(ST_GeomFromText('POL...

This works well with the debian version of the same image.

Cactusbone avatar May 04 '22 14:05 Cactusbone

confirmed; in the Alpine PostGIS build - the: SFCGAL support is disabled; ( as I see in the build log )

 --------------- Extensions --------------- 
  PostGIS Raster:                     enabled
  PostGIS Topology:                   enabled
  SFCGAL support:                     disabled
  Address Standardizer support:       enabled

Adding "SFCGAL support" is not so easy (now);

  • in the curent alpine:3.15 no cgal package yet:
    • https://pkgs.alpinelinux.org/packages?name=cgal&branch=v3.15&arch=x86_64
  • in the "edge" ( alpine testing repo ) it is exists and need to compile the SFCGAL code.
    • https://pkgs.alpinelinux.org/packages?name=cgal&branch=edge&arch=x86_64

so NOW: the "debian version" is recommended.

ImreSamu avatar May 08 '22 03:05 ImreSamu

Adding "SFCGAL support" is not so easy (now);

How about now?

orca-hydromancer avatar Jan 06 '23 04:01 orca-hydromancer

@orca-hydromancer :

How about now?

in the curent alpine:3.17 no cgal package yet:

  • https://pkgs.alpinelinux.org/packages?name=cgal&branch=v3.17

ImreSamu avatar Jan 19 '23 13:01 ImreSamu

Is it a requirement it be a package in alpine? CGAL is headers only library now, easy to include. Its soft dependencies gmp and mpfr are available in Alpine.

orca-hydromancer avatar Jan 23 '23 03:01 orca-hydromancer

Hi @orca-hydromancer

Is it a requirement it be a package in alpine?

(my personal opinion) Ideally:

  • it is advisable to use the existing packages,
  • and try to build as few programs as possible.

In practice, it is not always possible to apply this strategy.

The best thing would be to have SFCGAL as a supported package in Alpine in the future: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/34158

CGAL is headers only library now, easy to include.

Yes, I'm currently testing with -master image ( https://github.com/postgis/docker-postgis/pull/337 ), and if there is no other solution, we really need to think about the pros and cons of the local SFCGAL builds in the Alpine.

If you have any specific suggestions on these, please let me know.

ImreSamu avatar Feb 01 '23 11:02 ImreSamu

good news: sfcgal in the alpine:edge ( "edge" is a development branch )

  • https://pkgs.alpinelinux.org/package/edge/community/x86_64/sfcgal
~$ docker run -it --rm --network=host alpine:edge

/ # cat /etc/alpine-release
3.18_alpha20230208

/ # apk add sfcgal
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/7) Installing libgcc (12.2.1_git20220924-r9)
(2/7) Installing boost1.81-serialization (1.81.0-r1)
(3/7) Installing gmp (6.2.1-r2)
(4/7) Installing libstdc++ (12.2.1_git20220924-r9)
(5/7) Installing libgmpxx (6.2.1-r2)
(6/7) Installing mpfr4 (4.2.0-r0)
(7/7) Installing sfcgal (1.4.1-r2)
OK: 20 MiB in 22 packages
/ # 

ImreSamu avatar Mar 18 '23 18:03 ImreSamu