Bug 5858 - [anolis-23]PostGIS 编译错误
Summary: [anolis-23]PostGIS 编译错误
Status: IN_PROGRESS
Alias: None
Product: Anolis OS 23
Classification: Anolis OS
Component: Others (show other bugs) Others
Version: 23.0
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: 扣肉
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-13 11:56 UTC by dfrg_msc
Modified: 2023-09-18 12:26 UTC (History)
1 user (show)

See Also:


Attachments
检查代码 (1.06 KB, text/x-csrc)
2023-07-13 13:19 UTC, dfrg_msc
Details
libpq-devel core dump (171.88 KB, application/zstd)
2023-07-13 13:20 UTC, dfrg_msc
Details
postgresql-server-devel core dump (171.69 KB, application/zstd)
2023-07-13 13:20 UTC, dfrg_msc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dfrg_msc 2023-07-13 11:56:49 UTC
Description of problem:
postgresql-server和libpq版本对不上,前者是15.3,后者是15.2,导致编译PostGIS插件时提示Segmentation Fault,使用PostgreSQL官方15.3源码编译没问题

Version-Release number of selected component (if applicable):
postgresql-server-15.3-1.an23.x86_64.rpm
postgresql-server-devel-15.3-1.an23.x86_64.rpm
libpq-15.2-3.an23.x86_64.rpm
libpq-devel-15.2-3.an23.x86_64.rpm

How reproducible:
,尝试复现configure中PQserverVersion方法,编译通过后运行提示Segmentation Fault

Steps to Reproduce:
1.下载PostGIS 3.3.3源码包进行编译,configure过程中报错
2.尝试复现configure中PQserverVersion方法,编译通过后运行提示Segmentation Fault
3.怀疑是libpq包与postgresql-server不是同一次编译的产物导致

Actual results:
Segmentation Fault

Expected results:
正确输出版本

Additional info:
建议将libpq版本对齐到15.3-1
Comment 1 扣肉 2023-07-13 12:36:12 UTC
https://abs.openanolis.cn/all_project/1001?tab=packages&package_id=44672

可以先测试一下新版的 libpq。按理说 postgis 是不需要 libpq 的
Comment 2 扣肉 2023-07-13 12:40:42 UTC
https://fedora.pkgs.org/rawhide/fedora-x86_64/postgis-gui-3.3.3-1.fc39.x86_64.rpm.html

从这里可以看出,postgis-gui 编译依赖的是 postgresql-server-devel,它的符号来自于 libpq.so.private15-5,与 libpq 没有关系。
Comment 3 dfrg_msc 2023-07-13 13:19:46 UTC
Created attachment 849 [details]
检查代码
Comment 4 dfrg_msc 2023-07-13 13:20:19 UTC
Created attachment 850 [details]
libpq-devel core dump
Comment 5 dfrg_msc 2023-07-13 13:20:43 UTC
Created attachment 851 [details]
postgresql-server-devel core dump
Comment 6 dfrg_msc 2023-07-13 13:21:33 UTC
我试了一下,新的libpq确实也不行,用postgresql-server-devel也不行,不知道问题在哪里,我把PostGIS的检查代码和对应的core文件都上传了,麻烦帮忙看看,另外,用官方的PostgreSQL 15.3编译就一点问题没有
Comment 7 扣肉 2023-07-13 18:28:11 UTC
https://src.fedoraproject.org/rpms/postgis/blob/rawhide/f/postgis.spec

你有没有加这个开关:
./configure --with-gui --with-pgconfig=/usr/bin/pg_server_config
Comment 8 dfrg_msc 2023-07-13 21:24:51 UTC
试了下,效果一样
Comment 9 dfrg_msc 2023-08-03 19:11:37 UTC
我今天仔细排查了这个问题,查到原因了,主要是因为/usr/bin/pg_config --cflags命令返回的-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/anolis/anolis-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/anolis/anolis-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection中,/usr/lib/rpm/anolis/anolis-hardened-cc1和/usr/lib/rpm/anolis/anolis-annobin-cc1两个文件不存在导致的,可以考虑把这两个文件放到postgresql-server-devel包中,可以解决该问题
Comment 10 扣肉 2023-09-18 12:26:06 UTC
我觉得segfault可能来源于某些编译的开关。你试试这个:

https://abs.openanolis.cn/all_project/1?build_id=31156&tab=packages&package_id=45092