2012-03-11 45 views
1

虽然与NDK建造编译,我得到以下错误:不能建修改Android的保险丝NDK建造

/* this is the output*/ 
[email protected]:~/NDKDemo$ ndk-build 
Compile thumb : fusexmp <= fusexmp.c 
Compile thumb : fuse <= cuse_lowlevel.c 
Compile thumb : fuse <= fuse.c 
Compile thumb : fuse <= fuse_kern_chan.c 
Compile thumb : fuse <= fuse_loop.c 
Compile thumb : fuse <= fuse_loop_mt.c 
Compile thumb : fuse <= fuse_lowlevel.c 
Compile thumb : fuse <= fuse_mt.c 
Compile thumb : fuse <= fuse_opt.c 
Compile thumb : fuse <= fuse_session.c 
Compile thumb : fuse <= fuse_signals.c 
Compile thumb : fuse <= helper.c 
Compile thumb : fuse <= mount.c 
Compile thumb : fuse <= mount_util.c 
jni/mount_util.c: In function 'add_mount_legacy': 
jni/mount_util.c:91: warning: assignment makes pointer from integer without a cast 
Compile thumb : fuse <= ulockmgr.c 
StaticLibrary : libfuse.a 
Executable  : fusexmp 
/home/alex/Downloads/android-ndk-r7/platforms/android-14/arch-arm/usr/lib/crtbegin_dynamic.o: In function `_start': 
(.text+0x14): undefined reference to `main' 
collect2: ld returned 1 exit status 
make: *** [obj/local/armeabi/fusexmp] Error 1 

我已经修改修改fusexmp.c如下:

#include "com_alex_NativeLib.h" 
............................ //fuse specific code which build succesfully 
............................. 
/* Callable native function signature from Java*/ 
JNIEXPORT jint JNICALL Java_com_marakana_NativeLib_hello_fuse 
    (JNIEnv * env, jobject obj) { 
char *v[2]; 
    v[0]=(char*)malloc(90); //argv[0] for fuse_main 
    v[1]=(char*)malloc(90); //argv[1] for fuse_main 
    strcpy(v[0],"hello"); 
    strcpy(v[1],"./helloxmp"); //path to mount point 

    umask(0); 
    return fuse_main(2, v, &xmp_oper, NULL); //the fuse main call 
} 
+0

@Samveen我当我运行fusexmp做u.but类似的工作,我可以挂载改变include $(BUILD_EXECUTABLE)include $(BUILD_SHARED_LIBRARY)一个目录,但无法在目录中创建一个文件,并提示错误,它是一个只读文件系统。是否遇到同样的错误或有任何解决方案?thx – 2012-05-31 03:13:46

回答

3

问题是ndk-build正试图将fusexmp作为可执行文件来构建,但似乎fusexmp没有定义函数(正如编译器创建可执行文件所要求的那样)。创建一个主要功能的可执行文件的入口点,或更改fusexmp到库中,通过在Android.mk