- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我从来没有用 Android 构建过 curl。
先决条件:我正在使用 Android Studio 2.1.2我正在使用 NDK ,非实验性方式我在 curlLib 目录的 jni 文件夹中有 curl-7.49.1 库的源代码ExtLibCurl 是我的应用程序 jni 文件夹中的文件夹/目录,其中包含从下载的源代码 https://android.googlesource.com/platform/external/curl/+/e6f2b03027b5feb92b30f5d47801ec3fabe9fd95
可以检查 Android.mk 中的 cURL 和其他文件。
根据问题中的评论更新文件。
以下是我的Android.mk文件
JNI_DIR := $(call my-dir)
LOCAL_PATH:= $(JNI_DIR)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/ExtLibCurl/Android.mk
# Build main library as shared library.
LOCAL_PATH := $(JNI_DIR)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ExtLibCurl/include/curl
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ExtLibCurl/lib
FILE_LIST += $(wildcard $(LOCAL_PATH)/ExtLibCurl/src/*.c)
LOCAL_MODULE := ndksampleapp
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_STATIC_LIBRARIES := ExtLibCurl
include $(BUILD_SHARED_LIBRARY)
应用程序.mk
APP_ABI := all
APP_STL := gnustl_static
APP_CFLAGS += -std=gnu++11
APP_OPTIM := debug
LOCAL_CPP_FEATURES += exceptions
NDK_TOOLCHAIN_VERSION := 4.9
我构建 curl 的 Android.mk 的方式是否正确?
当我在 src\main 路径中执行 ndk-build 时,出现以下错误
[arm64-v8a] Compile : ndksampleapp <= curlutil.c
cc1.exe: warning: command line option '-std=gnu++11' is valid for C++/ObjC++ but not for C
In file included from jni/ExtLibCurl/lib/strdup.h:24:0,
from jni/ExtLibCurl/src/setup.h:206,
from jni/ExtLibCurl/src/curlutil.c:23:
jni/ExtLibCurl/lib/setup.h:120:28: fatal error: curl/curlbuild.h: No such file or directory
#include <curl/curlbuild.h>
^
compilation terminated.
make: *** [obj/local/arm64-v8a/objs-debug/ndksampleapp/ExtLibCurl/src/curlutil.o] Error 1
如果我删除 FILE_LIST += $(wildcard $(LOCAL_PATH)/ExtLibCurl/src/*.c),则不会构建任何 cURL 文件。
最佳答案
您的 Android.mk
文件应如下所示:
JNI_DIR := $(call my-dir)
LOCAL_PATH:= $(JNI_DIR)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/ExtLibCurl/Android.mk
# Build main library as shared library.
LOCAL_PATH := $(JNI_DIR)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ExtLibCurl/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ExtLibCurl/lib
# !!! place list of YOUR sources to this variable !!!
FILE_LIST += $(wildcard $(LOCAL_PATH)/src/*.c)
LOCAL_MODULE := ndksampleapp
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_STATIC_LIBRARIES := libcurl
LOCAL_LDLIBS += -lz
include $(BUILD_SHARED_LIBRARY)
模块的名称不需要与其目录名称匹配。
在 ExtLibCurl/Android.mk
中,您必须取消注释 BUILD_STATIC_LIBRARY
部分,您还可以通过创建可执行文件 curl(第 74 行以上)删除所有部分,即文件将如下所示:
# Google Android makefile for curl and libcurl
#
# Place the curl source (including this makefile) into external/curl/ in the
# Android source tree. Then build them with 'make curl' or just 'make libcurl'
# from the Android root. Tested with Android 1.5
#
# Note: you must first create a curl_config.h file by running configure in the
# Android environment. The only way I've found to do this is tricky. Perform a
# normal Android build with libcurl in the source tree, providing the target
# "showcommands" to make. The build will eventually fail (because curl_config.h
# doesn't exist yet), but the compiler commands used to build curl will be
# shown. Now, from the external/curl/ directory, run curl's normal configure
# command with flags that match what Android itself uses. This will mean
# putting the compiler directory into the PATH, putting the -I, -isystem and
# -D options into CPPFLAGS, putting the -m, -f, -O and -nostdlib options into
# CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the path
# to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o. Remember
# that the paths must be absolute since you will not be running configure from
# the same directory as the Android make. The normal cross-compiler options
# must also be set.
#
# The end result will be a configure command that looks something like this
# (the environment variable A is set to the Android root path):
#
# A=`realpath ../..` && \
# PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \
# ./configure --host=arm-linux CC=arm-eabi-gcc \
# CPPFLAGS="-I $A/system/core/include ..." \
# CFLAGS="-fno-exceptions -Wno-multichar ..." \
# LIB="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\
# /interwork/libgcc.a ..." \
#
# Dan Fandrich
# September 2009
LOCAL_PATH:= $(call my-dir)
common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H
#########################
# Build the libcurl library
include $(CLEAR_VARS)
include $(LOCAL_PATH)/lib/Makefile.inc
CURL_HEADERS := \
curlbuild.h \
curl.h \
curlrules.h \
curlver.h \
easy.h \
mprintf.h \
multi.h \
stdcheaders.h \
typecheck-gcc.h \
types.h
LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
external/openssl/include \
external/zlib
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_COPY_HEADERS_TO := libcurl/curl
LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
#LOCAL_SHARED_LIBRARIES := libz
LOCAL_MODULE:= libcurl
include $(BUILD_STATIC_LIBRARY)
关于android - jni/Android.mk :8:curlLib/packages/Android/Android. mk: 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39202545/
我正在尝试使用 JAXB 从 XSD 生成 java 类。 XSD 是我公司的官方 xsd,因此我无法仅为我的项目修改它们。在该网站上进行了数百次尝试和搜索后,我决定直接提出问题。 我的 XSD 中有
我已经了解了以下链接中的详细信息,但仍然存在何时使用哪个文件的问题?https://docs.npmjs.com/files/package-lock.json 最佳答案 包.json 包含项目的相关
当我在 centos 上运行命令 rpmbuild -bb mypackage.spec 时,出现错误 error: Package already exists: %package debuginf
my.packages 是 src 目录中的自定义原型(prototype)包。 Plone 实例中的数千个项目与其类型一起添加。我想将包重命名为 my.package。通过简单地卸载 my.pack
根据 javadoc 规范,我在相关包的根目录中放置了一个名为 package-info.html 的文档文件。但是,当我在该文件夹上运行 Doxygen 时,不会拾取该文件中的文档。我如何告诉 Do
我已经定义了如下的包: (defpackage :thehilariouspackageofamirteymuri (:nicknames ampack amir teymuri) (:use
我正在思考这个问题: > .packages() > (.packages()) [1] "stats" "graphics" "grDevices" "utils" "datase
我在内存中有一个 System.IO.Packaging.Package(它是一个 WordprocessingDocument)并且想将它流式传输到浏览器以保存它。 Word 文档已被基于 MVC
即使这是我不常发现的东西,在成员之前注释/* package*/的原因是什么? /* package */ final void attach(Context context) { atta
我正在开发我的应用程序,但在添加包以便导入它时,我总是收到此错误。 error: type 'Package.Dependency' has no member 'Package' 这是我的 Pack
install.packages("data.table") trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.
放置手动创建的插件的最佳位置是什么: a) C:\Users\{UserName}\AppData\Roaming\Sublime Text 3\Packages 或 b) C:\Users\{Use
这是一个有趣的 Perl 行为。 (至少对我来说 :) ) 我有两个包 PACKAGE1 和 PACKAGE2,它们导出具有相同名称的函数 Method1()。 由于将有如此多的包将导出相同的功能,使
package-archives (("marmalade" . "http://marmalade-repo.org/packages/") ("gnu" . "http://elpa.gnu.or
任何人都可以让我知道 package-lock.json 文件的确切用途吗? 尽管许多人提到它用于查看版本化依赖树。 寻找简单易行的解释。 提前致谢。 最佳答案 npm install使用此文件来确保
Python documentation说 Consider this code: import sound.effects.echo import sound.effects.surround fr
我在 ubuntu 上运行 VPS: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 C
我有这样一个结构 $ tree -h . ├── [1.0K] myproj │ ├── [ 0] index.py │ ├── [ 0] __init__.py │ └──
我正在尝试解压 System.IO.Packaging.Package我从网络服务器收到的。也就是说,我正在使用 System.IO.Packaging.Package.Open(Stream)方法并
关于 package.json 文件中的@types 依赖项,我有一个愚蠢的问题: 在下面的 URL 中解释了应该安装的类型作为运行时依赖 npm install --save @types/loda
我是一名优秀的程序员,十分优秀!