GIJOW
GIJOW

Reputation: 2343

MySQL UDF Lib Install

I'm trying to install and use MySql UDF Lib but I'm facing an ELF error on its install procedure.

I'm under Ubuntu 14.04LTS 64.

Tried to follow some others answers and added -m64 flag for compiler, and still having the error.

Disclaimer: I'm not linux specialist, just trying a solution for a program issue

root@server:/usr/lib/mysql/plugin# sh install.sh
Compiling the MySQL UDF
gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so
MySQL UDF compiled successfully
-e
Please provide your MySQL root password
Enter password:
ERROR 1126 (HY000) at line 29: Can't open shared library 'lib_mysqludf_sys.so' (errno: 11 /usr/lib/mysql/plugin/lib_mysqludf_sys.so: wrong ELF class: ELFCLASS32)
ERROR: unable to install the UDF
root@server:/usr/lib/mysql/plugin#

My mysql file command:

root@server:/usr/bin# file mysql
mysql: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=23996cc38af44cd87dbcde82f46c47f9047769b0, stripped

And my lib file command:

root@server:/usr/lib# file lib_mysqludf_sys.so
lib_mysqludf_sys.so: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=8bcbe183af9bd452325f14c89810a34c5bfbbedd, not stripped

And my mysqld file command:

root@server:/run/mysqld# file /usr/sbin/mysqld
/usr/sbin/mysqld: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=eaac3628f59f9bfefceacef50d86d8cb834c0a7a, stripped

Upvotes: 1

Views: 4095

Answers (1)

ozbek
ozbek

Reputation: 21183

A bit late response, but better than never I hope :)

You are installing the plugin to /usr/lib

gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so

But your MySQL server is only looking for plugins installed on /usr/lib/mysql/plugin.

So, changing the above gcc command to

gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/mysql/plugin/lib_mysqludf_sys.so

Should fix the Can't open shared library 'lib_mysqludf_sys.so' error.

Hope this helps.

Upvotes: 1

Related Questions