Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-2008, 09:05 PM
Greg Hennessy
 
Posts: n/a
Default proper way to compile a UDF

I had a UDF that I used on a Fedora Core 5 machine, and now that I've
upgraded to a Redhat 5 workstation the command line I used to compile
my udf has changed.

Under FC5 I could compile with:
g++ -shared -fPIC -lstdc++ -I /usr/include/mysql -o udf_vec2pix.so
udf_vec2pix.cc -lchealpix

Under RH5 the same attempt throws off errors:

[gsh@cygnus mysql-udf]$ g++ -shared -fPIC -lstdc++ -I
/usr/include/mysql -o udf_vec2pix.so udf_vec2pix.cc -lchealpix
/usr/bin/ld: /usr/local/lib/libchealpix.a(vec2pix_nest.o): relocation
R_X86_64_32 against `a local symbol' can not be used when making a
shared object; recompile with -fPIC
/usr/local/lib/libchealpix.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
[gsh@cygnus mysql-udf]$

I can get muck around and get it to compile via:
g++ -c -fPIC -I /usr/include/mysql -o udf_vec2pix.so udf_vec2pix.cc

but when I drop that in to my /lib64 directory, and try to add it I
get:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1154
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE FUNCTION vec2pix RETURNS INT SONAME 'udf_vec2pix.so';
ERROR 1126 (HY000): Can't open shared library 'udf_vec2pix.so' (errno:
22 /lib64/udf_vec2pix.so: only ET_DYN and ET_EXEC can be loaded)
mysql>

Can anyone offer me advice on the command that I should be using to
compile my udf?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-12-2008, 11:21 PM
toby
 
Posts: n/a
Default Re: proper way to compile a UDF

On Jun 10, 6:05*pm, Greg Hennessy <greg.henne...@cox.net> wrote:
> I had a UDF that I used on a Fedora Core 5 machine, and now that I've
> upgraded to a Redhat 5 workstation the command line I used to compile
> my udf has changed.
>
> Under FC5 I could compile with:
> g++ -shared -fPIC -lstdc++ -I /usr/include/mysql -o udf_vec2pix.so
> udf_vec2pix.cc -lchealpix
>
> Under RH5 the same attempt throws off errors:
> ...
> Can anyone offer me advice on the command that I should be using to
> compile my udf?


Hi Greg,

I'd start with a) the fine manual, b) the udf_example code and see if
you can get that to build and load on RH. If so, transfer the build
recipe from their Makefile.

Drop me a line if you can't get anywhere.

--Toby
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:16 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.