Android NDK:无存档符号表 [英] Android NDK: no archive symbol table
问题描述
我正在尝试使用FFTW
的2.1.5版本将FFTW
库和一些.cpp
文件移植到Android.我使用configure& make命令,我尝试将其用作预建库.在我的NDK
项目中,所有内容均可正确编译,但是在链接时出现以下错误:
I'm trying to port the FFTW
library and some .cpp
files to Android, using the 2.1.5 version of FFTW
. I compiled it using the configure & make commands and I try to use it as a pre-built library. In my NDK
project everything compiles with no errors, but when linking I get the following error:
Compile++ thumb : water <= vertex.cpp
Compile++ thumb : water <= face.cpp
Compile++ thumb : water <= Solver.cpp
Compile++ thumb : water <= Water.cpp
SharedLibrary : libwater.so
/Users/Xavi/Documents/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: /Users/Xavi/Documents/workspace/mmm/obj/local/armeabi/libfftw.a: no archive symbol table (run ranlib)
我的Android.mk代码如下
My Android.mk code is the following
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fftw
LOCAL_SRC_FILES := fftw/lib/libfftw.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := water
LOCAL_C_INCLUDES := $(LOCAL_PATH)/water/include
LOCAL_SRC_FILES := \
water/src/vertex.cpp \
water/src/face.cpp \
water/src/Solver.cpp \
water/src/Water.cpp
LOCAL_STATIC_LIBRARIES := fftw
include $(BUILD_SHARED_LIBRARY)
我做错什么了吗,还是以其他方式编译FFTW
库更好?
Am I doing something wrong, or is it better to compile the FFTW
library in a different way?
推荐答案
这对我有用.
LOCAL_PATH := $(call my-dir)
ROOT_PATH := $(LOCAL_PATH)
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
LOCAL_PATH = $(ROOT_PATH)
LOCAL_CFLAGS := -Wall -Wextra
LOCAL_MODULE := water
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_STATIC_LIBRARIES := fftw3
LOCAL_SRC_FILES := \
water/src/vertex.cpp \
water/src/face.cpp \
water/src/Solver.cpp \
water/src/Water.cpp
include $(BUILD_SHARED_LIBRARY)
然后我使用了android ndk工具链来构建fftw 这是我的build.sh.将其放入您的android项目文件夹中并运行它,并将fftw文件夹放入父文件夹中
And I used android ndk toolchain to build fftw this is my build.sh. Put this in your android project folder and run it and put fftw folder in the parent folder
#!/bin/sh
# fftw3/build.sh
# Compiles fftw3 for Android
# Make sure you have NDK_ROOT defined in .bashrc or .bash_profile
INSTALL_DIR="`pwd`/app/jni/fftw3"
SRC_DIR="`pwd`/../fftw-3.3.4"
cd $SRC_DIR
export
PATH="<your path>/android-ndk-r11c/toolchains/arm-linux-androideabi- 4.9/prebuilt/darwin-x86_64/bin:$PATH"
export SYS_ROOT="<your path>/android-ndk-r11c/platforms/android-17/arch-arm/"
export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT"
export LD="arm-linux-androideabi-ld"
export AR="arm-linux-androideabi-ar"
export RANLIB="arm-linux-androideabi-ranlib"
export STRIP="arm-linux-androideabi-strip"
mkdir -p $INSTALL_DIR
./configure --host=arm-linux-androideabi --build=x86_64-apple-darwin --
prefix=$INSTALL_DIR LIBS="-lc -lgcc"
make
make install
exit 0
您将在app/jni中找到fftw文件夹,它将包含bin,include,lib,share文件夹,在lib文件夹中您将找到libfftw3.a
And you will find fftw folder in app/jni and it will include bin, include,lib,share folders and in lib folder you will find libfftw3.a
这篇关于Android NDK:无存档符号表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!