前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )

【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )

作者头像
韩曙亮
发布2023-03-29 10:37:03
4920
发布2023-03-29 10:37:03
举报
文章被收录于专栏:韩曙亮的移动开发专栏

文章目录

一、报错信息


下载 7zip 源码 , 下载页面 https://sourceforge.net/projects/p7zip/files/ ,

解压源码 , 进入 D:\develop\7zip\p7zip_16.02\CPP\ANDROID\7zr\jni 目录 , 使用 ndk-build 编译 7z 工具 , 报如下错误 ;

代码语言:javascript
复制
[armeabi-v7a] Compile++ thumb: 7zr <= XzCrc64Reg.cpp
[armeabi-v7a] Compile++ thumb: 7zr <= ErrorMsg.cpp
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:18:10: error: case value evaluates
      to -2147467263, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
         ^
../../..\Common/MyWindows.h:83:19: note: expanded from macro 'E_NOTIMPL'
#define E_NOTIMPL ((HRESULT)0x80004001L)
                  ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:19:10: error: case value evaluates
      to -2147467262, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
         ^
../../..\Common/MyWindows.h:84:23: note: expanded from macro 'E_NOINTERFACE'
#define E_NOINTERFACE ((HRESULT)0x80004002L)
                      ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:20:10: error: case value evaluates
      to -2147467260, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_ABORT               : txt = "E_ABORT"; break ;
         ^
../../..\Common/MyWindows.h:85:17: note: expanded from macro 'E_ABORT'
#define E_ABORT ((HRESULT)0x80004004L)
                ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:21:10: error: case value evaluates
      to -2147467259, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_FAIL                : txt = "E_FAIL"; break ;
         ^
../../..\Common/MyWindows.h:86:16: note: expanded from macro 'E_FAIL'
#define E_FAIL ((HRESULT)0x80004005L)
               ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:22:10: error: case value evaluates
      to -2147287039, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
         ^
../../..\Common/MyWindows.h:87:31: note: expanded from macro 'STG_E_INVALIDFUNCTION'
#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
                              ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:23:10: error: case value evaluates
      to -2147024882, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
         ^
../../..\Common/MyWindows.h:88:23: note: expanded from macro 'E_OUTOFMEMORY'
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
                      ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates
      to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
         ^
../../..\Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
#define E_INVALIDARG ((HRESULT)0x80070057L)
                     ^
7 errors generated.
make: *** [D:/001_Programs/001_Android/002_Sdk/Sdk/ndk-bundle/build//../build/core/build-binary.mk:478: D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/obj/local/armeabi-v7a/objs/7zr/__/__/__/__/CPP/Windows/ErrorMsg.o] Error 1

D:\develop\7zip\p7zip_16.02\CPP\ANDROID\7zr\jni>ndk-build clean

二、解决方案


当前交叉编译该 p7zip 的时间是 2021 年 04 月 28 日 , 该代码最后更新时间是 2016 年 7 月 ,

代码比较老了 , 使用最新的 22.0.7026061 版本的 ndk , 就会报上述错误 ;

尝试使用旧版本的 16.1.4479499 ndk 进行编译 , 编译完成 ;

NDK 版本不匹配 ;

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-04-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 一、报错信息
  • 二、解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档