简体   繁体   English

在Cygwin中设置NDK_MODULE_PATH变量

[英]Setting the NDK_MODULE_PATH variable in Cygwin

I am trying to create a module with the Android NDK, but I can't seem to get the build program to take the path variable. 我正在尝试使用Android NDK创建一个模块,但似乎无法使构建程序采用path变量。 I have tried setting it as an environment variable in cygwin: 我尝试将其设置为cygwin中的环境变量:

$ echo $NDK_MODULE_PATH
/cygdrive/c/dev/code/git/android_source

I also specify it within the Android.mk file: 我也在Android.mk文件中指定了它:

#=================================== 
LOCAL_PATH:= $(call my-dir)
NDK_MODULE_PATH := $(LOCAL_PATH)/../../code/git/android_source/
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := user
LOCAL_MODULE := libFilters
LOCAL_SRC_FILES := SkewFilter.cpp SkewFilter.h

LOCAL_LDLIBS := -llog
LOCAL_EXPORT_LDLIBS := -lz
LOCAL_SHARED_LIBS := libskia

include $(BUILD_SHARED_LIBRARY)
#=================================== 

$(call import-module,libskia)

The end result is still this: 最终结果仍然是:

$ ndk-build
Android NDK: jni/Android.mk: Cannot find module with tag 'libskia' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
jni/Android.mk:17: *** Android NDK: Aborting.    .  Stop.

Anyone have any idea of what I'm doing wrong? 有人知道我在做什么错吗?

I found this question How to specify directory for NDK_MODULE_PATH but it wasn't any help. 我发现了这个问题: 如何为NDK_MODULE_PATH指定目录,但是它没有任何帮助。

I figured out what I was doing wrong. 我发现自己在做什么错。 This line in the Android.mk file needs to change from: Android.mk文件中的这一行需要更改为:

$(call import-module,libskia)

to

$(call import-module,external/skia)

It doesn't do a recursive search for the module so when calling import-module it needs the full path relative to your NDK_MODULE_PATH (NDK_MODULE_PATH + path_to_module). 它不会对模块进行递归搜索,因此在调用import-module时,它需要相对于您的NDK_MODULE_PATH(NDK_MODULE_PATH + path_to_module)的完整路径。

The error message that ndk-build prints seems to be wrong since it doesn't list any paths in the NDK_MODULE_PATH variable, but they are there and it uses them. ndk-build打印的错误消息似乎是错误的,因为它没有在NDK_MODULE_PATH变量中列出任何路径,但是它们在那里并且使用它们。

Hope this helps someone else. 希望这对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM