Beaglebone Using MySQL

I am attempting to cross compile a C program using MySQL on Ubuntu for the Beaglebone. I can compile manually on either the Beaglebone or Ubuntu and it works. However when I compile in Eclipse to do the cross compiling it fails. Does anyone have a solution or idea on how to get cross compiling of MySQL to work?

This sounds like an Eclipse configuration issue and while you might find someone here who has run Eclipse cross compiling to gcc-arm, it is likely that you’ll find far more familiar with setting up Eclipse for cross compiling in an Eclipse or gcc forum. Or better yet a MySQL forum. A first step might be to verify your Eclipse configuration can compile MySQL to your Ubuntu x86 platform( ie no cross compiling ). That will also give experience with the Eclipse build and make system and give you a working configuration to compare your cross compiling build environment against.


Why compile MySql at all for the bone? I believe it's already part of
the standard repo. as for a c program that uses MySql wouldn't you
just generate SQL queries to run against the database?


It took some time but I figured it out. The solution is to copy the following (/usr/lib/arm-linux-gnueabihf)

-rw-r–r-- 1 root root 3935832 Jan 21 17:29 libmysqlclient.a
lrwxrwxrwx 1 root root 16 Jan 21 17:29 libmysqlclient_r.a → libmysqlclient.a
lrwxrwxrwx 1 root root 17 Jan 21 17:29 →
lrwxrwxrwx 1 root root 20 Jan 21 17:29 →
lrwxrwxrwx 1 root root 24 Jan 21 17:29 →
lrwxrwxrwx 1 root root 20 Jan 21 17:29 →
lrwxrwxrwx 1 root root 24 Jan 21 17:29 →
-rw-r–r-- 1 root root 2972964 Jan 21 17:29
-rw-r–r-- 1 root root 92998 May 13 2013 libz.a
lrwxrwxrwx 1 root root 38 May 13 2013 → /lib/arm-linux-gnueabihf/

from the beaglebone onto the PC with eclipse (into /usr/arm-linux-gnueabihf/lib). Then add a softlink: ln -s
And then my commands in Eclipse looked like:
arm-linux-gnueabihf-gcc -I/usr/include/mysql -O0 -g3 -Wall -c -fmessage-length=0 mysql_config --cflags --libs -MMD -MP -MF"main.d" -MT"main.d" -o “main.o” “…/main.c”
arm-linux-gnueabihf-g++ -L/usr/arm-linux-gnueabihf/lib -o “test” ./main.o -lmysqlclient

And now I can cross compile my code to access mySQL in the BeagleBone.


I’ve been battling cross compiling for mysql all day and I finally came across your post. I have done what you have posted as the solution. Currently, I cannot do a #include “mysql.h” in my code on eclipse, and it be recognized as a file. Can you please be more specific with instructions on how you were able to cross compile mysql from a linux machine to the beaglebone? I do not run eclipse as root, would you say that is my problem sense I had to go and do a round about way of coping the files over from the beaglebone to eclipse? meaning my permissions are the same but I don’t get the ‘l’ in front of the permission descriptor. Do run eclipse as root in order to do this?



Are you able to cross compile the mysql on ubuntu for arm processor used in beaglebone. I have been trying to do so but facing some big problems. Can you help with the steps you carried. Great if u reply asap.
Thank You

hi Soft,
Can you help me?
when i compiled, i got
skipping incompatible error.


/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/…/…/…/…/arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/arm-linux-gnueabihf/lib/ when searching for -lmysqlcppconn