MySql UDF using shared library won't load
I am attempting to create a mysql UDF开发者_开发技巧 which will match a fingerprint using Digital Persona's free linux SDK library. I have written a trivial UDF as a learning experience which worked fine. However, when I added a dependency to Digital Persona's shared object I can no longer get MySql to load my UDF.
I added includes to DP's headers and compiled my UDF using:
gcc -fPIC -Wall -I/usr/src/mysql-5.0.45-linux-i686-icc-glibc23/include -shared -o dp_udf.so dp_udf.cc
I also tried adding the -static argument, but whenever I restart MySql, I get the error:
Can't open shared library 'dp_udf.so' (errno: 0 /usr/local/mysql/lib/plugin/dp_udf.so: undefined symbol: MC_verifyFeaturesEx)
MC_verifyFeaturesEx is a function defined "dpMatch.h" which I included, and is implemented in libdpfpapi.so which I have tried placing in the same location as my dp_udf.so and in /usr/lib.
Am I doing something wrong with my call to gcc (my C++ skills are rusty) or does MySql not allow UDFs to use additional shared objects?
Your problem is that your library depends on another, bu MySQL/dl doesn't know this and therefore doesn't load it. You need to explicitly link your library against Digital Persona's library. You can do this by using the -l{libname}
(and maybe -L/lib/path
).
精彩评论