omniti-labs / pg_amqp

AMQP Support for Postgres
https://labs.omniti.com/labs/pg_amqp
207 stars 63 forks source link

fatal error: unistd.h: No such file or directory #33

Open vavra7 opened 3 years ago

vavra7 commented 3 years ago

I am failing to install the extension. Here is my Dockerfile:

FROM postgres:13-alpine

ENV POSTGRES_USER=root
ENV POSTGRES_PASSWORD=password

RUN apk update \
  && apk add py-pip make gcc \
  && pip install pgxnclient \
  && pgxn install pg_amqp

And result log:

...
Collecting pgxnclient
  Downloading pgxnclient-1.3.1.tar.gz (80 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from pgxnclient) (1.15.0)
Building wheels for collected packages: pgxnclient
  Building wheel for pgxnclient (PEP 517): started
  Building wheel for pgxnclient (PEP 517): finished with status 'done'
  Created wheel for pgxnclient: filename=pgxnclient-1.3.1-py3-none-any.whl size=41307 sha256=60a240edb8ab001f1c9a5ffb5b0d6e6b71e9f5514f78f81b0a394663faa907bd
  Stored in directory: /root/.cache/pip/wheels/e7/e2/dc/76c12637d2c337591bb556d49f3fea41375a3f17636b903ab5
Successfully built pgxnclient
Installing collected packages: pgxnclient
Successfully installed pgxnclient-1.3.1
INFO: best version: pg_amqp 0.3.0
INFO: saving /tmp/tmppud_a5eo/pg_amqp-0.3.0.zip
INFO: unpacking: /tmp/tmppud_a5eo/pg_amqp-0.3.0.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o src/pg_amqp.o src/pg_amqp.c
src/pg_amqp.c:36:10: fatal error: unistd.h: No such file or directory
   36 | #include <unistd.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/pg_amqp.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/local/bin/pg_config all

Any idea what could be a problem?