简体   繁体   English

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

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

I have one shared library ,Which written in c build using arm-linux-androideabi-gcc compiler now i want to test my shared library so i written one sample c which call that shared library(.so) and i want to make .exe , so when i compile i got the error like this this is my make file 我有一个共享库,使用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)

i got the following error 我收到以下错误

        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

i hope i gave the proper link in my make ,i can;t get what the error behind this,do anyone have idea about how to make exe using arm-linux-androideabi-gcc. 我希望我在我的make中给出了正确的链接,我可以得到这背后的错误,有没有人知道如何使用arm-linux-androideabi-gcc制作exe。

You have chosen a complicated way; 你选择了一种复杂的方式; note that with ndk-build you can build an executable much easier. 请注意,使用ndk-build您可以更轻松地构建可执行文件。 For example, look at the test-libstdc++ NDK sample. 例如,查看test-libstdc ++ NDK示例。

But using the bare make is also possible. 但是使用裸露的制作也是可能的。 You need more libraries though, when you set -nostdlib on your command line. 当你在命令行上设置-nostdlib时,你需要更多的库。

Add -lgcc . 添加-lgcc You may need more libs from toolchains/arm-linux-androideabi-4.6/prebuilt/windows/lib/gcc/arm-linux-androideabi/4.6.x-google to satisfy more references. 您可能需要更多来自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.

相关问题 Bambuser ffmpeg - “arm-linux-androideabi-gcc无法创建可执行文件。” - Bambuser ffmpeg - “arm-linux-androideabi-gcc is unable to create an executable file.” arm-linux-androideabi-gcc无法创建可执行文件-为Android armeabi设备编译ffmpeg - arm-linux-androideabi-gcc is unable to create an executable - compile ffmpeg for android armeabi devices 为什么arm-linux-androideabi-gcc强制执行-fpic? - Why does arm-linux-androideabi-gcc enforce -fpic? 如何在Linux OS中使用arm-linux-androideabi-gcc编译器构建libargp库 - How to build libargp library with arm-linux-androideabi-gcc compiler in Linux OS arm-linux-androideabi-gcc给出png.h错误 - arm-linux-androideabi-gcc gives png.h error 在Android(Remix OS)上安装NDK(arm-linux-androideabi-gcc) - Installing NDK (arm-linux-androideabi-gcc) on Android (Remix OS) 当前未安装程序arm-linux-androideabi-gcc - the program arm-linux-androideabi-gcc is currently not installed 为什么arm-linux-androideabi-gcc会给出iostream错误 - why does arm-linux-androideabi-gcc give iostream error 工具链“ ndk-gcc”(GNU GCC):XCode arm-linux-androideabi-gcc是Clang的包装 - Tool chain 'ndk-gcc' (GNU GCC): XCode arm-linux-androideabi-gcc is a wrapper around Clang arm-eabi-gcc与arm-linux-androideabi-gcc不同 - is arm-eabi-gcc different than arm-linux-androideabi-gcc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM