rljacobson / Levenshtein

A Blazingly Fast Damerau–Levenshtein Edit Distance Function (UDF) for MySQL
MIT License
25 stars 3 forks source link

ERROR 1127 (HY000): Can't find symbol 'DAMLEV' in library #5

Closed ghost closed 4 years ago

ghost commented 4 years ago

I'm getting this error when trying to install the functions:

ERROR 1127 (HY000): Can't find symbol 'DAMLEV' in library

I'm surprised nobody posted this issue until now. Tried with two different ubuntu server installations all meeting the requirements and the error is still the same.

When I execute through mysql this command: SHOW VARIABLES LIKE '%plugin%' the plugin directory is /usr/lib/mysql/plugin... but when I execute the command mysql_config --plugindir, the directory is this one /usr/lib/x86_64-linux-gnu/mariadb18/plugin. Anyway, I installed the libdamlev.so file in both directories just in case.

What I am doing wrong? MySQL version is 8.0.17

rljacobson commented 4 years ago

I am just catching up with my GitHub notifications. They were a bit overwhelming for awhile. Sorry for the delayed response.

I have found that error surprisingly easy to get. I usually run into it when I have placed the libdamlev.so file in the wrong plugins directory because I have two MySQL installations in conflict (MariaDB and MySQL). The /usr/lib/mysql directory is usually a symlink to the real location of mysql/mariaDB, which is probably /usr/lib/x86_64-linux-gnu/mariadb18 in your case.

It can also happen if you forget to do the steps described under the Installation heading. In particular, you need to evaluate

CREATE FUNCTION DAMLEV RETURNS INTEGER  SONAME 'libdamlev.so';

(Similarly for the other DAMLEV* functions.)

Let me know if this works and I'll close the issue. Otherwise, we'll have to look deeper.

LoyalServant commented 4 years ago

You are running up against Linux being CaSe sensitive.

Edit: So... yeah.. senior moment and it's far too early in the morning without coffee :) Not a Linux or UNIX issue just how it's written. if the functions are imported as below in lowercase, it works fine. Traps for young players :)

mysql> CREATE FUNCTION damlev RETURNS INTEGER  SONAME 'libdamlev.so';
Query OK, 0 rows affected (0.04 sec)
mysql> select damlev("foo", "ofo");
+----------------------+
| damlev("foo", "ofo") |
+----------------------+
| 2                    |
+----------------------+
1 row in set (0.00 sec)

Hope this helps someone.

rljacobson commented 4 years ago

I will update the README.