Closed Lswx2017 closed 5 years ago
please make sure the command 'pg_config' works
please make sure the command 'pg_config' works
如何确认 command 'pg_config' works 呢? 我执行了如下命令:
# for https://github.com/jaiminpan/pg_jieba
RUN \
apt update && \
apt upgrade -y -V && \
apt install -y -V git && \
apt install -y -V cmake && \
apt install -y -V libpq-dev && \
apt install -y -V build-essential && \
git clone https://github.com/jaiminpan/pg_jieba && \
cd pg_jieba && git submodule update --init --recursive && \
mkdir build && cd build
我现在在 posgis 做的 docker 里面 postgres:15-bullseye 编译 (https://github.com/postgis/docker-postgis/blob/master/15-3.3/Dockerfile) 遇到如下错误:
mkdir build && cd build
root@353c06e89d60:~/pg_jieba/build#
root@353c06e89d60:~/pg_jieba/build# cmake -DCMAKE_CXX_FLAGS="-Wall -std=c++11" -DCMAKE_PREFIX_PATH=/usr/lib/postgresql -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/15/server/ ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting pg_jieba build type -
-- Found PostgreSQL: /usr/lib/aarch64-linux-gnu/libpq.so (found version "15.3")
-- POSTGRESQL_EXECUTABLE is /usr/lib/postgresql/15/bin/postgres
-- Configuring done
-- Generating done
-- Build files have been written to: /root/pg_jieba/build
root@353c06e89d60:~/pg_jieba/build# make
Scanning dependencies of target pg_jieba
[ 33%] Building C object CMakeFiles/pg_jieba.dir/pg_jieba.c.o
/root/pg_jieba/pg_jieba.c:14:10: fatal error: postgres.h: No such file or directory
14 | #include "postgres.h"
| ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/pg_jieba.dir/build.make:82: CMakeFiles/pg_jieba.dir/pg_jieba.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/pg_jieba.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
When make, it output: [100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o /root/pg_jieba/pg_jieba.cpp:21:22: fatal error: postgres.h: No such file or directory
include "postgres.h"
compilation terminated.