2012-09-27 2 views
0

J'ai une bibliothèque partagée, qui écrit dans c build en utilisant le compilateur arm-linux-androideabi-gcc maintenant je veux tester ma bibliothèque partagée donc j'ai écrit un échantillon c qui appelle cette bibliothèque partagée (.so) et je veux faire .exe, alors quand je compile je suis l'erreur comme ce c'est mon fichier makecomment rendre exécutable (.exe) en utilisant arm-linux-androideabi-gcc?

 TARG_OS  = WIN32 
BUILDTYPE  = Debug 
OS_BITS = 32  

SRC  := TestLSBioCore.c 



OBJS = $(SRC:.c=.o) 

OUT   = ./Test.exe 

OUTLIB  = 

INCLUDE  = -I../../../../../../../android-ndk-r8b/platforms/android-8/arch-arm/usr/include -I../../include 

LIBS  = libLSBioCore.so 



# C++ compiler flags (-g -O2 -Wall) 
#CCFLAGS = -O2 -w -ansi -D_POSIX_SOURCE 

CCFLAGS  = -O2 -w -D_POSIX_SOURCE 

DEFS  = "-D __MSYS__" "-D__NBISLE__" 

#LDFLAGS 
CFLAGS = -nostdlib 
LDFLAGS =-Wl,-rpath-link=../../../../../../../android-ndk-r8b/platforms/android-8/arch-arm/usr/lib/ -L../../../../../../../android-ndk-r8b/platforms/android-8/arch-arm/usr/lib/ 
LIB = -lc -lm 

OBJECT = ../../../../../../../android-ndk-r8b/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o \ 
../../../../../../../android-ndk-r8b/platforms/android-8/arch-arm/usr/lib/crtend_android.o 




#compiler 
#CCC  = mingw32-gcc 

CCC   = arm-linux-androideabi-gcc 

#Archive 
#AR = ar 
#AR = /cygdrive/f/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-ar 

AR = arm-linux-androideabi-ar 
.SUFFIXES: .c 

default: dep $(OUT) 

.c.o: 
    $(CCC) -c $(CCFLAGS) $(INCLUDE) $(DEFS) $< -o [email protected] 

$(OUT): $(OBJS) 
    $(CCC) -o $(OUT) $(OBJECT) $(OBJS) $(LIBS) $(CFLAGS) $(LDFLAGS) $(LIB) 
    #$(AR) rcs $(OUTLIB) $(OBJS) 
    rm -f $(OBJS) 

depend: dep 

dep: 
# makedepend -- $(CFLAGS) -- $(INCLUDES) $(SRC) 

clean: 
    del $(OBJS) $(OUT) 

i obtenu l'erreur suivante

 libLSBioCore.so: undefined reference to `__aeabi_dcmple' 
     libLSBioCore.so: undefined reference to `__aeabi_fadd' 
     libLSBioCore.so: undefined reference to `__aeabi_fcmpgt' 
     libLSBioCore.so: undefined reference to `__aeabi_i2f' 
     libLSBioCore.so: undefined reference to `__aeabi_dcmplt' 
     libLSBioCore.so: undefined reference to `__aeabi_ddiv' 
     libLSBioCore.so: undefined reference to `__aeabi_dmul' 
     libLSBioCore.so: undefined reference to `__aeabi_d2f' 
     libLSBioCore.so: undefined reference to `__aeabi_fsub' 
     libLSBioCore.so: undefined reference to `__aeabi_fcmpge' 
     libLSBioCore.so: undefined reference to `__aeabi_dadd' 
     libLSBioCore.so: undefined reference to `__aeabi_idiv' 
     libLSBioCore.so: undefined reference to `__aeabi_dcmpgt' 
     libLSBioCore.so: undefined reference to `__aeabi_dcmpge' 
     libLSBioCore.so: undefined reference to `__aeabi_dsub' 
     libLSBioCore.so: undefined reference to `__aeabi_f2iz' 
     libLSBioCore.so: undefined reference to `__aeabi_fdiv' 
     libLSBioCore.so: undefined reference to `__aeabi_i2d' 
     libLSBioCore.so: undefined reference to `__aeabi_fcmpeq' 
     libLSBioCore.so: undefined reference to `__aeabi_fmul' 
     libLSBioCore.so: undefined reference to `__aeabi_fcmplt' 
     libLSBioCore.so: undefined reference to `__aeabi_dcmpeq' 
     libLSBioCore.so: undefined reference to `__aeabi_f2uiz' 
     libLSBioCore.so: undefined reference to `__aeabi_d2iz' 
     libLSBioCore.so: undefined reference to `__aeabi_f2d' 
     libLSBioCore.so: undefined reference to `__aeabi_idivmod' 
     collect2: ld returned 1 exit status 
     Makefile:57: recipe for target `Test.exe' failed 

j'espère que j'ai donné le lien correspondant dans ma marque, je pouvez-vous obtenir ce que l'erreur derrière cela, quelqu'un a-t-il une idée sur la façon de faire exe en utilisant arm-linux-androideabi-gcc.

+0

Pour l'enregistrement, ce ne sera pas un .exe. Ce sera un fichier exécutable autonome, mais il n'aura aucune extension, conformément à la convention Linux. –

Répondre

2

Vous avez choisi une manière compliquée; notez qu'avec ndk-build vous pouvez construire un exécutable beaucoup plus facile. Par exemple, regardez l'exemple NDK test-libstdC++.

Mais en utilisant le nu faire est également possible. Cependant, vous avez besoin de plus de bibliothèques lorsque vous définissez -nostdlib sur votre ligne de commande.

Ajouter -lgcc. Vous pouvez avoir besoin de plus de bibliothèques de toolchains/arm-linux-androideabi-4.6/prebuilt/windows/lib/gcc/arm-linux-androideabi/4.6.x-google pour satisfaire plus de références.

Questions connexes