簡體   English   中英

如何使用arm-linux-androideabi-gcc制作可執行文件(.exe)?

[英]how to make executable(.exe) using arm-linux-androideabi-gcc?

我有一個共享庫,使用arm-linux-androideabi-gcc編譯器編寫c build現在我想測試我的共享庫,所以我寫了一個調用該共享庫(.so)的示例c,我想制作.exe ,所以當我編譯我得到這樣的錯誤這是我的make文件

      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 $@

$(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)

我收到以下錯誤

        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

我希望我在我的make中給出了正確的鏈接,我可以得到這背后的錯誤,有沒有人知道如何使用arm-linux-androideabi-gcc制作exe。

你選擇了一種復雜的方式; 請注意,使用ndk-build您可以更輕松地構建可執行文件。 例如,查看test-libstdc ++ NDK示例。

但是使用裸露的制作也是可能的。 當你在命令行上設置-nostdlib時,你需要更多的庫。

添加-lgcc 您可能需要更多來自toolchains/arm-linux-androideabi-4.6/prebuilt/windows/lib/gcc/arm-linux-androideabi/4.6.x-google來滿足更多參考。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM