Cross compile PostgreSQL client app

Fernando Vilmar Palha
Greetings.

I am trying to compile a connection test with PostgreSQl 8.4 in Emdebian on
a Mini2440.

<code>
#include <libpq-fe.h>
</code>

This command works:
g++ -I/usr/include/postgresql/ -L/usr/lib/postgresql/8.4/lib/ -lpq -o
PSQLTest PSQLTest2.cpp

But this commando does not works:
arm-linux-gnueabi-g++ -I/usr/include/postgresql/
-L/usr/lib/postgresql/8.4/lib/ -lpq -o PSQLTestEmdebian PSQLTest2.cpp

<code>
/usr/lib/gcc/arm-linux-gnueabi/4.3.5/../../../../arm-linux-gnueabi/bin/ld:
cannot find -lpq
collect2: ld returned 1 exit status
</code>


Someone has a tip?

Regards.

Fernando Vilmar Palha

Tomasz Myrta
File you are looking for should be in directory /usr/arm-linux-gnueabi/lib.
You can download http://packages.debian.org/libpq-dev for arm/armel
architecture and install on your x86 development machine using dpkg-cross.

Fernando Vilmar Palha
Greetings.

Thank you Tomasz.

The directory /usr/arm-linux-gnueabi/lib exists, but the libpq does not
exists.

I downloaded the file "libpq-dev_8.4.16-0squeeze1_armel.deb" from
http://packages.debian.org/libpq-dev and I ran the command:

dpkg-cross -a armel -i libpq-dev_8.4.16-0squeeze1_armel.deb

But has many dependences.

How I can install the library? I need download all dependences?

Regards.

Fernando Vilmar Palha
Hi.

I followed the forum
"http://web.archiveorange.com/archive/v/bWlyQyWPZWxX0fT5lt9L";.

I added the line in "/etc/apt/sources.list":

deb http://security.debian.org/debian-security squeeze/updates main 
deb http://backports.debian.org/debian-backports squeeze-backports main

I ran the commands:

root@VM-Debian:/home/fvpalha# apt-cache search xapt
xapt - retrieve, build and install libraries for cross-compiling
root@VM-Debian:/home/fvpalha# apt-get install xapt
root@VM-Debian:/home/fvpalha# xapt -a armel libpq-dev
root@VM-Debian:/home/fvpalha/Downloads# ls
/usr/arm-linux-gnueabi/lib/libpq*
/usr/arm-linux-gnueabi/lib/libpq.a   /usr/arm-linux-gnueabi/lib/libpq.so.5
/usr/arm-linux-gnueabi/lib/libpq.so 
/usr/arm-linux-gnueabi/lib/libpq.so.5.2

Now the command works:

arm-linux-gnueabi-g++ -I/usr/include/postgresql/
-L/usr/arm-linux-gnueabi/lib/ -lpq -o PSQLTestEmdebian PSQLTest2.cpp

Thank you.