2016-06-18 10 views
0

Ich habe eine vorhandene Anwendung, die in GCC kompiliert und ausführt. Ich bin Cross Compiling die gleiche Anwendung, ich bin in der Lage zu kompilieren und die gemeinsamen Bibliotheken zu generieren. Aber wenn ich versuche, die gemeinsam genutzten Bibliotheken zu verwenden, um eine Anwendung für die Verbindung wird geben die folgenden FehlerKreuz kompilieren einer Anwendung mit freigegebenen Bibliotheken

arm-poky-linux-gnueabi-gcc MSO_Version.o MSO_Connect.o MSO_errors.o -o bin/MSO_Version_shared -Wall -g -Os -fPIC -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk -I../include -I../wsq -I/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk/usr/include/ -L/opt/poky/1.8/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi/usr/lib -L../lib -L/opt/poky/1.8/sysroots/i686-pokysdk-linux/lib -L/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/lib -L/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk/usr/lib -lMSO -lMSOComm -lusb 
/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: skipping incompatible /opt/poky/1.8/sysroots/i686-pokysdk-linux/lib/libgcc_s.so.1 when searching for libgcc_s.so.1 
/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find /lib/libc.so.6 
/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find /usr/lib/libc_nonshared.a 
/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.2/ld: cannot find /lib/ld-linux-armhf.so.3 
collect2: error: ld returned 1 exit status 
make[1]: *** [MSO_Version_shared] Error 1 
make[1]: Leaving directory `/home/linux/ESYS-IMP-LINUXAPP-SUF-24092012-V0.01/Internal Release/ESYS-IMP-LinuxApp-SUF-LIB-SRS-V0.01/samples' 
make: *** [samples] Error 2 

Wenn ich kompilieren mit statischen Bibliotheken ausführbaren Dateien werden immer generiert. Unten ist mein Make-Datei

export CROSS_COMPILE 

CC = $(CROSS_COMPILE)gcc 

ifeq ($(DEBUG),yes) 
CFLAGS = -Wall -g -Os -fPIC -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk 


else 
CFLAGS = -Wall -Os -fPIC -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk 


endif 

LIB_USB = -lusb 
LIB_SDL = -lSDL -lSDL_ttf 

LIBPATH += -L/opt/poky/1.8/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi/usr/lib 
LIBPATH += -L../lib 
LIBPATH += -L/opt/poky/1.8/sysroots/i686-pokysdk-linux/lib 
LIBPATH += -L/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/lib 
LIBPATH += -L/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk/usr/lib 
LIB_STATIC_SAGEM = ../lib/libMSO.a ../lib/libMSOComm.a 
LIB_SAGEM = -lMSO -lMSOComm 


SRCINCLUDE += -I../include -I../wsq 
SRCINCLUDE += -I/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk/usr/include/ 

EXEC_PATH = bin 
EXEC_STATIC = MSO_Version #MSO_TestBio MSO_TestThread 
EXEC_SHARED = MSO_Version_shared #MSO_TestBio_shared 

MSO_Version_SRC = MSO_Version.c MSO_Connect.c MSO_errors.c 
MSO_Version_OBJ = $(MSO_Version_SRC:.c=.o) 

.PHONY: all 
all: $(EXEC_STATIC) $(EXEC_SHARED) 

%.o: %.c 
     $(CC) -c $(CFLAGS) $(SRCINCLUDE) $< -o [email protected] 

.PHONY: MSO_Version MSO_Version_shared 
MSO_Version: $(MSO_Version_OBJ) 
     $(CC) $(MSO_Version_OBJ) -o $(EXEC_PATH)/MSO_Version $(CFLAGS) $(SRCINCLUDE) $(LIB_STATIC_SAGEM) $(LIB_USB) 
MSO_Version_shared: $(MSO_Version_OBJ) 
     $(CC) $(MSO_Version_OBJ) -o $(EXEC_PATH)/MSO_Version_shared $(CFLAGS) $(SRCINCLUDE) $(LIBPATH) $(LIB_SAGEM) $(LIB_USB) 

Sie kann ich eine mit der statischen Bibliothek und andere mit gemeinsam genutzten Bibliothek am Erzeugen von zwei ausführbare Dateien sehen. Ich verwende poky 1.8 und Kernel ist 2.6.38. Verwenden der NXP IMX6ULEVK-Karte. Kann mir jemand sagen, wohin ich gehe falsch

+1

Was mit oben ist die LIBPATHs ganzen Wesen Ort? Das ist besonders Sysroot; Ich kann mir nicht vorstellen, dass da irgendwo ein ARM-Code ist. Welches ist der _actual_ Sysroot für dein Ziel? – Notlikethat

+0

Mein tatsächlicher Sysroot ist Sysroot =/home/fsl-release-bsp/build_image/tmp/sysroots/imx6ulevk. Danke, dass du auf die LIBPATHs gezeigt hast, ich habe die restlichen LIBPATHS eingegeben und es hat angefangen zu arbeiten. –

Antwort

2

Sie Architektur angeben, wie ARMv7-a:

-march=armv7-a 

aber einen Link zu i686 Bibliotheken:

-L/opt/poky/1.8/sysroots/i686-pokysdk-linux/lib -L/opt/poky/1.8/sysroots/i686-pokysdk-linux/usr/lib