0

i want to build the expolid code ( https://github.com/revolutionary/zergRush/blob/master/zergRush.c)

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := zergRush
LOCAL_SRC_FILES := zergRush.c
base :=E:\0.Android\system\core
#//base path include the android source code. but i forget the version .maybe 4.0.1
LOCAL_C_INCLUDES :=$(base)/include/
LOCAL_LDLIBS    := -llog -lcutils
LOCAL_STATIC_LIBRARIES := libcutils libc
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng debug
LOCAL_FORCE_STATIC_EXECUTABLE := true

include $(BUILD_EXECUTABLE)

this computer has installed ndk-r9b.
libcutils.so : D:\android-ndk-r9b\platforms\android-19\arch-arm\usr\lib\rs
so i copy it to D:\android-ndk-r9b\platforms\android-19\arch-arm\usr\lib.

default.properties project.properties set target=19

but ndk-build failed .

D:\test\roottest\jni>ndk-build
[armeabi] Compile thumb  : zergRush <= zergRush.c
[armeabi] Executable     : zergRush
D:/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6
/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lcutils
D:/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6
/../../../../arm-linux-androideabi/bin/ld.exe: D:/test/roottest//obj/local/armeabi/objs/zergRush/zergRush.o: in function
 do_fault:D:/test/roottest//jni/zergRush.c:226: error: undefined reference to 'socket_local_client'
D:/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6
/../../../../arm-linux-androideabi/bin/ld.exe: D:/test/roottest//obj/local/armeabi/objs/zergRush/zergRush.o: in function
 main:D:/test/roottest//jni/zergRush.c:488: error: undefined reference to 'property_set'
D:/android-ndk-r9b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6
/../../../../arm-linux-androideabi/bin/ld.exe: D:/test/roottest//obj/local/armeabi/objs/zergRush/zergRush.o: in function
 main:D:/test/roottest//jni/zergRush.c:619: error: undefined reference to 'property_get'
collect2: ld returned 1 exit status
make.exe: *** [D:/test/roottest//obj/local/armeabi/zergRush] Error 1

i want to know how to include the use-defined libraray path or include libcutils.so and i can make the program . thanks.

fazhang
  • 485
  • 6
  • 13

1 Answers1

0

The correct syntax in project.properties file is target=android-19. Make sure that you have it that way. If you want to make sure it works, open up your project in Eclipse, right-click on it and select to open its Properties.

Also, you've listed libcutils as both a shared library and a static library in your makefile. libc is also a shared library in Android system, so I'm pretty sure that you ought to do without the entire LOCAL_STATIC_LIBRARIES line.

If fixing the target still does not work, my advice would be to add libcutils.so as a "prebuilt" library (check your <ndk>/docs/PREBUILTS.html file to see how to do that).

Good luck!

Alexandre Bodi
  • 344
  • 2
  • 12
  • e, yeah target=android-19 .I did that. Could you make the zergRush.c ? i want to see your makefile . thank you . – fazhang Nov 21 '13 at 02:10
  • hi. I read it again . and find a make tip . use 'agcc' . and there is a blog http://blog.claudxiao.net/2011/10/android_agcc/ . I make it ! . but .... The zergRush only works with android source code (2.2 2.3 ) . There is only 4.1.2 . although make success. when I run it , it killed by Android system... And i'm in china . so the firewall make it impossible to get more android source . ----------------- Thank you so much . – fazhang Nov 22 '13 at 02:59
  • Cool. This was all because libcutils.so (as well as its exported header files) is not part of Android NDK development package. It's just available from Android's source code. Thanks for the discussion anyway. – Alexandre Bodi Nov 23 '13 at 19:21