Tiny Core Linux

General TC => Programming & Scripting - Unofficial => Topic started by: blackdiamond on December 29, 2013, 05:37:52 PM

Title: enabing mysql compilation
Post by: blackdiamond 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




Title: Re: enabing mysql compilation
Post by: gerald_clark on December 29, 2013, 06:45:52 PM
You failed to 'tce-load -i mysql'
Title: Re: enabing mysql compilation
Post by: bmarkus 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.


Title: Re: enabing mysql compilation
Post by: blackdiamond 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

Title: Re: enabing mysql compilation
Post by: Rich 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
Title: Re: enabing mysql compilation
Post by: blackdiamond 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,

Title: Re: enabing mysql compilation
Post by: blackdiamond 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
Title: Re: enabing mysql compilation
Post by: bmarkus on December 30, 2013, 11:55:54 PM
Use provides function of application browser to find out which package provides a file.
Title: Re: enabing mysql compilation
Post by: blackdiamond 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


Title: Re: enabing mysql compilation
Post by: blackdiamond 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
Title: Re: enabing mysql compilation
Post by: bmarkus on January 06, 2014, 10:45:28 PM
Move .so files to /usr/local/lib and if not loading from .tcz ldconfig
Title: Re: enabing mysql compilation
Post by: Juanito on January 06, 2014, 11:29:48 PM
..and once copied:
Code: [Select]
$ sudo ldconfig
Title: Re: enabing mysql compilation
Post by: blackdiamond 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