MySQL Cross-Compile Libraries

Hello,

I am trying to put a MariaDB database on the iMX6. So far, I have been able to bitbake an image with the following lines added to local.conf:

IMAGE_INSTALL_append = " mysql5"
IMAGE_INSTALL_append = " mariadb"
ACCPET_FSL_EULA = "1"
ACCEPT_FSL_EULA = "1"

Now, I am trying to cross-compile C code to interface with this database. I am running this command to compile the code and am continuously being return the error below.

Command: ${CC} -o testing testing.c -Wall mysql_config --libs -I/usr/include/mariadb -I/usr/include/mariadb/mysql

Error:

cc1: warning: include location "/usr/include/mariadb" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/mariadb/mysql" is unsafe for cross-compilation [-Wpoison-system-directories]
testing.c: In function ‘main’:
testing.c:185:12: warning: unused variable ‘row’ [-Wunused-variable]
  MYSQL_ROW row;
            ^~~
testing.c:184:13: warning: unused variable ‘res’ [-Wunused-variable]
  MYSQL_RES *res;
             ^~~
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libmysqlclient.so while searching for mysqlclient
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: error: cannot find -lmysqlclient
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so while searching for pthread
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so while searching for z
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/librt.so while searching for rt
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libssl.so while searching for ssl
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libcrypto.so while searching for crypto
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libdl.so while searching for dl
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so while searching for m
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so while searching for c
/tmp/ccZlPnFv.o:testing.c:function main: error: undefined reference to 'mysql_init'
/tmp/ccZlPnFv.o:testing.c:function main: error: undefined reference to 'mysql_real_connect'
/tmp/ccZlPnFv.o:testing.c:function main: error: undefined reference to 'mysql_error'
/tmp/ccZlPnFv.o:testing.c:function main: error: undefined reference to 'mysql_close'
collect2: error: ld returned 1 exit status

Is there somewhere else I can find the correct libraries? How do I generate libraries specific to this build?

Thank you for taking the time to answer my question. I truly appreciate it

  • Samantha

Hi Samantha,

Where did you obtain the cross-compile toolchain you are using? did you generate a new toolchain after you built the image with the database packages?

Best Regards,
Jeremias

Hello @jeremias.tx!

I am using the cross-compiler that this tutorial highlighted. This is all being done from the command line, not using Eclipse.

Is there a way to generate a new toolchain with the database packages? Or a way to download these libraries?

Thank you,

Samantha M

Please check this article.