WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: enabing mysql compilation  (Read 3481 times)

Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
enabing mysql compilation
« on: December 29, 2013, 05:37:52 PM »
Hello fellows:
I am spending some hours to enable and run properly a mysql client linked to a centos server (no problem to accomplish the tasks with it, even running with command for compilation

mysql_config --libs
mysql_config --cflags
#gcc -o <filebin> $(mysql_config --cflags) <main.c> $(mysql_config --libs)

). actually i have a little program to look for data (select, etc.) I am developing with codeblocks and have done the next>

tc@box: tce-load -i mysql-client
tc@box: tce-load -i mysql-dev

also configured codeblocks with setting>compiler & debuger:
link libraries: /usr/local/mysql/lib/libmysqlclient.so
search directories : /usr/local/mysql/include

C program in codeblocks:

#include <stdlib.h>
#include <stdio.h>
#include <mysql.h>
.
.
   MYSQL *conn;
   MYSQL_RES *res;
   MYSQL_ROW row;
   char *server = "ipaddress";
   char *user = "databaseuser";
   char *password = "passworddatabase";
   char *database = "database";

int main(void)
{
    conn = mysql_init(NULL);
    if (mysql_real_connect(conn, server,
         user, password, database, 0, NULL, CLIENT_MULTI_STATEMENTS) == 0x00)
    {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
    }
    if (mysql_query(conn, "SELECT * FROM ORDENES; SELECT * EMPLEADOS;"))
   {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
    }
<more code>
    }

After compilation, no errors are reported and exist an executable program.

Either runnig in codeblocks or in a terminal, the next message appears:

/home/tc/MIBM_CLIENTE/bin/Debug/MIBM_CLIENTE: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

Process returned 127 (0x7F)   execution time : 0.011 s
Press ENTER to continue.

I have entered deeply in the google search and in the actual forum with no other similar post.

If I do the procedure as with centos, the scripts and gcc commands return messages as:
tc@box:~/MIBM_CLIENTE$ mysql_config --libs
sh: mysql_config: not found
tc@box:~/MIBM_CLIENTE$ mysql_config --cflags
sh: mysql_config: not found
tc@box:~/MIBM_CLIENTE$ gcc -o <filebin> $(mysql_config --cflags) <main.c> $(mysq
l_config --libs)
sh: mysql_config: not found
sh: mysql_config: not found
sh: can't open filebin: no such file
tc@box:~/MIBM_CLIENTE$
tc@box:~/MIBM_CLIENTE$

Maybe the procedure to enable mysql in tiny core is completely different.

Does any body has a hint?

Regards,

blackdiamond





Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: enabing mysql compilation
« Reply #1 on: December 29, 2013, 06:45:52 PM »
You failed to 'tce-load -i mysql'

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7023
    • My Community Forum
Re: enabing mysql compilation
« Reply #2 on: December 29, 2013, 06:49:00 PM »
How do you expect answer without telling which system are you talking about?

- x86
- x86_64
- armv6

- TC 4.x
- TC 5.x

Just wasting others time. Please honour others who are spending their free time to help forum members, it is not a paid support line.


Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #3 on: December 30, 2013, 02:04:54 PM »
Hi gerald_clark:

I have issue the command tce-load -i mysql with the same result. I will get more info from the web in order to have success with the little project, Thanks a Lot for you kind help.


Blackdiamond


Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6959
Re: enabing mysql compilation
« Reply #4 on: December 30, 2013, 05:41:47 PM »
Hi blackdiamond
As bmarkus pointed out, you should provide specific information as to which version of Tinycore you are running.
For TC4 you need  mysql. However, if you are running TC5 you need  mariadb-lib.tcz  to resolve this error:
Quote
/home/tc/MIBM_CLIENTE/bin/Debug/MIBM_CLIENTE: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
You might also require  mariadb-clients

Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #5 on: December 30, 2013, 07:44:57 PM »
thanks a lot,let me play and identify two TC versions installed. I will post it soon.

Regards,


Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #6 on: December 30, 2013, 08:09:53 PM »
Ok guys, Here I come with the required info:

Virtual Box running 4.6.2  or 4.7.7 for development in x86/64 bits.
target controller with atom x86 / 2GB RAM stabd alone USB flash (4GB). with 4.6.2 tc version.

I will try also with the last version of TC and libraries as posted by Rich.

I am so sorry about not describe the versions and platforms.

Regards,

BD

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7023
    • My Community Forum
Re: enabing mysql compilation
« Reply #7 on: December 30, 2013, 11:55:54 PM »
Use provides function of application browser to find out which package provides a file.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #8 on: December 31, 2013, 06:31:09 AM »
Hello Again:

As remarked in provides function of App < mysqlclient.so >, is provided by mysql.tcz.for both 4.6.2 & 4.7.7 coreplus

MYSQL is enabled by issuing tce's as follows, before any compilation process:

tce-load -i mysql-client
tce-load -i mysql-dev
tce-load -i mysql

thanks for your help.
BD



Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #9 on: January 06, 2014, 09:10:55 PM »
Hi guys:

Taking the review under TC 4.6.2, I have followed the structure of the SQLITE3 tcz that I have used in other project that was correctly compiled and run.

sqlite lib's are under:
/tmp/tcloop/sqlite3/usr/local/lib/sqlite3.so with a sym link into /usr/local/lib/sqlite3.so

also under /tmp/tcloop/sqlite3/usr/local/lib/*sqlite3.so.0.8.6 has symlinks under the same dir path as sqlite3.so and sqlite3.0

as for mysql, I have tried to make an exact reflection with mysql as follows,

/tmp/tcloop/mysql/usr/local/mysql/lib/*libmysqlclient.so.18.0.0 with symlinks under the same dir path as found
@libmysqlclient.so  -> libmysqlclient.so.18

Now I have tried to make a symlink under tc box command
ln -s //tmp/tcloop/mysql/usr/local/mysql/lib/*libmysqlclient.so.18.0.0 /usr/local/lib/libmysqclient.so

in a test under codeblocks, I put the linker to point to /usr/local/mysql/lib/libmysqlclient.so

It had compiled and run only once correctly, but doing another activity I have restarted the Tiny Core without backup.

Now I have tried again the steps above but  I have the original results, error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory.

Perhaps I need to make a step I have missed to do in the process.

Any hint to enable the libmysqlclient.so again?

Regards,

BD

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7023
    • My Community Forum
Re: enabing mysql compilation
« Reply #10 on: January 06, 2014, 10:45:28 PM »
Move .so files to /usr/local/lib and if not loading from .tcz ldconfig
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 11108
Re: enabing mysql compilation
« Reply #11 on: January 06, 2014, 11:29:48 PM »
..and once copied:
Code: [Select]
$ sudo ldconfig

Offline blackdiamond

  • WikiUser
  • *
  • Posts: 9
Re: enabing mysql compilation
« Reply #12 on: January 07, 2014, 04:11:28 AM »
Thanks !!!

sudo ldconfig enable everything and now it runs, Thakyou very much and I appreciate your help.

Blackdiamond