MySQL UDF - wrong ELF class: ELFCLASS32
Unfortunately, mysql_config contains quite a bit of black magic and quite a bit of blatant sketchiness.  It's notoriously untrustworthy if you have more than one copy of it or the version doesn't match your server build.

Unfortunately, too, if you're using one from a distro (not official binaries) then that utility may not even be in the same package as the server... it's bundled with the client, which could easily be 32 bit and work just fine with a 64-bit server.

$ mysql_config
The program 'mysql_config' can be found in the following packages:
 * libmysqlclient-dev
 * libmariadbclient-dev
Try: sudo apt-get install &lt;selected package&gt;


Not confidence-inspiring.

$ mysql_config --version
5.5.40


Neat, I don't even have server on this particular system, and never have.

So, that gives you a sense of how much hocus pocus this little utility can sometimes offer up.  

Fundamentally, though, there's this: wrong ELF class: ELFCLASS32 means you compiled the plugin for 32 bit, but your server is indeed 64 bit.

The missing piece from your compiler flags is -m64.  If you add that and remove the -m32 (I'm not sure where that's coming from... mysql_config doesn't include either one on my test system) then you should be able to get that plugin to compile and install.

You have the plugin in the correct directory, or the system wouldn't have found the file to complain about the architecture it was compiled for.