我正在尝试安装和使用MySql UDF Lib,但我在安装过程中遇到了ELF错误。
我在Ubuntu 14.04LTS 64下。
尝试关注其他人的答案并为编译器添加-m64
标志,但仍然有错误。
免责声明:我不是Linux专家,只是尝试解决程序问题
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#
我的mysql file
命令:
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
我的lib file
命令:
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
我的mysqld file
命令:
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
答案 0 :(得分:0)
有点迟到的反应,但比我希望的更好:)
您正在将插件安装到/usr/lib
gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so
但是你的MySQL服务器只是在寻找/usr/lib/mysql/plugin
上安装的插件。
所以,将上面的gcc命令改为
gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/mysql/plugin/lib_mysqludf_sys.so
应修正Can't open shared library 'lib_mysqludf_sys.so'
错误。
希望这有帮助。