jaiminpan / pg_jieba

Postgresql full-text search extension for chinese
BSD 3-Clause "New" or "Revised" License
338 stars 65 forks source link

CMake Error #15

Closed RingWong closed 6 years ago

RingWong commented 6 years ago

环境:Ubuntu16.04, Postgresql9.6.5 执行cmake .. 的时候报如下错误: CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found version "9.6.5") 有什么办法可以解决吗?谢谢您!

jaiminpan commented 6 years ago

执行编译器前,请先确保可以执行pg_config 命令

RingWong commented 6 years ago

pg_config 是可以执行的

gzliudan commented 6 years ago

git clone https://github.com/jaiminpan/pg_jieba cd pg_jieba git submodule update --init --recursive mkdir build cd build cmake -DCMAKE_PREFIX_PATH=/usr/pgsql-10 -DCMAKE_CXX_FLAGS="-Wall -std=c++11" .. make make install

miaojianxin commented 6 years ago

我这样执行的cmake -DCMAKE_PREFIX_PATH=/usr/pgsql-10 -DCMAKE_CXX_FLAGS="-Wall -std=c++11" .. 报这样的错误,怎么弄呢In file included from /opt/pg10/include/postgresql/server/postgres.h:47:0, from /mjx_pg/pg_jieba/pg_jieba/pg_jieba.cpp:21: /usr/include/libintl.h:39:14: error: expected unqualified-id before ‘const’ extern char gettext (const char msgid) ^ /usr/include/libintl.h:39:14: error: expected ‘)’ before ‘const’ /usr/include/libintl.h:39:14: error: expected initializer before ‘const’ /usr/include/libintl.h:44:14: error: expected unqualified-id before ‘const’ extern char dgettext (const char domainname, const char *__msgid)

gzliudan commented 6 years ago

我是在centos 7.x下用yum安装的pg 10,所以 -DCMAKE_PREFIX_PATH=/usr/pgsql-10 ,你的系统、版本、目录不同,要改一下

yum install -y postgresql10 postgresql10-server postgresql10-contrib postgresql10-plpython postgresql10-devel

miaojianxin commented 6 years ago

这个我知道,我改了,是我自己的路径,我的pg10是我代码编译安装的(./configure,make,make install), 我感觉这个错误,是c++11新特性跟以前方式编译的pg是不是不兼容, 我应该再怎么改呢,谢谢啦,网上也搜不到,还是只能用yum那么装?

miaojianxin commented 6 years ago

我gcc 版本是4.8.5 ,我加了支持c++11的选项,编译pg_jieba时候, 这样的话,导致pg依赖的底层那种纯c的东西可能跟 这个c++11不兼容, 该怎么改,感觉还得加些选项, 我c++11一次使用

gzliudan commented 6 years ago

centos 7.x带的gcc就是4.8.5,我用 -DCMAKE_CXX_FLAGS="-Wall -std=c++11" 的选项编译10.1没问题

miaojianxin commented 6 years ago

好了,好了, 我调整了jieba.hpp头文件的位置,就好了

include "cppjieba/Jieba.hpp"

放在 extern c之前,就好了,别人都没碰到这个问题,不知道是不是环境问题,我也是gcc4.8.5,centos7

ghost commented 6 years ago

我也遇到此问题了,调整jieba.hpp位置就好了,thanks。