下载 7zip 源码 , 下载页面 https://sourceforge.net/projects/p7zip/files/ ,
解压源码 , 进入 D:\develop\7zip\p7zip_16.02\CPP\ANDROID\7zr\jni 目录 , 使用 ndk-build 编译 7z 工具 , 报如下错误 ;
[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 版本不匹配 ;