【错误记录】Visual Studio 中编译 NDK 报错 ( no matching function for call to ‘cacheflush‘ cacheflush(); )

简介: 【错误记录】Visual Studio 中编译 NDK 报错 ( no matching function for call to ‘cacheflush‘ cacheflush(); )

文章目录

一、报错信息

二、报错信息





一、报错信息


使用 Visual Studio 2019 编译 Android 平台的 NDK 项目 ; 编译时报错 ;


报错信息 :


1>./native/native.cpp(428,14): warning G0C39A92D: 'SearchCode' has C-linkage specified, but returns user-defined type 'std::string' (aka 'basic_string<char>') which is incompatible with C [-Wreturn-type-c-linkage]
1>        std::string SearchCode(unsigned char* data,unsigned size){
1>                    ^
1>./native/native.cpp(658,5): error GEF7559A7: no matching function for call to 'cacheflush'
1>                                cacheflush();
1>                                ^~~~~~~~~~
1>D:/001_Develop/001_SDK/Sdk/ndk/android-ndk-r14b/build//../platforms/android-19/arch-arm/usr/include\unistd.h:183:12: note: candidate function not viable: requires 3 arguments, but 0 were provided
1>extern int cacheflush(long start, long end, long flags);
1>           ^
1>1 warning and 1 error generated.
1>make: *** [obj/local/armeabi-v7a/objs/native/native/native.o] Error 1
1>D:\001_Develop\017_Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(46,5): error MSB3073: 命令“"D:\001_Develop\001_SDK\Sdk\ndk\android-ndk-r14b\build\ndk-build.cmd" NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk NDK_APPLICATION_MK=Application.mk ”已退出,代码为 2。
1>已完成生成项目“magic.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

image.png





二、报错信息


仔细研究报错信息 , 发现 D:/001_Develop/001_SDK/Sdk/ndk/android-ndk-r14b/build//../platforms/android-19/arch-arm/usr/include\unistd.h:183:12: note: candidate function not viable: requires 3 arguments, but 0 were provided , 调用的函数头文件是 android-19/arch-arm/usr/include\unistd.h , 这是 ARM 平台的头文件 , 其中的函数定义的都是 ARM 架构的函数 ;


在 ARM 架构的 android-19/arch-arm/usr/include/unistd.h 头文件中 , cacheflush 函数为 :


extern int cacheflush(long start, long end, long flags);


在 x86 架构中该系统调用无效 ;


如果编译的目标 函数库 或 可执行文件 架构有 x86 架构 , 就会报错 , 因为该函数只支持 ARM 架构 ;


#ifndef __i386__
    cacheflush();




在 Application.mk 中 , 要声明只为 x86 编译函数库 , 注释掉 armeabi-v7a armeabi 这两个目标架构 ;


APP_ABI     := x86 
#armeabi-v7a  armeabi
APP_STL     := gnustl_static
APP_PLATFORM    := android-19


涉及 CPU 操作时 , 注意编译的架构 , 以及引用的依赖库 ;


cacheflush 函数是系统调用中刷新 CPU 高速缓存的函数 , 不同的 CPU 架构 , 对应的实现也不同 ;


目录
相关文章
|
API C++
【Azure 环境】VS Code登录China Azure(Function)报错 An error occurred while signing in: invalid_request - AADSTS65002
An error occurred while signing in: invalid_request - AADSTS65002: Consent between first party application 'c27c220f-ce2f-4904-927d-333864217eeb' and first party resource '797f4846-ba00-4fd7-ba43-dac1f8f63013' must be configured via preauthorization - applications owned and operated by Microsoft mus
666 13
|
缓存 开发工具 C++
VS Code调试Function报错|无法加载Diagnostics.Abstractions怎么办?
在调试 Azure Function 时,可能出现 “Could not load file or assembly &#39;Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.0&#39;” 错误,导致主机启动失败。本文详细解析该依赖加载错误的成因,并提供基于不同安装方式(NPM 或 MSI)的解决方案,涵盖重装 Core Tools、清理缓存、检查 .NET SDK 版本等操作步骤,同时提供日志排查与 Docker 容器化替代方案,帮助开发者快速恢复本地调试流程。
537 0
|
网络协议 API 网络安全
【Azure Function App】发现部分请求Function App遇见 403.72 报错(请求Body>100KB)
在调用Azure Function的HTTP Trigger时,发送POST请求偶尔出现403错误,且响应为空、Header信息少。经排查发现,当请求Body大于100KB时会触发403.72错误,原因是启用了“Client Certificate mode”为“Optional Interactive User”。解决方法是将该模式设置为“Ignore”。由于TLS重新协商机制限制,大请求体无法正常处理,导致此问题。
510 1
|
弹性计算 监控 Serverless
函数计算操作报错合集之调用不成功,报错:Function instance health check failed on port 9000 in 120.7 seconds.该怎么办
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
661 0
|
Java Windows
【Azure Function】部署Java Function失败:报错deploy [ERROR] Status code 401和警告 'China North 3' may not be a valid region
1:deploy [ERROR] Status code 401, (empty body). 2: China North 3 may not be a valid region,please refer to https://aka.ms/maven_function_configuration#supported-regions for values. 3:  <azure.functions.maven.plugin.version>1.36.0</azure.functions.maven.plugin.version>
683 11
|
Linux Python
【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend'
ERROR: Error: No module named '_cffi_backend', Cannot find module. Please check the requirements.txt file for the missing module.
584 2
|
文字识别 Linux Swift
多图理解,更懂中文,支持function call的Phi-3.5来了!
微软继今年4月推出Phi-3系列小型语言模型后,又一鼓作气三连发布并开源其「小而美」系列 Phi-3.5模型!
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
550 4
|
缓存
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
405 0
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错

热门文章

最新文章