gpt4 book ai didi

安卓NDK : no archive symbol table

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:28:12 25 4
gpt4 key购买 nike

我正在尝试使用 2.1.5 版本的 FFTWFFTW 库和一些 .cpp 文件移植到 Android。我使用 configure & make 命令编译它,并尝试将它用作预构建库。在我的 NDK 项目中,所有内容都可以正常编译,但在链接时出现以下错误:

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代码如下

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 库更好?

最佳答案

这对我有用。

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 文件夹放入父文件夹

#!/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

关于安卓NDK : no archive symbol table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13751560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com