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.
Doug
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?
Eric
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 libmysqlclient_r.so → libmysqlclient.so
lrwxrwxrwx 1 root root 20 Jan 21 17:29 libmysqlclient_r.so.18 → libmysqlclient.so.18
lrwxrwxrwx 1 root root 24 Jan 21 17:29 libmysqlclient_r.so.18.0.0 → libmysqlclient.so.18.0.0
lrwxrwxrwx 1 root root 20 Jan 21 17:29 libmysqlclient.so → libmysqlclient.so.18
lrwxrwxrwx 1 root root 24 Jan 21 17:29 libmysqlclient.so.18 → libmysqlclient.so.18.0.0
-rw-r–r-- 1 root root 2972964 Jan 21 17:29 libmysqlclient.so.18.0.0
-rw-r–r-- 1 root root 92998 May 13 2013 libz.a
lrwxrwxrwx 1 root root 38 May 13 2013 libz.so → /lib/arm-linux-gnueabihf/libz.so.1.2.8
from the beaglebone onto the PC with eclipse (into /usr/arm-linux-gnueabihf/lib). Then add a softlink: ln -s libz.so libz.so.1
And then my commands in Eclipse looked like:
COMPILE:
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”
LINKER:
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.
sofjk,
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?
Thanks,
John
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.
thanks
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/…/…/…/…/arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/arm-linux-gnueabihf/lib/libmysqlcppconn.so when searching for -lmysqlcppconn