TianZerL / Anime4KCPP

A high performance anime upscaler
GNU General Public License v3.0
1.82k stars 139 forks source link

请问您 OpenCV for Android 的版本 #108

Closed liguobing closed 1 year ago

liguobing commented 1 year ago
          您好,十分抱歉,又来打扰,我反复确认了,分别在两台 Windows 10 以及一台 Ubuntu 20.04上使用 AndroidStudio rebuild,都会提示上面到错误。

后经过google查询,有人说可能是 OpenCV 的版本问题,按照 https://github.com/TianZerL/Anime4KCPP/wiki/Building 上的提示,OpenCV 3.0 并没有提供 Android sdk,遂下载了 OpenCV 3.1 重新 rebuild 之后,-std=gnu++11 错误提示消失了,但 -O0 依旧存在,并且错误提示也发生了变化,所以可能问题是出在 OpenCV 的版本上,所以麻烦请问您编译成功的 OpenCV 是哪个版本呢?

整体错误提示如下:

> Task :app:externalNativeBuildDebug
Build Anime4KCPPCore_arm64-v8a
ninja: Entering directory `D:\WorkSpace\Android_Studio_workspace\Anime4KCPP_Android\app\.cxx\cmake\debug\arm64-v8a'
[1/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CudaAnime4K09.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[2/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CudaACNet.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[3/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o
FAILED: CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o 
D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:836:36: error: implicit instantiation of undefined template 'std::__ndk1::array<int, 3>'
std::array<int, 3> Anime4KCPP::AC::getResultShape()
                                   ^
D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\__tuple:219:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:838:24: error: implicit instantiation of undefined template 'std::__ndk1::array<int, 3>'
    std::array<int, 3> shape = { H, W, 3 };
                       ^
D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\__tuple:219:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:927:39: error: no member named 'setprecision' in namespace 'std'
                << std::fixed << std::setprecision(2)
                                 ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:928:25: error: no member named 'setw' in namespace 'std'
                << std::setw(5) << 100.0 << '%'
                   ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:929:41: error: no member named 'setw' in namespace 'std'
                << "  elpsed: " << std::setw(5) << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - s).count() / 1000.0 << 's'
                                   ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:930:44: error: no member named 'setw' in namespace 'std'
                << "  remaining: " << std::setw(5) << 0.0 << 's'
                                      ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:940:35: error: no member named 'setprecision' in namespace 'std'
            << std::fixed << std::setprecision(2)
                             ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:941:21: error: no member named 'setw' in namespace 'std'
            << std::setw(5) << progress * 100 << '%'
               ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:942:37: error: no member named 'setw' in namespace 'std'
            << "  elpsed: " << std::setw(5) << currTime << 's'
                               ~~~~~^
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:943:40: error: no member named 'setw' in namespace 'std'
            << "  remaining: " << std::setw(5) << currTime / progress - currTime << 's'
                                  ~~~~~^
10 errors generated.
[4/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUACNetProcessor.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[2/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CudaACNet.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[3/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o
FAILED: CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o 

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]

[5/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/Anime4KCPP.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/Anime4KCPP.cpp:3:
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\Anime4KCPP.hpp:4:
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/ACOpenCL.hpp:12:
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
        ^
D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
        ^
1 warning generated.
[6/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/ACOpenCL.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACOpenCL.cpp:3:
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACOpenCL.hpp:12:
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
        ^
D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
        ^
1 warning generated.
D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[5/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/Anime4KCPP.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]

D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]

[7/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUACNet.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[8/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/filterprocessor.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[9/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCPPWrapper.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCPPWrapper.cpp:3:
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\Anime4KCPP.hpp:4:
In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/ACOpenCL.hpp:12:
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
        ^
D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
        ^
1 warning generated.
D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[8/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/filterprocessor.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[9/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCPPWrapper.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]

[10/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/VideoIO.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[11/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUCNNProcessor.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[12/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLAnime4K09.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[13/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLACNet.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[14/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUAnime4K09.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
ninja: build stopped: subcommand failed.

> Task :app:externalNativeBuildDebug FAILED
D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp

clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[11/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUCNNProcessor.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[12/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLAnime4K09.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[13/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLACNet.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
[14/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUAnime4K09.cpp.o
clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]

Execution failed for task ':app:externalNativeBuildDebug'.
> Build command failed.
  Error while executing process D:\android-sdk-windows\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\WorkSpace\Android_Studio_workspace\Anime4KCPP_Android\app\.cxx\cmake\debug\arm64-v8a Anime4KCPPCore}
  ninja: Entering directory `D:\WorkSpace\Android_Studio_workspace\Anime4KCPP_Android\app\.cxx\cmake\debug\arm64-v8a'
  [1/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CudaAnime4K09.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [2/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CudaACNet.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [3/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o
  FAILED: CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o 
  D:\android-sdk-windows\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DAnime4KCPPCore_EXPORTS -DBUILT_IN_KERNEL -ID:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include -ID:/Libs/Android/OpenCL/inc -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include/opencv -isystem D:/Libs/Android/OpenCV/sdk/native/jni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frtti -fexceptions -O3 -fopenmp -static-openmp -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -MF CMakeFiles\Anime4KCPPCore.dir\Anime4KCore\src\AC.cpp.o.d -o CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/AC.cpp.o -c D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:836:36: error: implicit instantiation of undefined template 'std::__ndk1::array<int, 3>'
  std::array<int, 3> Anime4KCPP::AC::getResultShape()
                                     ^
  D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\__tuple:219:64: note: template is declared here
  template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                                 ^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:838:24: error: implicit instantiation of undefined template 'std::__ndk1::array<int, 3>'
      std::array<int, 3> shape = { H, W, 3 };
                         ^
  D:/android-sdk-windows/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\__tuple:219:64: note: template is declared here
  template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                                 ^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:927:39: error: no member named 'setprecision' in namespace 'std'
                  << std::fixed << std::setprecision(2)
                                   ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:928:25: error: no member named 'setw' in namespace 'std'
                  << std::setw(5) << 100.0 << '%'
                     ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:929:41: error: no member named 'setw' in namespace 'std'
                  << "  elpsed: " << std::setw(5) << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - s).count() / 1000.0 << 's'
                                     ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:930:44: error: no member named 'setw' in namespace 'std'
                  << "  remaining: " << std::setw(5) << 0.0 << 's'
                                        ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:940:35: error: no member named 'setprecision' in namespace 'std'
              << std::fixed << std::setprecision(2)
                               ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:941:21: error: no member named 'setw' in namespace 'std'
              << std::setw(5) << progress * 100 << '%'
                 ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:942:37: error: no member named 'setw' in namespace 'std'
              << "  elpsed: " << std::setw(5) << currTime << 's'
                                 ~~~~~^
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/AC.cpp:943:40: error: no member named 'setw' in namespace 'std'
              << "  remaining: " << std::setw(5) << currTime / progress - currTime << 's'
                                    ~~~~~^
  10 errors generated.
  [4/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUACNetProcessor.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [5/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/Anime4KCPP.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/Anime4KCPP.cpp:3:
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\Anime4KCPP.hpp:4:
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/ACOpenCL.hpp:12:
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
          ^
  D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
          ^
  1 warning generated.
  [6/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/ACOpenCL.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACOpenCL.cpp:3:
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACOpenCL.hpp:12:
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
          ^
  D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
          ^
  1 warning generated.
  [7/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUACNet.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [8/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/filterprocessor.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [9/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCPPWrapper.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCPPWrapper.cpp:3:
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\Anime4KCPP.hpp:4:
  In file included from D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/ACOpenCL.hpp:12:
  D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include/OpenCLAnime4K09.hpp:5:9: warning: 'CL_USE_DEPRECATED_OPENCL_1_2_APIS' macro redefined [-Wmacro-redefined]
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
          ^
  D:/Libs/Android/OpenCL/inc\CL/cl.h:34:9: note: previous definition is here
  #define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
          ^
  1 warning generated.
  [10/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/VideoIO.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [11/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUCNNProcessor.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [12/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLAnime4K09.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [13/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/OpenCLACNet.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  [14/15] Building CXX object CMakeFiles/Anime4KCPPCore.dir/Anime4KCore/src/CPUAnime4K09.cpp.o
  clang++: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]
  ninja: build stopped: subcommand failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Originally posted by @liguobing in https://github.com/TianZerL/Anime4KCPP/issues/107#issuecomment-1794958540

TianZerL commented 1 year ago

理论上用最新的OpenCV4就行,当时最新的版本应该是4.5左右,但是官网的预编译包应该是不带FFmpeg的,如果需要视频处理的话,最好是自己编译OpenCV。

关于O0和gnu++11,可能你引了OpenCV的Debug库,也有可能是你的CMakeFiles里写了相应的SET,单纯的OpenCV库应该是不会自己往编译器加参数的。

TianZerL commented 1 year ago

然后Core的代码最好不要用release的2.5.0版本,用库里最新的。

liguobing commented 1 year ago

哈喽,我又来了 T_T

因为我的需求只是处理图片,所以我就没有自己编译 OpenCV

我是直接使用的 Anime4KCPP_Android CMakeList.txt OpenCV 也是直接在 opencvReleases 下载的。

另外我使用了库里最新的 core 替换了 Anime4KCPP_Android 中的 Anime4KCore 中的文件,但是提示 E:/Work_Space/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\AC.hpp:17:10: fatal error: 'ac_export.h' file not found

ac_export.h 这个头文件又是哪里的呢?

TianZerL commented 1 year ago

主库最新代码的ac_export.h是core里面的CMakeLists.txt生成的。

另外Anime4KCPP_Android自带的Anime4KCore不可以直接编译吗?我看你将里面的Anime4KCore替换为了2.5.0 Release的。

liguobing commented 1 year ago

clone Anime4KCPP_Android ,然后修改 CMakeLists.txt 中到 OpenCV OpenCL EIGEN3 路径之后,rebuild 出错,提示:

D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:76:39: error: no member named 'setprecision' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:77:25: error: no member named 'setw' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:78:43: error: no member named 'setw' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:79:46: error: no member named 'setw' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:89:35: error: no member named 'setprecision' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:90:21: error: no member named 'setw' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/VideoProcessor.cpp:91:39: error: no member named 'setw' in namespace 'std'
liguobing commented 1 year ago

上面那个提示是 OpenCV 3.X 的,将 OpenCV SDK 换成 4.8.1 之后,错误提示如下:

D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: no member named 'make_unique' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:33:20: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:77: note: expanded from macro '\
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: expected '(' for function-style cast or type construction
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:33:20: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:93: note: expanded from macro '\
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: no member named 'make_unique' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:34:36: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:77: note: expanded from macro '\
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: expected '(' for function-style cast or type construction
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:34:36: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:93: note: expanded from macro '\
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: no member named 'make_unique' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:35:32: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:4:40: note: expanded from macro '\
<scratch space>:16:1: note: expanded from here
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:7:39: note: expanded from macro 'REGISTER_PROCESSOR_IF_1'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:77: note: expanded from macro 'REGISTER_PROCESSOR'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: expected '(' for function-style cast or type construction
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:35:32: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:4:40: note: expanded from macro '\
<scratch space>:16:1: note: expanded from here
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:7:39: note: expanded from macro 'REGISTER_PROCESSOR_IF_1'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:93: note: expanded from macro 'REGISTER_PROCESSOR'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/src/ACCreator.cpp:40:9: error: no member named 'make_unique' in namespace 'std'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:83:27: note: expanded from macro 'PROCESSOR_CASE_UP'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:36:55: note: expanded from macro 'PROCESSORS'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:4:40: note: expanded from macro '\
<scratch space>:19:1: note: expanded from here
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:7:39: note: expanded from macro 'REGISTER_PROCESSOR_IF_1'
D:/WorkSpace/Android_Studio_workspace/Anime4KCPP_Android/app/src/main/cpp/Anime4KCore/include\ACRegister.hpp:62:77: note: expanded from macro 'REGISTER_PROCESSOR'
TianZerL commented 1 year ago

因为很久没搞了,一些细节我可能遗忘了,所以我自己试了一下,直接clone Anime4KCPP_Android然后编译,一切正常,未发生上述报错。

我的环境:

编译过程:clone后直接Android Studio打开项目,此时自动下载gradle7.0.2和ndk 21,因为最新AS自带java版本太新的问题会报错提示让升级gradle,自动升级就行,去设置好CMake里依赖的路径之后可以直接编译,不需要额外操作。

上面提到的OpenCL头文件问题,我用的的头文件是编译OpenCL SDK项目后生成的,理论上就是OpenCL-HeadersOpenCL-CLHPP里的头文件,应该可以直接从这两个项目下载放在一起就行,不需要先编译一遍SDK。

对比,我觉得您的问题可能在于opencl,在此提供一份我使用的opencl库供测试: opencl.zip

顺便测试了一下把ndk升级到比较新的25版本也可以正常编译。

liguobing commented 1 year ago

不知道该用什么语言来形容了,白天整整折腾了一天,就差重装电脑了,按照您到步骤一步一步操作,却始终还是出错

晚上回家继续折腾,莫名其妙到好了,回想之前到操作,应该是又升级了一次 gradle

现在的 gradle 及插件版本分别是 7.5/7.4.2

最后祝您备考成功,好运连连!