RPG-18 / pg_ulid

Universally Unique Lexicographically Sortable Identifier generate for PostgreSQL
MIT License
11 stars 0 forks source link

Can't install extension built with docker #5

Closed budarin closed 2 years ago

budarin commented 2 years ago

Have built extension with docker and installed on target env I'm trying to install the extension in PostgreSql v.14.1 and I get an error:

image

RPG-18 commented 2 years ago

You can change debian version heer https://github.com/RPG-18/pg_ulid/blob/main/Dockerfile.debian#L1 https://hub.docker.com/_/debian

budarin commented 2 years ago

the problem is not in the Debian version, but in the Postgres version for which the package is being built, am I right? I'm trying to install the extension into Postgres 14.1 bus? as I suspect, the extension is built for Postgres 13

RPG-18 commented 2 years ago

Yes. bullseye has 13, bookworm has 14. You can change repository/package version https://github.com/RPG-18/pg_ulid/blob/main/Dockerfile.debian#L3

budarin commented 2 years ago

I was building a package in a postgres:latest container using commands from Dockerfile.debian file Postgres 14.1 is installed there, but for some reason the extension is being built for Postgres 13

I can't use the commands proposed in the project to build the package on Windows and Mac due to the absence of the /var/lib/docker folder on them

RPG-18 commented 2 years ago

You can create image with bash and run in interactive mode. Mount volume for copy files from docker to host.

Or use cp for copy from docker2host

budarin commented 2 years ago

trying to build with

FROM debian:bookworm

RUN apt-get update && \
    apt-get install -y \
    libpq-dev \
    postgresql-server-dev-all \
    g++ \
    cmake \
    checkinstall \
    bash

ADD . /pg_ulid

WORKDIR /pg_ulid/build

RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. && \
    cmake --build . && \
    checkinstall -y \
    --pkgname=pg_ulid \
    --pkgversion=1.1

get the error:

$ docker build -f Dockerfile.debian -t deb .
[+] Building 2.4s (9/9) FINISHED
 => [internal] load build definition from Dockerfile.debian                                                                                        0.0s 
 => => transferring dockerfile: 421B                                                                                                               0.0s 
 => [internal] load .dockerignore                                                                                                                  0.0s 
 => => transferring context: 2B                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/debian:bookworm                                                                                 0.9s 
 => [internal] load build context                                                                                                                  0.1s 
 => => transferring context: 59.49kB                                                                                                               0.1s 
 => [1/5] FROM docker.io/library/debian:bookworm@sha256:630147f5e4964acc91557e8c049c3e8460777954a1956cc8c27c5563311e497c                           0.0s 
 => CACHED [2/5] RUN apt-get update &&     apt-get install -y     libpq-dev     postgresql-server-dev-all     g++     cmake     checkinstall       0.0s 
 => [3/5] ADD . /pg_ulid                                                                                                                           0.1s 
 => [4/5] WORKDIR /pg_ulid/build                                                                                                                   0.1s 
 => ERROR [5/5] RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. &&     cmake --build . &&     checkinstall -y     --pkgname=p  1.1s 
------
 > [5/5] RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. &&     cmake --build . &&     checkinstall -y     --pkgname=pg_ulid     --pkgversion=1.1:
#9 0.620 -- The CXX compiler identification is GNU 11.2.0
#9 0.636 -- Detecting CXX compiler ABI info
#9 0.769 -- Detecting CXX compiler ABI info - done
#9 0.788 -- Check for working CXX compiler: /usr/bin/c++ - skipped
#9 0.789 -- Detecting CXX compile features
#9 0.790 -- Detecting CXX compile features - done
#9 0.814 -- Found PostgreSQL: /usr/lib/x86_64-linux-gnu/libpq.so (found version "14.1")  
#9 0.833 -- Configuring done
#9 0.837 -- Generating done
#9 0.839 -- Build files have been written to: /pg_ulid/build
#9 0.938 [ 50%] Building CXX object CMakeFiles/ulid.dir/src/ulid.cpp.o
#9 1.023 /pg_ulid/src/ulid.cpp:6:10: fatal error: postgres.h: No such file or directory
#9 1.023     6 | #include <postgres.h>
#9 1.023       |          ^~~~~~~~~~~~
#9 1.023 compilation terminated.
#9 1.026 gmake[2]: *** [CMakeFiles/ulid.dir/build.make:76: CMakeFiles/ulid.dir/src/ulid.cpp.o] Error 1
#9 1.027 gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ulid.dir/all] Error 2
#9 1.027 gmake: *** [Makefile:136: all] Error 2
------
executor failed running [/bin/sh -c cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. &&     cmake --build . &&     checkinstall -y     --pkgname=pg_ulid     --pkgversion=1.1]: exit code: 2
RPG-18 commented 2 years ago

@budarin fix build for Debian bookworm

budarin commented 2 years ago

Thanks, it works!