Mysql-arm-linux-gcc Compilation error: libc. soformatnotrecognized.

Source: Internet
Author: User
I am a newbie and have never touched arm development before. I have encountered difficulties in completing the two-day design. please help me to read it and thank you first! My Development Board is a lab Gateway (HBE-UBI-box2) that collects information from sensors. Compile the compiled C file into a cgi file through the arm-linux-gcc compiler (Compile Command: arm-linux-gcc-oinfo.cgiinfo.c) info. c is the file I wrote. After compilation, it is uploaded to the gateway. then you can access the gateway to see the program implementation result. However, the mentor said a few days ago that the Gateway cannot support a large amount of access at the same time. I want to upload the sensor data collected by the gateway to the mysqlarmarm development board of the lab.

New to me, I have never touched on arm development before. I have encountered difficulties in completing the design in the past two days. please take a look,
Thank you!
My Development Board is a lab Gateway (HBE-UBI-box2) that collects information from sensors. Compile the compiled C file into a cgi file through the arm-linux-gcc compiler (Compile Command: arm-linux-gcc-o info. cgi info. c) info. c is the file I wrote. After compilation, it is uploaded to the gateway. then you can access the gateway to see the program implementation result.
However, a few days ago, the mentor said that the Gateway cannot support a large amount of access at the same time. I want to upload the sensor data collected by the gateway to the laboratory server, and then write a website to access the data on the server... Well, I dare not resist either. I have built a MySQL database on the server and written several JSPS to access the database.
However, it is difficult to transmit data from the gateway to the server. At the beginning, I thought it was very simple.
This code is added to the code that does not connect to the mysql database:
Int connmysql (){

      MYSQL mysql, *sock;        mysql_init(&mysql);      if (!(sock = mysql_real_connect(&mysql, "XXX", "XXX", "XXX", "XXX", 0, NULL, 0)))      {      printf("Cannot connect to database:%s\n",mysql_error(sock));      return 0;      }  

Char sqlbuf [200] = "insert into sensordata VALUES ('0', 'sstatus. ID', 'sstatus. illumi', 'sstatus. temp ', 'sstatus. humid', 'sstatus. battery ');";

   if (mysql_query(sock, sqlbuf))     {      printf("Query Failed:%s", mysql_error(sock));      return 0;     }     mysql_close(sock);return 0;

}

Among them, the IP address in the database connection statement and the user name and password are correct. I replaced it with XXX ~...

The code is also written, but I reported an error when compiling it with arm-linux-gcc-o. Baidu found it too simple. As instructed by others, mysql clients and servers are installed on the Ubuntu virtual machine.
1. sudo apt-get install mysql-server
2. apt-get install mysql-client
3. sudo apt-get install libmysqlclient-dev
Many compilation commands have been found. The path of the library used for compilation should be added. The final command is as follows: arm-linux-gcc-I '/usr/include/mysql'-L'/usr/lib/i386-linux-gnu '-lmysqlclient-lpthread-lz-lm-lrt-ldl-o info. cgi mysql-info.c.
At this time, the nightmare started. at the beginning, I reported a lot of errors, so I had to troubleshoot them one by one. The bitterness was not shown yet, but there was still a problem that could not be solved:

The error message is: the file format of libc. so is not recognized and parsed incorrectly. I haven't found the libc suitable for arm programming for a long time. so files can only be used for help. if you have a solution or have a new idea for the idea of this project (that is, you can implement the same function without connecting to mysql through arm) thank you for your advice ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.