Community
cancel
Showing results for 
Search instead for 
Did you mean: 
hlim12
Novice
2,160 Views

mysql compile error..

When you compile in my computer error message appears.

 

Error message information is below.

root@lim-13Z940-GH50K:~# $CC -lmraa -lmysqlclient -L/usr/lib/i386-linux-gnu -I/usr/include/mysql gps_0902.c -o gps_0902

cc1: warning: include location "/usr/include/mysql" is unsafe for cross-compilation [-Wpoison-system-directories]

/opt/poky-edison/1.7.2/sysroots/core2-32-poky-linux/lib/libpthread.so.0: undefined reference to `__libc_vfork@GLIBC_PRIVATE'

collect2: error: ld returned 1 exit status

I would like to know a solution.

I currently use Ubuntu 14.04 32bit.

123456789101112131415161718192021222324252627282930313233343536373839404142# include <</span>stdlib.h># include <</span>stdio.h># include <</span>mraa.h># include <</span>mysql.h># include <</span>pthread.h> //void gps_searching(void); # define DB_HOST "14.63.225.210"# define DB_USER "root"# define DB_PASS "appnimal"# define DB_NAME "appnimal_table"# define CHOP(x) x[strlen(x) - 1] = ' ' int main() { MYSQL *connection = NULL, conn; MYSQL_RES *sql_result; MYSQL_ROW sql_row; ...
0 Kudos
13 Replies
idata
Community Manager
128 Views

Hello hwanhee,

 

 

I will try to help you find out why the cross compilation tools aren't letting you compile code that includes mysql.

 

 

Please correct me if I'm wrong, you are trying to execute the command above on the root user, right?

 

 

Could you please let us know step by step what you did (from installing the SDK to installing mysql and mraa) and the steps to replicate the issue? We would like to see if we can replicate this behavior.

 

 

I'll be waiting for your reply.

 

-Peter.
hlim12
Novice
128 Views

1 step. linux 32bit MCU SDK file(.sh) installed.

1) https://downloadcenter.intel.com/download/25028 https://downloadcenter.intel.com/download/25028

2) download

3) in a terminal, "sudo sh poky-edison-glibc-i686-edison-image-core-32-toolchain-1.7.2.sh" enter as a command

2 step. Install MRAA Library

1) in a terminal "sudo apt-get install git cmake swig libpcre3-dev python-dev build-essential" enter as a command

2) in a terminal "git clone http://github.com/intel-iot-devkit/mraa.git" enter as a command

3) in a terminal "cd mraa" enter as a command

4) in a terminal "mkdir build" enter as a command

5) in a terminal "sudo cmake .. -DBUILDSWIGNODE=OFF" enter as a command

6) in a terminal "sudo make" enter as a command

7) in a terminal "sudo make install" enter as a command

8) in a terminal "source /opt/poky-edison/1.7.2/environment-setup-core2-32-poky-linux" enter as a command

3 step. Install mysql

1) in a terminal "sudo apt-get install mysql-server" enter as a command

2) mysql root passward setting

3) in a terminal "sudo apt-get install libmysqlclient-dev" enter as a command

4 step. code compile

in a terminal "$CC -lmraa -lmysqlclient -L/usr/lib/i386-linux-gnu -I/usr/include/mysql gps_0902.c -o gps_0902" enter as a command

and, when in ubuntu 64bit,

Intel system studio IoT Edition (eclipse) should not be compiled.

idata
Community Manager
128 Views

I was testing the steps you provided us but on a Linux 64 bit machine (I don't have access to a 32 bit one). I received a different issue but one that could in fact be related, the issue I received was that mysql could not be found. I would like to ask you in which path you stored your code and in if you tried executing the command with sudo.

 

 

I'll be waiting for your response.

 

-Peter.
hlim12
Novice
128 Views

Hi Peter,

If you can not find or do not have to install mysql for libmysqlclient, you can not mysql.h did the path setting.

libmysqlclient install.

in a terminal "sudo apt-get install libmysqlclient-dev" enter as a command

or, mysql.h no path setting

in a terminal "sudo find / -name mysql.h " enter as a command

Please write out the path to it.

idata
Community Manager
128 Views

Hi hwanhee,

 

 

I was able to replicate the error message using a slightly different command: $CC -lmraa gps_0902.c -o gps_0902 -I/usr/include/mysql/ -L/usr/lib -lmysqlclient.

 

 

Let me try to investigate what could be happening and I'll get back to you.

 

-Peter.
hlim12
Novice
128 Views

Hi Peter,

I'll be waiting for your response.

-Hwanhee

idata
Community Manager
128 Views

Hello hwanhee,

 

 

Could you please enter the command mysql_config --libs? What's the output of that command?

 

 

Could you please try compiling the code but this time including the output of the previous command with $(mysql_config --lib)? Does it also throw an error? Could you please post a screenshot of the compilation?

 

 

Also, have you tried compiling this code on directly on Edison? If so, what happens?

 

 

I'll be waiting for your response.

 

-Peter.
idata
Community Manager
128 Views

Hello hwanhee,

 

 

Do you have any updates about this?

 

 

-Peter.
hlim12
Novice
128 Views

i'm Sorry. I was very busy....

Intel probably would have tried to compile in Edison. It was an error.

I've re-installed the 64-bit Ubuntu.

idata
Community Manager
128 Views

Hi hwanhee,

 

 

Thank you for sending us the screenshot, it will be of help.

 

 

I'm sorry, but I don't understand what you mean by "...Intel probably would have tried to compile in Edison. It was an error…"

 

Could you please explain us what you meant with this?

 

 

Also, were you able to compile your code including the mysql libraries with $(mysql_config --lib)? If so, what happened?

 

Could you please also let us know if you tried your code directly on Edison? If so, does it have any issues?

 

 

Let me know.

 

-Peter.
hlim12
Novice
128 Views

You do not have a problem if you compile in Edison?

And when you try to compile in Edison, do you need Mary db?

and "...Intel probably would have tried to compile in Edison. It was an error…" This need not understand.

I am the one caused by incorrect English.

idata
Community Manager
128 Views

Hi hwanhee,

 

 

I have not tested the code directly on Edison (as I have not installed the other dependencies of the code), nevertheless, when I built the environment for cross compiling I did test if the code would compile with GCC and it did without issues.

 

 

However, it would be interesting to see if you can do this as well and in case you have installed the dependent packages on your board, to check if the code runs correctly on Edison.

 

 

Let me know if you can perform these tests.

 

-Peter.
idata
Community Manager
128 Views

Hi hwanhee,

 

 

Do you have any updates about this?

 

 

-Peter.
Reply