1

I'm trying to cross compile some software I developed for my Nokia N900. It has an ARM7 processor, and is running Maemo (Based on Debian Etch and Lenny I believe).

To cross compile I am using Scratchbox, which has worked fine in the past for other software.

The software I developed uses libpcap. The latest version in the repo's is 0.8, but I need at least 1.0. So I compiled 1.0 within Scratchbox.

Within Scratchbox my softwarre compiles fine, but when I use the compiled binary on the N900 I get an error:

Error while loading shared libraries: libpcap.so.1 cannot open sharedobject file: No such file or directory.

Here is my Makefile:

TARGET = foncon
LIBS = -lpcap
CC = gcc
CFLAGS = -Wall -I include
OBJECTS = foncon.o src/pretty_print.o

$(TARGET):$(OBJECTS)
    $(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) $(LIBS)

%.o: %.c
    $(CC) -c $(CFLAGS) $< -o $@ $(LIBS)

clean:
    rm -f foncon.o
    rm -f src/pretty_print.o

Is it possible to build libpcap within the executable?

BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
  • What you're asking for is called static linking. It typically requires you to have a static version of the library available. In this case, the conventional name of the library you want is `libpcap.a`. If you *do* have such a library then the `-static` option will tell `gcc` to link against that instead of against a dynamic library. – John Bollinger Sep 05 '15 at 16:41
  • On the other hand, you could also consider installing libpcap 1.0 on your target system. It should be able to coexist with libpcap 0.8 if you do it right. – John Bollinger Sep 05 '15 at 16:43
  • Compiling anything on the device is a pain in the backside. It's a dated OS that's no longer updated. I have no `libpcap.a`, but now that you've mentioned static linking I will do some reading/research and see if I can solve this. Thanks for the comment, much appreciated. – BugHunterUK Sep 05 '15 at 17:00
  • Can you list the libraries obtained by compiling libpcap – ashwanth selvam Sep 07 '15 at 13:06

0 Answers0