amutu / zhparser

zhparser is a PostgreSQL extension for full-text search of Chinese language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yum install clang之后重新make,还是报错

zyd opened this issue · comments

yum install clang之后重新make,还是报错
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -I/usr/local/include/scws -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o zhparser.o zhparser.c
zhparser.c: In function ‘init’:
zhparser.c:223:6: warning: implicit declaration of function ‘SplitIdentifierString’ [-Wimplicit-function-declaration]
if(!SplitIdentifierString(extra_dicts,',',&elemlist)){
^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -shared -o zhparser.so zhparser.o -L/usr/pgsql-11/lib -Wl,--as-needed -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-11/lib',--enable-new-dtags -lscws -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I/usr/local/include/scws -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o zhparser.bc zhparser.c
make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
make: *** [zhparser.bc] Error 127

Originally posted by @zyd in #29 (comment)

make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
11已经支持了啊。
/opt/rh/llvm-toolset-7/root/usr/bin/clang 你的环境不知道什么情况,不过你看下 /opt/rh/llvm-toolset-7/root/usr/bin/目录下应该没有clang这个文件。你可以先ln -s /usr/bin/clang /opt/rh/llvm-toolset-7/root/usr/bin/clang 做一个软连接,让它连接到也可以。

腾讯云CentOS7、阿里云CentOS7、谷歌云RedHat7、自建CentOS7全部默认配置,无其他软件,安装postgres11之后,安装scws-1.2.3正常,但是进zhparser make就报错,yum install clang之后make也依然报错。
postgres 10安装zhparser一切正常。

ln -s /usr/bin/clang /opt/rh/llvm-toolset-7/root/usr/bin/clang问题依旧,https://github.com/zyd/bugImage/blob/master/zhparser.png
zhparser.c:223:6: warning: implicit declaration of function ‘SplitIdentifierString’ [-Wimplicit-function-declaration]
if(!SplitIdentifierString(extra_dicts,',',&elemlist)){
^

HI, 我在centos上弄了一下,问题如下:
centos提供的postgresql的,在编译时所用的llvm,clang的路径并不是标准路径,而且是高版本的,而centos提供的源是3.x的,这样就会导致两个问题
1, clang找不到。
解决:
mkdir -p /opt/rh/llvm-toolset-7/root/usr/bin/
ln -s /usr/bin/clang /opt/rh/llvm-toolset-7/root/usr/bin/clang
2, unknown argument: '-flto=thin'
去掉这个参数进行编译,手动执行下边的内容,执行后在make,
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I/usr/local/include/scws -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -emit-llvm -c -o zhparser.bc zhparser.c
3, sudo make install 报错
PG_CONFIG ?= pg_config
修改成 PG_CONFIG=/usr/pgsql-11/bin/pg_config
后边会报错。但是没有用不用管(都是llvm那些)。
4, creae extension报错
创建extension的时候,需要写入词典文件,所以需要修改权限
cd /usr/pgsql-11/share
chmod 777 tsearch_data/

这个问题没法通过修改zhparser解决,大家先按这个方法弄吧。

vi lib/pgxs/src/makefiles/pgxs.mk
注释掉所有llvm相关的内容也可以。

#ifeq ($(with_llvm), yes)
#all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
#endif
 
#ifeq ($(with_llvm), yes)
#       $(foreach mod, $(MODULES), $(call install_llvm_module,$(mod),$(mod).bc))
#endif # with_llvm
 
#ifeq ($(with_llvm), yes)
#       $(call install_llvm_module,$(MODULE_big),$(OBJS))
#endif # with_llvm
 
#ifeq ($(with_llvm), yes)
#       $(foreach mod, $(MODULES), $(call uninstall_llvm_module,$(mod)))
#endif # with_llvm
 
#ifeq ($(with_llvm), yes)
#       $(call uninstall_llvm_module,$(MODULE_big))
#endif # with_llvm

我用最新的CentOS 8.0.1905安装postgres 11,通过:
dnf install clang
dnf install llvm
分别解决了make和make install的报错,第二个llvm是我瞎猜出来的包结果install通过了╰(°▽°)╯

HI, 我在centos上弄了一下,问题如下:
centos提供的postgresql的,在编译时所用的llvm,clang的路径并不是标准路径,而且是高版本的,而centos提供的源是3.x的,这样就会导致两个问题
1, clang找不到。
解决:
mkdir -p /opt/rh/llvm-toolset-7/root/usr/bin/
ln -s /usr/bin/clang /opt/rh/llvm-toolset-7/root/usr/bin/clang
2, unknown argument: '-flto=thin'
去掉这个参数进行编译,手动执行下边的内容,执行后在make,
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I/usr/local/include/scws -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -emit-llvm -c -o zhparser.bc zhparser.c
3, sudo make install 报错
PG_CONFIG ?= pg_config
修改成 PG_CONFIG=/usr/pgsql-11/bin/pg_config
后边会报错。但是没有用不用管(都是llvm那些)。
4, creae extension报错
创建extension的时候,需要写入词典文件,所以需要修改权限
cd /usr/pgsql-11/share
chmod 777 tsearch_data/

这个问题没法通过修改zhparser解决,大家先按这个方法弄吧。

最近CentOS7安装postgresql 12时还是遇到这个问题,通过安装llvm-toolset-7.0和创建软连接完美的解决了这个问题,方法如下:
yum install centos-release-scl
yum install llvm-toolset-7.0
scl enable llvm-toolset-7.0 bash
ln -s /opt/rh/llvm-toolset-7.0 /opt/rh/llvm-toolset-7
ln -s /opt/rh/llvm-toolset-7.0/root/usr /usr/lib64/llvm5.0
同时将旧版的clang和llvm通过yum卸载了,不卸载应该也行
yum remove clang
yum remove llvm