微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安装 postgres 扩展 PGXN“致命错误:unistd.h:没有这样的文件或目录”

如何解决安装 postgres 扩展 PGXN“致命错误:unistd.h:没有这样的文件或目录”

我需要将一些 postgres 表与 elasticsearch 同步,并得出结论,对我的情况而言,最佳解决方案是here 所描述的解决方案。不幸的是,我仍然无法安装所需的 postgres 扩展 amqp

我使用 docker,所以我从图像 postgres:13-alpine 开始。

这是我的 Dockerfile 到目前为止的样子:

FROM postgres:13-alpine

ENV POSTGRES_DB ''
ENV POSTGRES_USER ''
ENV POSTGRES_PASSWORD ''

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

然后当您进入容器并尝试运行 pgxn install pg_amqp 时,您将收到以下错误

bash-5.1# pgxn install pg_amqp
INFO: best version: pg_amqp 0.3.0
INFO: saving /tmp/tmpgjtefhgh/pg_amqp-0.3.0.zip
INFO: unpacking: /tmp/tmpgjtefhgh/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

看来我不知道该怎么做。有什么帮助吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。