Claim your Biolink Click Here
1 like 0 dislike
2.0k views
Compiling the MySQL UDF
gcc -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so
/usr/bin/ld: /tmp/cceGvl84.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/tmp/cceGvl84.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [install] Error 1
ERROR: You need libmysqlclient development software installed
to be able to compile this UDF, on Debian/Ubuntu just run:
apt-get install libmysqlclient15-dev
 
in Computers & Internet by (820 points) | 2.0k views
0 0
Propecia Lupus Levitra Con Otros Medicamentos  [url=http://tadalaf.com]generic 5mg cialis best price[/url] Dealing With Anger Caused By Cymbalta Vendita ****** Bari Finasteride Natural Propecia

3 Answers

0 like 0 dislike

add the -fPIC parameter to the command line and I was able to compile w/o error

below is the command

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

by (1.6k points)
0 like 0 dislike

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

And to test

mysql> select sys_exec('ls / > /tmp/out.txt');

OUTPUT
+---------------------------------+
| sys_eval('ls / > /tmp/out.txt') |
+---------------------------------+
| NULL |
+---------------------------------+
1 row in set (0.00 sec)

by
edited
0 like 0 dislike

If still above does not work try below command

DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
DROP FUNCTION IF EXISTS sys_get;
DROP FUNCTION IF EXISTS sys_set;
DROP FUNCTION IF EXISTS sys_exec;
DROP FUNCTION IF EXISTS sys_eval;
CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so'

Test: SELECT sys_exec('curl http://answergig.com/');

by

Related questions

1 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked May 30, 2019 in Education & Reference by Marc (4.7k points) | 278 views
0 like 0 dislike
1 answer
0 like 0 dislike
0 answers

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,310 questions
1,471 answers
569 comments
4,809 users