Skip to contentSkip to conversation

problems linking when using -lSDL

Buildroot Steve Morris 2 participants 2 messages Feb 16, 2011

lore
Share & tools
lore
#0 lore raw

Hi All,

I've recently tried to use SDL with buildroot-2010.11 and crosstools-ng 1.82. I've also tried the latest buildroot snapshot wit a fresh crosstools. I've managed to have everything working prior to trying to use SDL.`

've been circling around this for days with no luck. Perhaps someone can point me in the right direction.

ct.c is a simple hello world which doesn't call in anything

#include <stdlib.h>
#include <stdio.h>

int main () {
	printf
		("hello world\n");
	exit(0);
}

my makefile, though perhaps adding too many directories to searc in compiles the program properly.

CC = /lfs/x-tools/i586-unknown-linux-gnu/bin/i586-unknown-linux-gnu-gcc CFLAGS = -Wl,--verbose
LDFLAGS =
LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sys-root/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sys-root/usr/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sysroot/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sysroot/usr/lib LDFLAGS += -L/lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/lib LDFLAGS += -L/lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/usr/lib LDFLAGS += -lpthread

ct:

	$(CC) $(CFLAGS) $(LDFLAGS) -o ct ct.c

When I add -lSDL to the mix I get a bunch of errors such as:

tools/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.4.3/../../../../i586-unknown-linux-gnu/bin/ld: warning: libdirectfb-1.4.so.5, needed by /lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/usr/lib/libSDL.so, not found (try using -rpath or -rpath-link) /lfs/x-tools/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.4.3/../../../../i586-unknown-linux-gnu/bin/ld: warning: libfusion-1.4.so.5, needed by /lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/usr/lib/libSDL.so, not found (try using -rpath or -rpath-link) /lfs/x-tools/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.4.3/../../../../i586-unknown-linux-gnu/bin/ld: warning: libdirect-1.4.so.5, needed by /lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/usr/lib/libSDL.so, not found (try using -rpath or -rpath-link)

Any pointers would be appreciated,

Steve

#1 lore raw
Quoted 7 lines · On Wed, 16 Feb 2011 10:38:35 -0800 Steve Morris <[email protected]> wrote:

LDFLAGS =
LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sys-root/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sys-root/usr/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sysroot/lib LDFLAGS += -L/lfs/x-tools/i586-unknown-linux-gnu/i586-unknown-linux-gnu/sysroot/usr/lib LDFLAGS += -L/lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/lib LDFLAGS += -L/lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/usr/lib

Remove all those LDFLAGS, and do :

CFLAGS += --sysroot=/lfs/buildroot/output/host/usr/i586-unknown-linux-gnu/sysroot/

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com