Trying to use the pgcrypto extension for PostgreSQL but getting this undefined symbol: EVP_cast5_cbc
whenever I try to start the server:
[postgres@localhost ~]$ pg_ctl start -D /usr/local/pgsql/data
waiting for server to start....2024-04-26 10:39:15.326 CEST [3036]: db=,user=,app=,client= LOG: 00000: pgaudit extension initialized
2024-04-26 10:39:15.326 CEST [3036]: db=,user=,app=,client= LOCATION: _PG_init, pgaudit.c:2202
2024-04-26 10:39:15.338 CEST [3036]: db=,user=,app=,client= FATAL: 58P01: could not load library "/usr/local/pgsql/lib/pgcrypto.so": /usr/local/pgsql/lib/pgcrypto.so: undefined symbol: EVP_cast5_cbc
2024-04-26 10:39:15.338 CEST [3036]: db=,user=,app=,client= LOCATION: internal_load_library, dfmgr.c:245
2024-04-26 10:39:15.338 CEST [3036]: db=,user=,app=,client= LOG: 00000: database system is shut down
2024-04-26 10:39:15.338 CEST [3036]: db=,user=,app=,client= LOCATION: UnlinkLockFiles, miscinit.c:985
stopped waiting
pg_ctl: could not start server
Postgres is compiled from source and version 15.6.
Here is my openssl version if necessary:
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)
ldd /usr/local/pgsql/lib/pgcrypto.so
returns:
[postgres@localhost ~]$ ldd /usr/local/pgsql/lib/pgcrypto.so
linux-vdso.so.1 (0x00007ffd2b7fc000)
libz.so.1 => /lib64/libz.so.1 (0x00007fe818092000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe817e00000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe8180ea000)
2
Answers
Something went wrong when you build pgcrypto: it should be linked with
libcrypto.so
. Since it isn’t, it is hardly surprising that it complains about a symbol it cannot resolve.Review your build process.
Why are you compiling it from source instead of using one that is already packaged? Did you follow the compilation instructions?
Putting your question title into Google returned this result: https://www.postgresql.org/message-id/334461.1705013937%40sss.pgh.pa.us
If that looks like the same problem you’re having, you probably didn’t include
--with-openssl
on your./configure
line, which you can confirm in your config.log file. Yourldd
command shows it is not linked.