暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 因主机装有多个openssl 导致编译失败

原创 墨香溪 2025-02-27
207

--记录

安装PG14.14的时候,make 报错。

./configure --prefix=/data/pg14.14/ --with-perl --with-python --with-openssl --with-ldap --with-systemd --with-libxml
make -j8

报错:

hmac_openssl.c: In function ?pg_hmac_create?:
hmac_openssl.c:91:30: error: invalid application of ?sizeof? to incomplete type ?HMAC_CTX?
  ctx->hmacctx = ALLOC(sizeof(HMAC_CTX));
                              ^
hmac_openssl.c:49:28: note: in definition of macro ?ALLOC?
 #define ALLOC(size) malloc(size)
                            ^
hmac_openssl.c:112:33: error: invalid application of ?sizeof? to incomplete type ?HMAC_CTX?
  memset(ctx->hmacctx, 0, sizeof(HMAC_CTX));
                                 ^
hmac_openssl.c: In function ?pg_hmac_free?:
hmac_openssl.c:248:38: error: invalid application of ?sizeof? to incomplete type ?HMAC_CTX?
  explicit_bzero(ctx->hmacctx, sizeof(HMAC_CTX));
                                      ^
make[2]: *** [hmac_openssl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/postgres/Downloads/postgresql-14.14/src/common'
make[1]: *** [all-common-recurse] Error 2
make[1]: Leaving directory `/home/postgres/Downloads/postgresql-14.14/src'
make: *** [all-src-recurse] Error 2


参考文档:https://github.com/ruby/openssl/issues/379 中提到:

HMAC code is not much changed from v2.1.2 to v2.2.0. The compile error is likely caused because different OpenSSL versions got mixed up. Try specifying a single installation explicitly by --with-openssl-dir= option.

检查本机:

[postgres@dba-postgres postgresql-14.14]$ /usr/local/bin/openssl version
OpenSSL 3.1.0 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)
[postgres@dba-postgres postgresql-14.14]$ /usr/bin/openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
[postgres@dba-postgres postgresql-14.14]$ /usr/local/openssl/bin/openssl version
OpenSSL 1.1.1w  11 Sep 2023


找到openssl 

[root@dba-postgres openssl-1.1.1w]# find /usr -name "openssl"
/usr/bin/openssl
/usr/local/share/doc/openssl
/usr/local/include/openssl
/usr/lib64/python2.7/site-packages/cryptography/hazmat/bindings/openssl
/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl
/usr/lib64/openssl
/usr/share/ruby/openssl
/usr/include/openssl

移除:

/usr/local/include/openssl 这整个目录后,编译通过。


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论