mysql.png How to connect to a MySQL remote database from your Nokia 770 ?

The Nokia 770 runs with a TI OMAP 1710, an ARM family processor, the default MySQL pre-compiled libraries you can find are usually build for x86 processors.
So you have to compile your own libraries for an ARM processor and I will try explain how I succeed to do this.The main goal is to have mysqlclient libraries to connect to a MySQL database, I'm using C language.

If you need those libraries, you have surely installed the Maemo community's sdk.
No ? Follow me.
First install it, you will find their nice tutorial here: Maemo's tutorial , I have used the defaults and stables choices.
Don't forget to install the building environment for ARM.

Then you have to get the mysql sources, you can find it on MySQL's site, I have chosen the latest MySQL Community Edition which was the 5.0 when i did this tutorial.

Now we have all the tools to compile our mysqlclient library. Connect to your scratchbox and activate the the ARM package, when it will be done you have a prompt like below:

[sbox-SDK_ARM: ~] >

Extract the mysql sources tarball, for all those commands, I suppose that you are in your scratchbox home directory:

[sbox-SDK_ARM: ~] > tar xvzf mysql-xxx.tar.gz

xxx is the version you want to install.
Create a directory, we will install mysql in.

mkdir mysql-ARM

Move into the directory extracted and modify the configure script file with your favorite editor. We have to edit it cause if you try to run configure now, an error will occured saying that it cannot find the ps command suited because it cannot determine the os:

Could not find the right ps switches. Which OS is this ?

So we will comment the test to inhibite this error, there are no consequences for the libraries.

cd mysql-xxx
vi configure

Find this sentence in the file: "Which OS is this ?", comment like i do below:

Before:

{ { echo "$as_me:$LINENO: error: Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual." >&5
echo "$as_me: error: Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual." >&2;}
{(exit 1); exit 1;
}; }

After:

{}
# { { echo "$as_me:$LINENO: error: Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual." >&5
#echo "$as_me: error: Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual." >&2;}
# {
#(exit 1); exit 1;
# }; }%%

but However if you really want to install the whole software, take a look before the comments, you will see all the operating systems tests and you may write in hard the good ps command.

Now you can start the configuration and installation:

CC=arm-linux-gcc LD=arm-linux-ld ./configure --without-server -prefix=/scratchbox/users/<user>/home/<user>/mysql-ARM
make
make install

If you want the whole software, erase the --without-server option. the -prefix option is to determinate where do you want the program to be installed, choose the directory previously created.

Now your libraries are built and availables, you can find them in your installation directory in the directories include and lib, no problems to move them.

Here is a compilation example:

gcc -c prog.c
gcc -o prog_exec prog.o mysql_lib/libmysqlclient.a

:)



Please apologize my english, my practice in Finland is also to improve it :p
I want to thanks karlkox from the clubic forum for his help.