当前位置:Gxlcms > mysql > Sqlite3交叉编译undefinedreferenceto`fdatasync'错误解决

Sqlite3交叉编译undefinedreferenceto`fdatasync'错误解决

时间:2021-07-01 10:21:17 帮助过:56人阅读

Sqlite3 交叉编译 undefined reference to `fdatasync

交叉编译sqlite到Android平台, Android.mk 文件内容如下:

LOCAL_PATH:= $(call my-dir)

INCDIR:=/home/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include

# first lib, which will be built statically
#
include $(CLEAR_VARS)

LOCAL_MODULE := cloudstore_MTD
LOCAL_SRC_FILES := debug.c hash.c fusex.cpp listex.c storex.cpp md5.c main.c markup.cpp http_fet
cher.c spthreadpool.c

LOCAL_C_INCLUDES := /home/fuse-2.8.3/include /home/sqlite-autoconf-3070500 /home/android-ndk-r6b/platf
orms/android-9/arch-arm/usr/include /home/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/include /home/a
ndroid-ndk-r6b/samples/fuse-android/jni/include $(INCDIR)

LOCAL_CFLAGS :=-Wall -lulockmgr -pipe -D_FILE_OFFSET_BITS=64 -D_DEBUG -DANDROID_SDK -DUSE_OPEN -DUSE_TH
READ -DDEBUG -O2
LOCAL_CPPFLAGS :=

include $(BUILD_EXECUTABLE)

在jni目录下面执行 /home/android-ndk-r6b/ndk-build , 编译, 总是出现如下错误:

[root@localhost jni]# /home/android-ndk-r6b/ndk-build
Compile thumb : sqlite3_android <= shell.c
Compile thumb : sqlite3 <= sqlite3.c
StaticLibrary : libsqlite3.a
Executable : sqlite3_android
/home/android-ndk-r6b/samples/sqlite-android/obj/local/armeabi/libsqlite3.a(sqlite3.o): In function `unixSync':
sqlite3.c:(.text.unixSync+0x6): undefined reference to `fdatasync'
sqlite3.c:(.text.unixSync+0x14): undefined reference to `fdatasync'
collect2: ld returned 1 exit status
make: *** [/home/android-ndk-r6b/samples/sqlite-android/obj/local/armeabi/sqlite3_android]

搜索了好多地方,, 找解决问题的办法, 最后还是在官方bug列表里面找到了, 原来是一个bug, 下来就下载了最新的版本后, 重新编译, 问题解决。

最新的版本为 sqlite-autoconf-3070800.tar.gz

linux

人气教程排行