my /etc/ld.so.conf file contained path /usr/lib/mysql and I thought /sbin/ldconfig would build the cache so mysql will be able to see /usr/lib/mysql/ntp2timestamp.so, but it didn't. I have renamed my .so file to libntp2timestamp.so and it worked. Seems, ldconfig ignores libraries in untrusted directories which do not start with lib prefix. I not sure why it is done this way, but oh well...
now it works perfectly. I was sure it should work with --with-mysqld-ldflags=-all-static configuration option used and seems I was right. Anyway thanks for your time and your help. Really appreciate it
Best Regards,
Matt W wrote:
Hi George,
I think the MySQL-Max RPM is dynamically linked (all -max binaries actually) if you want to give it a try.
Hope that helps.
Matt
----- Original Message ----- From: "George Chelidze" Sent: Monday, October 27, 2003 9:18 AM Subject: CREATE FUNCTION problem
Hello, I have created new udf function which converts time from NTP format to timestamp. I compile it with the following command:
gcc -Wall -shared -o ntp2timestamp.so ntp2timestamp.cc
with no errors.
Then I copy this file to /usr/local/mysql (libmysql* files are located here and /etc/ld.so.conf file contains this path as well) and execute the following under mysql:
CREATE FUNCTION ntp2timestamp RETURNS STRING SONAME
"ntp2timestamp.so";
and I get an error:
ERROR 1126: Can't open shared library 'ntp2timestamp.so' (errno: 22 ntp2timestamp.so: cannot open shared object file: No such file o)
MySQL is installed from RPM and I have found that it might be configured with --with-mysqld-ldflags=-all-static instead of --withmysqld-ldflags=-rdynamic and I dought this is the problem but I ahve also found the following sentence in manual:
-- cut here -- For mysqld to be able to use UDF functions, you should con gure MySQL with --withmysqld- ldflags=-rdynamic The reason is that to on many platforms (including Linux) you can load a dynamic library (with dlopen()) from a static linked program, which you would get if you are using --with-mysqld-ldflags=-all-static If you want to Chapter 9: Extending MySQL 559 use an UDF that needs to access symbols from
mysqld
(like the methaphone example in `sql/udf_example.cc' that uses default_charset_info), you must link the program with -rdynamic (see
man
dlopen). -- cut here --
so is it nessesary to configure it
with --with-mysqld-ldflags=-rdynamic?
I'd like it to be installed from RPM rather source code, is there another workaround? Thanks in advance.
Best Regards,
-- George Chelidze
-- George Chelidze
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]