Cross compiling simple pcap example

Kai Ruottu kai.ruottu@wippies.com
Mon Jun 20 15:41:00 GMT 2011


20.6.2011 15:19, Kent Kvarfordt kirjoitti:
> List,
>
> I am trying to cross compile a simple pcap example (see below) on a
> 64-bit Ubuntu 11.4 installation targeting a 32-bit Ubuntu 11.4
> installation.  When I set the -m32 option, the example compiles fine,
> but fails to link with the following error.
>
> /usr/bin/ld skipping incompatible /usr/lib/libpcap.so when searching for -lpcap
>
> This makes sense given the /usr/lib/libpcap.so is the 64-bit pcap
> library.  I tried installing the 32-bit pcap package along side the
> 64-bit package, but the installation failed saying the
> packages/libraries could not co-exist.

This seems to be a bug in the Ubuntu 11.04 install schemes. When
investigating the 32-bit library install place, one sees :

[root@localhost host-Ubuntu11.04_i686]# ar xv 
/home/Asennus/Ubuntu/11.04/i386/libpcap0.8_1.1.1-2_i386.deb data.tar.gz
x - data.tar.gz
[root@localhost host-Ubuntu11.04_i686]# tar tvzf data.tar.gz
drwxr-xr-x root/root         0 2010-05-09 18:44:28 ./
drwxr-xr-x root/root         0 2010-05-09 18:44:26 ./usr/
drwxr-xr-x root/root         0 2010-05-09 18:44:33 ./usr/lib/
-rw-r--r-- root/root    206936 2010-05-09 18:44:33 
./usr/lib/libpcap.so.1.1.1
<snip>
lrwxrwxrwx root/root         0 2010-05-09 18:44:31 
./usr/lib/libpcap.so.0.8 -> libpcap.so.1.1.1

So the place is just the same :(  BUT even the 32-bit Ubuntu 11.04
doesn't put the 32-bit libraries into '/usr/lib' but into
'/usr/lib/i386-linux-gnu'. So the basic question is where the 32-
bit libraries should be in the 64-bit system? The rest is easy as
a pie: just unpack the '.deb' archive somewhere, then untar the
'data.tar.gz' in it and copy/move the required stuff where it should
be.

Of course this kind of 'manual install' will not be known by the
package managers but who will care...



More information about the Gcc-help mailing list