eulerto/pg_similarity

could not load library

songzhiyong opened this issue · 18 comments

ERROR: could not load library "/usr/lib/postgresql/10/lib/pg_similarity.so": /usr/lib/postgresql/10/lib/pg_similarity.so: undefined symbol: Float8GetDatum

i got this error, how to fix it

@songzhiyong what is your postgres version? How do you install postgres? How do you install pg_similarity?

my postgres version is 10.0 and I installed pg_similarity following README(git clone --> make --> make install)

Could you show the make output? I suspect that the compile and/or linkage are not using postgres 10.0 libraries.

Got the same error when installing for postgresql 11 on ubuntu 18.04. This is the output from the linker:
root@geoserv:/usr/lib/postgresql/11/lib# ld -v pg_similarity.so
GNU ld (GNU Binutils for Ubuntu) 2.30
ld: warning: cannot find entry symbol _start; not setting start address
pg_similarity.so: undefined reference to DefineCustomEnumVariable' pg_similarity.so: undefined reference to textout'
pg_similarity.so: undefined reference to elog_finish' pg_similarity.so: undefined reference to text_to_cstring'
pg_similarity.so: undefined reference to errstart' pg_similarity.so: undefined reference to pg_detoast_datum'
pg_similarity.so: undefined reference to palloc' pg_similarity.so: undefined reference to cstring_to_text_with_len'
pg_similarity.so: undefined reference to elog_start' pg_similarity.so: undefined reference to errmsg'
pg_similarity.so: undefined reference to EmitWarningsOnPlaceholders' pg_similarity.so: undefined reference to Float8GetDatum'
pg_similarity.so: undefined reference to DefineCustomRealVariable' pg_similarity.so: undefined reference to DirectFunctionCall2Coll'
pg_similarity.so: undefined reference to DatumGetFloat8' pg_similarity.so: undefined reference to errfinish'
pg_similarity.so: undefined reference to sqrt' pg_similarity.so: undefined reference to DirectFunctionCall1Coll'
pg_similarity.so: undefined reference to pfree' pg_similarity.so: undefined reference to DefineCustomBoolVariable'
pg_similarity.so: undefined reference to `errcode'
root@geoserv:/usr/lib/postgresql/11/lib#

postgres=# create extension pg_similarity;
2019-07-04 15:05:58 CEST ERROR: could not load library "/usr/lib/postgresql/11/lib/pg_similarity.so": /usr/lib/postgresql/11/lib/pg_similarity.so: undefined symbol: Float8GetDatum
2019-07-04 15:05:58 CEST STATEMENT: create extension pg_similarity;
ERROR: could not load library "/usr/lib/postgresql/11/lib/pg_similarity.so": /usr/lib/postgresql/11/lib/pg_similarity.so: undefined symbol: Float8GetDatum

@sollimeister How do you compile pg_similarity? It seems it couldn't find the postgres libraries. What is the pg_config --configure output? What is the make output?

You do not provide all information I requested. What are the postgresql packages installed?

dpkg -l | grep postgresql

Seems like port is wrong. I am upgradeing from 9.6 to 11. The old 9.6 is on
5432 and version 11 is on 5435. It was a problem that postgres11 did not
install pg_config, so I had to install the postgres11-server-devel in order
to get pg_config for version 11.

It does not matter if you have multiple postgres versions. However, while build/install pg_similarity you have to make sure the right pg_config is in your PATH ( pg_config --version ).

What is the make output?

Do you close this connection when you try again? Make sure postgres is using a fresh pg_similarity library (restart or simply closing all connections).

BTW, if you are using PGDB packages, why don't you use the pg_similarity package? It is called postgresql-11-similarity.