This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cross compiling simple pcap example


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.

Is it possible to build the example so it is truly dynamically linked
at run-time on the 32-bit installation?  If so, what are the correct
options?

Thanks for any input.

-- Kent

==== Example ===

#include <stdio.h>
#include <pcap.h>

int main(int argc, char *argv[])
{
	char *dev, errbuf[PCAP_ERRBUF_SIZE];
	dev = pcap_lookupdev(errbuf);

	if (dev == NULL) {
		fprintf(stderr, "Couldn't find default device: %s\n", errbuf);

		return(2);
	}
	printf("Device: %s\n", dev);
	return(0);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]