MSI SDR设备示例代码无法编译 [英] MSI SDR device sample code does not compile

查看:279
本文介绍了MSI SDR设备示例代码无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MSI SDR加密狗进行交互android应用

I am trying to interface with an MSI SDR dongle, using an android app

此设备是SDRPlay SDR设备的克隆,并与其软件和驱动程序兼容

This device is a clone of the SDRPlay SDR device, and is compatible with it's software and drivers

我正在尝试使用OTG电缆和android手机与此接口

I am trying to interface with this using an OTG cable and android phone

可从此处 https://www.sdrplay.com/downloads/下载android驱动程序

它位于API/HW – V2.11(2017年11月15日)链接下的Android选项卡中( https://www.sdrplay.com/anddl.php )

It is in the Android tab under the API/HW – V2.11 (15TH NOV 2017) link (https://www.sdrplay.com/anddl.php)

可以在以下位置找到此驱动程序的示例代码: https://www.sdrplay .com/docs/AndroidIntegrationNote.pdf

A possible sample code for this driver can be found here: https://www.sdrplay.com/docs/AndroidIntegrationNote.pdf

在制作完整的android程序之前,它说应该使用ndk-build将库(libmir_sdr_api.a)内置到.so库文件中

Before making the full android program it says the library (libmir_sdr_api.a) should be built into an .so library file using ndk-build

我目前在这里有Android的hello-jni示例项目: https://github.com/android/ndk-samples/tree/android-mk/hello-jni

I currently have Android's hello-jni sample project from here: https://github.com/android/ndk-samples/tree/android-mk/hello-jni

我已使用AndroidIntegrationNote第3节中提到的Android.mk文件,libmir_sdr_api.a,mir_sdr.h,initialization-jni.cpp,demod-jni.cpp和demod-jni.h文件替换了jni文件夹.我在上方链接的pdf文件

I have replaced the jni folder using the Android.mk file, libmir_sdr_api.a, mir_sdr.h, initialization-jni.cpp, demod-jni.cpp and demod-jni.h files mentioned in section 3 of the AndroidIntegrationNote.pdf file I linked above

当我从hello-jni项目文件夹执行ndk-build时,出现以下错误:

When I execute ndk-build from the hello-jni project folder, I get he following error:

Android NDK: Found platform level in ./default.properties. Setting APP_PLATFORM to android-25.
Android NDK: android-25 is an alias for android-24. Adjusting APP_PLATFORM to match.
[arm64-v8a] Gdbserver      : [aarch64-linux-android] libs/arm64-v8a/gdbserver
[arm64-v8a] Gdbsetup       : libs/arm64-v8a/gdb.setup
[x86_64] Gdbserver      : [x86_64-linux-android] libs/x86_64/gdbserver
[x86_64] Gdbsetup       : libs/x86_64/gdb.setup
[armeabi-v7a] Gdbserver      : [arm-linux-androideabi] libs/armeabi-v7a/gdbserver
[armeabi-v7a] Gdbsetup       : libs/armeabi-v7a/gdb.setup
[x86] Gdbserver      : [i686-linux-android] libs/x86/gdbserver
[x86] Gdbsetup       : libs/x86/gdb.setup
make: *** No rule to make target 'jni/initialisation-jni.cpp', needed by 'obj/local/arm64-v8a/objs-debug/mirics-jni/initialisation-jni.o'.  Stop.  

我曾经使用Android Studio和cmake来编译NDK代码,所以我不确定这里发生了什么.我也无法通过cmake链接.a文件,因此我想尝试一下驱动程序制造商的示例代码,但它也不起作用. pdf档案中的Android.mk档案先前连结是否不完整,还是我无法正确建立?这些是Android.mk文件的内容:

I am used to compiling NDK code suing Android Studio and cmake so I am not sure what is going on here. I have not been able to link the .a file through cmake either so I thought of giving the driver manufacturer's sample code a try, but it not working either. Is the Android.mk file in pdf file linked earlier incomplete, or am I not building it correctly? These are the contents of the Android.mk file:

# $(call my-dir) returns the local directory which is the jni directory  
LOCAL_PATH := $(call my-dir)  
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below  
include $(CLEAR_VARS)  
LOCAL_MODULE := mir_sdr_api-prebuilt  
LOCAL_SRC_FILES := libmir_sdr_api.a  
LOCAL_EXPORT_C_INCLUDES := $(call my-dir)  
include $(PREBUILT_STATIC_LIBRARY)  
include $(CLEAR_VARS)  
# mirics-jni – this section uses the jni C++ source code to build the dynamic library  
LOCAL_MODULE := mirics-jni  
LOCAL_SRC_FILES := initialisation-jni.cpp demod-jni.cpp  
LOCAL_C_INCLUDES := $(call my-dir)  
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib  
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt  
include $(BUILD_SHARED_LIBRARY)  

推荐答案

关于缺少的jni/initialisation-jni.cpp,您可能拥有的文件是jni/initiali z ation-jni.cpp.

Regarding missing jni/initialisation-jni.cpp, you probably have the file jni/initialization-jni.cpp instead.

不幸的是,文档是错误的.您只能在文件顶部轻松使用$(call my-dir).幸运的是,Android NDK添加了 jni 目录来为您提供路径.不过,为了安全起见,最好写:

Also, unfortunately, the document is wrong. You can only use $(call my-dir) easily at the top of the file. Luckily, Android NDK adds the jni directory to includes path for you. Still, to be on the safe side, better write:

# $(call my-dir) returns the local directory which is the jni directory  
LOCAL_PATH := $(call my-dir)  
# libmir_sdr_api.a – this section creates a version of the Mirics API to be used below  
include $(CLEAR_VARS)  
LOCAL_MODULE := mir_sdr_api-prebuilt  
LOCAL_SRC_FILES := libmir_sdr_api.a  
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)  
include $(PREBUILT_STATIC_LIBRARY)  
include $(CLEAR_VARS)  
# mirics-jni – this section uses the jni C++ source code to build the dynamic library  
LOCAL_MODULE := mirics-jni  
LOCAL_SRC_FILES := initialization-jni.cpp demod-jni.cpp  
LOCAL_C_INCLUDES := $(LOCAL_PATH)  
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib  
LOCAL_STATIC_LIBRARIES := mir_sdr_api-prebuilt  
include $(BUILD_SHARED_LIBRARY)

最后,请注意您的构建过程.您只有一种 libmir_sdr_api.a 静态库,它是为32位ARM CPU构建的.因此,您无法为其他体系结构构建 libmirics-jni.so .添加

Finally, pay attention to your build process. You only have one kind of the libmir_sdr_api.a static library, it's built for a 32-bit ARM CPU. Therefore you cannot build your libmirics-jni.so for other architectures. Add

APP_ABIS = armeabi-v7a

到您的 Application.mk 文件,或指定

abifilters = armeabi-v7a

如果您在Android Studio中构建库,请在 build.gradle

.

in your build.gradle, if you build your library in Android Studio.

这篇关于MSI SDR设备示例代码无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆