Can';t构建修改的android fuse与ndk构建
使用ndk build进行编译时,出现以下错误:Can';t构建修改的android fuse与ndk构建,android,android-ndk,fuse,Android,Android Ndk,Fuse,使用ndk build进行编译时,出现以下错误: /* this is the output*/ alex@ubuntu:~/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 Com
/* this is the output*/
alex@ubuntu:~/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
问题是,
ndk build
试图将fusexmp
构建为可执行文件,但似乎fusexmp
没有定义main
函数(编译器创建可执行文件时需要)。创建一个主函数作为可执行文件的入口点,或者将fusexmp
更改为库,方法是将include$(BUILD\u executable)
更改为include$(BUILD\u SHARED\u library)
在您的Android.mk
中,问题是ndk BUILD
正在尝试将fusexmp
构建为可执行文件,但是fusexmp
似乎没有定义main
函数(根据编译器创建可执行文件的要求)。创建一个主函数作为可执行文件的入口点,或者将fusexmp
更改为库,方法是将include$(BUILD\u executable)
更改为include$(BUILD\u SHARED\u library)
在您的Android.mk
@Samveen中使用u执行类似的工作,我可以挂载一个目录,但无法在目录中创建一个文件。它会提示错误,这是一个只读文件系统。您是否遇到过同样的错误或有任何解决方案?thx@Samveen我对u做了类似的工作,但是当我运行fusexmp时,我可以挂载一个目录,但无法在该目录中创建一个文件。它会提示错误,这是一个只读文件系统。您是否遇到过相同的错误或有任何解决方案?thx
#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
}