List:General Discussion« Previous MessageNext Message »
From:Shahram Ghandeharizadeh Date:July 29 2014 10:35am
Subject:RE: UDF Not Compiling
View as plain text  
I cannot author a UDF using MySQL.  I use the MySQL provided udf_example.cc 
and compile it using the following command:
sudo gcc -shared -fPIC -I /usr/include/mysql -o /usr/lib/mysql/plugin/udf_example.so
udf_example.cc

Next, I login to mysql, connect to my database, and author one of the provided functions
found in udf_example.cc:  

CREATE FUNCTION myfunc_int RETURNS int SONAME 'udf_example.so'; 

It generates the following error:
ERROR 1127 (HY000): Can't find symbol 'myfunc_int' in library

Per comments in udf_example.cc, I have verified that column 'type' exists in
the mysql.func.  I have run mysql_upgrade and still get the same error.

If I compile the udf_example.cc with the -c option, when issuing the "CREATE FUNCTION ..."
command, I see the following error:
ERROR 1126 (HY000): Can't open shared library 'udf_example.so' (errno: 0
/usr/lib/mysql/plugin/udf_example.so: only ET_DYN and ET_EXEC can be loaded)


>How-To-Repeat:
        <code/input/activities to reproduce the problem (multiple lines)>
>Fix:
        <how to correct or work around the problem, if known (multiple lines)>

>Submitter-Id:  <submitter ID>
>Originator:
>Organization:
 <organization of PR author (multiple lines)>
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:      <synopsis of the problem (one line)>
>Severity:      <[ non-critical | serious | critical ] (one line)>
>Priority:      <[ low | medium | high ] (one line)>
>Category:      mysql
>Class:         <[ sw-bug | doc-bug | change-request | support ] (one line)>
>Release:       mysql-5.5.38-0+wheezy1 ((Debian))
>C compiler:    gcc-4.7.real (Debian 4.7.2-5) 4.7.2

>C++ compiler:  g++-4.7.real (Debian 4.7.2-5) 4.7.2

>Environment:
        <machine, os, target, libraries (multiple lines)>
System: Linux rdbms 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc
GCC: Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-h-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7
--enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes--enable-gnu-unique-object --enable-plugin --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)
Compilation info (call): CC='/usr/bin/x86_64-linux-gnu-gcc'  CFLAGS='-O2
-DBIG-DBIG_JOINS=1  -fno-strict-aliasing  -Wall -O2 -g -DDBUG_OFF' 
CXX='/usr/bin/x86_64-linux-gnu-g++'  CXXFLAGS='-O3 -DBIG_JOINS=1 -felide-constructors
-fno-exceptions -fno-rtti  -fno-strict-aliasing  -Wall -Wno-unused-parameter
-fno-implicit-templates -fno-exceptions -fno-rtti -O2 -g -DDBUG_OFF'  LDFLAGS='' 
ASFLAGS=''
Compilation info (used): CC='/usr/bin/x86_64-linux-gnu-gcc'  CFLAGS='-O2
-DBIG-DBIG_JOINS=1  -fno-strict-aliasing  -Wall -O2 -g -DDBUG_OFF' 
CXX='/usr/bin/x86_64-linux-gnu-g++'  CXXFLAGS='-O3 -DBIG_JOINS=1 -felide-constructors
-fno-exceptions -fno-rtti  -fno-strict-aliasing  -Wall -Wno-unused-parameter
-fno-implicit-templates -fno-exceptions -fno-rtti -O2 -g -DDBUG_OFF'  LDFLAGS='' 
ASFLAGS=''
$-linux-gnu-thread-multi
Perl: This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux$




Thread
UDF Not CompilingShahram Ghandeharizadeh29 Jul 2014
RE: UDF Not CompilingShahram Ghandeharizadeh29 Jul 2014