opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.42k stars 5.76k forks source link

CMake error building with opencv_contrib #2409

Closed jjbuck closed 4 years ago

jjbuck commented 4 years ago
System information (version)
Detailed description

I'm trying to build opencv for javascript by following the Docker instructions in https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html.

I modify the build_js.py file to add the open_cv/contrib directory:

def get_cmake_cmd(self):
        cmd = ["cmake",
               "-DOPENCV_EXTRA_MODULES_PATH=/Users/me/opencv_contrib/modules", 

When I run docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:latest" python ./platforms/js/build_js.py build , I get the following error:

CMake Error at cmake/OpenCVModule.cmake:288 (message):
  No modules has been found: /Users/me/opencv_contrib/modules

But that directory exists, because when I ls the directory I get a result.

>>> ls -la /Users/me/opencv_contrib/modules

total 16
drwxr-xr-x  57 me  ANT\Domain Users  1824 Jan 15 13:28 .
drwxr-xr-x  13 me  ANT\Domain Users   416 Jan 15 13:28 ..
-rw-r--r--   1 me  ANT\Domain Users  5193 Jan 15 13:28 README.md
drwxr-xr-x  11 me  ANT\Domain Users   352 Jan 15 13:28 aruco
drwxr-xr-x  10 me  ANT\Domain Users   320 Jan 15 13:28 bgsegm
drwxr-xr-x  11 me  ANT\Domain Users   352 Jan 15 13:28 bioinspired
drwxr-xr-x   8 me  ANT\Domain Users   256 Jan 15 13:28 ccalib
etc...
Steps to reproduce
alalek commented 4 years ago

What is about CMakeLists.txt inside of these folders?

BTW, cmake --trace-expand may help with investigation (with disabling of ocv_cmake_dump_vars() statement to reduce trace logs).

jjbuck commented 4 years ago

Thanks for your response. Not sure I totally understand the question. I retried with cmake --trace_expand, but it's hard to know what is actually meaningful in all the terminal output. Instead, I'm pasting below a copy of my build/CMakeFiles/CMakeError.log file.

``` Compilation failed: source file: '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx' check option: ' -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387' ===== BUILD LOG ===== Change Dir: /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_13b6e/fast /usr/bin/make -f CMakeFiles/cmTC_13b6e.dir/build.make CMakeFiles/cmTC_13b6e.dir/build make[1]: Entering directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_13b6e.dir/src.cxx.o /emsdk_portable/emscripten/tag-1.39.4/em++ -s USE_PTHREADS=0 -DNDEBUG -O2 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387 -std=c++11 -o CMakeFiles/cmTC_13b6e.dir/src.cxx.o -c /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx error: unknown FP unit '387' shared:ERROR: '/emsdk_portable/clang/tag-e1.39.4/build_tag-e1.39.4_64/bin/clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=4 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libcxx -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libcxxabi/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/compat -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libc/musl/arch/emscripten -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/local/include -DNDEBUG -O2 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387 -std=c++11 -c -DEMSCRIPTEN -mllvm -disable-llvm-optzns /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx -Xclang -disable-O0-optnone -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/SDL -c -o CMakeFiles/cmTC_13b6e.dir/src.cxx.o -emit-llvm' failed (1) CMakeFiles/cmTC_13b6e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_13b6e.dir/src.cxx.o' failed make[1]: *** [CMakeFiles/cmTC_13b6e.dir/src.cxx.o] Error 1 make[1]: Leaving directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Makefile:121: recipe for target 'cmTC_13b6e/fast' failed make: *** [cmTC_13b6e/fast] Error 2 ===== END ===== Compilation failed: source file: '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.c' check option: ' -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387' ===== BUILD LOG ===== Change Dir: /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_b7918/fast /usr/bin/make -f CMakeFiles/cmTC_b7918.dir/build.make CMakeFiles/cmTC_b7918.dir/build make[1]: Entering directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_b7918.dir/src.c.o /emsdk_portable/emscripten/tag-1.39.4/emcc -s USE_PTHREADS=0 -DNDEBUG -O2 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387 -o CMakeFiles/cmTC_b7918.dir/src.c.o -c /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.c error: unknown FP unit '387' shared:ERROR: '/emsdk_portable/clang/tag-e1.39.4/build_tag-e1.39.4_64/bin/clang -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=4 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libcxx -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libcxxabi/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/compat -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libc/musl/arch/emscripten -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/local/include -DNDEBUG -O2 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -mfpmath=387 -c -DEMSCRIPTEN -mllvm -disable-llvm-optzns /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.c -Xclang -disable-O0-optnone -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/SDL -c -o CMakeFiles/cmTC_b7918.dir/src.c.o -emit-llvm' failed (1) CMakeFiles/cmTC_b7918.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_b7918.dir/src.c.o' failed make[1]: *** [CMakeFiles/cmTC_b7918.dir/src.c.o] Error 1 make[1]: Leaving directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Makefile:121: recipe for target 'cmTC_b7918/fast' failed make: *** [cmTC_b7918/fast] Error 2 ===== END ===== Determining size of off64_t failed with the following output: Change Dir: /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_d9883/fast /usr/bin/make -f CMakeFiles/cmTC_d9883.dir/build.make CMakeFiles/cmTC_d9883.dir/build make[1]: Entering directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_d9883.dir/OFF64_T.c.o /emsdk_portable/emscripten/tag-1.39.4/emcc -s USE_PTHREADS=0 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -O2 -o CMakeFiles/cmTC_d9883.dir/OFF64_T.c.o -c /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:19:12: error: use of undeclared identifier 'off64_t' ('0' + ((SIZE / 10000)%10)), ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:20:12: error: use of undeclared identifier 'off64_t' ('0' + ((SIZE / 1000)%10)), ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:21:12: error: use of undeclared identifier 'off64_t' ('0' + ((SIZE / 100)%10)), ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:22:12: error: use of undeclared identifier 'off64_t' ('0' + ((SIZE / 10)%10)), ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:23:12: error: use of undeclared identifier 'off64_t' ('0' + (SIZE % 10)), ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:39:10: error: use of undeclared identifier 'off64_t' return SIZE; ^ /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE' #define SIZE (sizeof(off64_t)) ^ 6 errors generated. shared:ERROR: '/emsdk_portable/clang/tag-e1.39.4/build_tag-e1.39.4_64/bin/clang -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=4 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libcxx -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libcxxabi/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/compat -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/libc -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/lib/libc/musl/arch/emscripten -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/local/include -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -O2 -c -DEMSCRIPTEN -mllvm -disable-llvm-optzns /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c -Xclang -disable-O0-optnone -Xclang -isystem/emsdk_portable/emscripten/tag-1.39.4/system/include/SDL -c -o CMakeFiles/cmTC_d9883.dir/OFF64_T.c.o -emit-llvm' failed (1) CMakeFiles/cmTC_d9883.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_d9883.dir/OFF64_T.c.o' failed make[1]: *** [CMakeFiles/cmTC_d9883.dir/OFF64_T.c.o] Error 1 make[1]: Leaving directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Makefile:121: recipe for target 'cmTC_d9883/fast' failed make: *** [cmTC_d9883/fast] Error 2 /Users/me/code/opencv/opencv/build/CMakeFiles/CheckTypeSize/OFF64_T.c: #include #include #include #undef KEY #if defined(__i386) # define KEY '_','_','i','3','8','6' #elif defined(__x86_64) # define KEY '_','_','x','8','6','_','6','4' #elif defined(__ppc__) # define KEY '_','_','p','p','c','_','_' #elif defined(__ppc64__) # define KEY '_','_','p','p','c','6','4','_','_' #endif #define SIZE (sizeof(off64_t)) char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[', ('0' + ((SIZE / 10000)%10)), ('0' + ((SIZE / 1000)%10)), ('0' + ((SIZE / 100)%10)), ('0' + ((SIZE / 10)%10)), ('0' + (SIZE % 10)), ']', #ifdef KEY ' ','k','e','y','[', KEY, ']', #endif '\0'}; #ifdef __CLASSIC_C__ int main(argc, argv) int argc; char *argv[]; #else int main(int argc, char *argv[]) #endif { int require = 0; require += info_size[argc]; (void)argv; return SIZE; } Build output check failed: Regex: 'unknown .*option' Output line: 'warning: unknown warning option '-Wno-suggest-override', did you mean '-Wno-shift-overflow'? [-Wunknown-warning-option]' Compilation failed: source file: '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx' check option: ' -Wno-suggest-override' ===== BUILD LOG ===== Change Dir: /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_761a2/fast /usr/bin/make -f CMakeFiles/cmTC_761a2.dir/build.make CMakeFiles/cmTC_761a2.dir/build make[1]: Entering directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_761a2.dir/src.cxx.o /emsdk_portable/emscripten/tag-1.39.4/em++ -s USE_PTHREADS=0 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wstrict-prototypes -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-sign-compare -Wno-sign-promo -Wno-undef -Wno-tautological-undefined-compare -Wno-ignored-qualifiers -Wno-extra -Wno-unused-function -Wno-unused-const-variable -Wno-shorten-64-to-32 -Wno-invalid-offsetof -Wno-enum-compare-switch -DNDEBUG -O2 -Wno-suggest-override -std=c++11 -o CMakeFiles/cmTC_761a2.dir/src.cxx.o -c /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx warning: unknown warning option '-Wno-suggest-override'; did you mean '-Wno-shift-overflow'? [-Wunknown-warning-option] /Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp/src.cxx:1:8: warning: unknown pragma ignored [-Wunknown-pragmas] #pragma ^ 2 warnings generated. Linking CXX executable cmTC_761a2.js /opt/cmake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_761a2.dir/link.txt --verbose=1 /emsdk_portable/emscripten/tag-1.39.4/em++ -s USE_PTHREADS=0 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wstrict-prototypes -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-sign-compare -Wno-sign-promo -Wno-undef -Wno-tautological-undefined-compare -Wno-ignored-qualifiers -Wno-extra -Wno-unused-function -Wno-unused-const-variable -Wno-shorten-64-to-32 -Wno-invalid-offsetof -Wno-enum-compare-switch -DNDEBUG -O2 -Wl,--gc-sections -O2 @CMakeFiles/cmTC_761a2.dir/objects1.rsp -o cmTC_761a2.js shared:WARNING: ignoring unsupported linker flag: `--gc-sections` make[1]: Leaving directory '/Users/me/code/opencv/opencv/build/CMakeFiles/CMakeTmp' ===== END ===== ```
alalek commented 4 years ago

No modules has been found

Search for this message and/or your path "/Users/me/opencv_contrib/modules". You need to check flow of the statements above showing the message.


We don't help with remote investigation of problems which we are not able to reproduce on our side (because it is very time consuming and usually configuration problem without any following fix into OpenCV), but we can take a look on the clear reason of the problem and suggest some fix/workaround.

alalek commented 4 years ago

docker run --rm --workdir /code -v "$PWD":/code ...

Looks like, you didn't mount opencv_contrib directory into build container.