Issue 1:
System information (version)

OpenCV => 4.1

Operating System / Platform => Ubuntu 18.04.2 LTS

Compiler => g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

Detailed description

Build output check failed:
Regex: 'unrecognized .*option'
Output line: 'cc1: warning: unrecognized command line option ‘-Wno-shorten-64-to-32’'
Compilation failed:
source file: '~/opencv-master/build/CMakeFiles/CMakeTmp/src.c'
check option: ' -Wno-shorten-64-to-32'
===== BUILD LOG =====
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_b6735/fast"
/usr/bin/make -f CMakeFiles/cmTC_b6735.dir/build.make CMakeFiles/cmTC_b6735.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b6735.dir/src.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-unused-parameter -Wno-sign-compare -O3 -DNDEBUG -fPIE -Wno-shorten-64-to-32 -o CMakeFiles/cmTC_b6735.dir/src.c.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/src.c
~/opencv-master/build/CMakeFiles/CMakeTmp/src.c:1:0: warning: ignoring #pragma [-Wunknown-pragmas]
#pragma

cc1: warning: unrecognized command line option ‘-Wno-shorten-64-to-32’
Linking C executable cmTC_b6735
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b6735.dir/link.txt --verbose=1
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-unused-parameter -Wno-sign-compare -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_b6735.dir/src.c.o -o cmTC_b6735
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'

===== END =====

Determining if the include file io.h exists failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_9bfa5/fast"
/usr/bin/make -f CMakeFiles/cmTC_9bfa5.dir/build.make CMakeFiles/cmTC_9bfa5.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9bfa5.dir/CheckIncludeFile.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_9bfa5.dir/CheckIncludeFile.c.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: io.h: No such file or directory
#include <io.h>
^~~~~~
compilation terminated.
CMakeFiles/cmTC_9bfa5.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_9bfa5.dir/CheckIncludeFile.c.o' failed
make[1]: *** [CMakeFiles/cmTC_9bfa5.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_9bfa5/fast' failed
make: *** [cmTC_9bfa5/fast] Error 2

Determining size of INT8 failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_c5d39/fast"
/usr/bin/make -f CMakeFiles/cmTC_c5d39.dir/build.make CMakeFiles/cmTC_c5d39.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c5d39.dir/int8.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_c5d39.dir/int8.c.o -c ~/opencv-master/build/CMakeFiles/CheckTypeSize/int8.c
~/opencv-master/build/CMakeFiles/CheckTypeSize/int8.c:23:22: error: ‘INT8’ undeclared here (not in a function); did you mean ‘INT8_C’?
#define SIZE (sizeof(INT8))
^
~/opencv-master/build/CMakeFiles/CheckTypeSize/int8.c:25:12: note: in expansion of macro ‘SIZE’
('0' + ((SIZE / 10000)%10)),
^~~~
CMakeFiles/cmTC_c5d39.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_c5d39.dir/int8.c.o' failed
make[1]: *** [CMakeFiles/cmTC_c5d39.dir/int8.c.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_c5d39/fast' failed
make: *** [cmTC_c5d39/fast] Error 2

~/opencv-master/build/CMakeFiles/CheckTypeSize/int8.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>

#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','_','_'
#elif defined(__aarch64__)
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
#elif defined(__ARM_ARCH_7A__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#endif

#define SIZE (sizeof(INT8))
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 require;
}

Determining size of INT16 failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_a4877/fast"
/usr/bin/make -f CMakeFiles/cmTC_a4877.dir/build.make CMakeFiles/cmTC_a4877.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a4877.dir/int16.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_a4877.dir/int16.c.o -c ~/opencv-master/build/CMakeFiles/CheckTypeSize/int16.c
~/opencv-master/build/CMakeFiles/CheckTypeSize/int16.c:23:22: error: ‘INT16’ undeclared here (not in a function); did you mean ‘INT16_C’?
#define SIZE (sizeof(INT16))
^
~/opencv-master/build/CMakeFiles/CheckTypeSize/int16.c:25:12: note: in expansion of macro ‘SIZE’
('0' + ((SIZE / 10000)%10)),
^~~~
CMakeFiles/cmTC_a4877.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_a4877.dir/int16.c.o' failed
make[1]: *** [CMakeFiles/cmTC_a4877.dir/int16.c.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_a4877/fast' failed
make: *** [cmTC_a4877/fast] Error 2

~/opencv-master/build/CMakeFiles/CheckTypeSize/int16.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>

#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','_','_'
#elif defined(__aarch64__)
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
#elif defined(__ARM_ARCH_7A__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#endif

#define SIZE (sizeof(INT16))
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 require;
}

Determining size of INT32 failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_20741/fast"
/usr/bin/make -f CMakeFiles/cmTC_20741.dir/build.make CMakeFiles/cmTC_20741.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_20741.dir/int32.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_20741.dir/int32.c.o -c ~/opencv-master/build/CMakeFiles/CheckTypeSize/int32.c
~/opencv-master/build/CMakeFiles/CheckTypeSize/int32.c:23:22: error: ‘INT32’ undeclared here (not in a function); did you mean ‘INT32_C’?
#define SIZE (sizeof(INT32))
^
~/opencv-master/build/CMakeFiles/CheckTypeSize/int32.c:25:12: note: in expansion of macro ‘SIZE’
('0' + ((SIZE / 10000)%10)),
^~~~
CMakeFiles/cmTC_20741.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_20741.dir/int32.c.o' failed
make[1]: *** [CMakeFiles/cmTC_20741.dir/int32.c.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_20741/fast' failed
make: *** [cmTC_20741/fast] Error 2

~/opencv-master/build/CMakeFiles/CheckTypeSize/int32.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>

#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','_','_'
#elif defined(__aarch64__)
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
#elif defined(__ARM_ARCH_7A__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#endif

#define SIZE (sizeof(INT32))
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 require;
}

Determining if the function setmode exists failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_fd91a/fast"
/usr/bin/make -f CMakeFiles/cmTC_fd91a.dir/build.make CMakeFiles/cmTC_fd91a.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fd91a.dir/CheckFunctionExists.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -DCHECK_FUNCTION_EXISTS=setmode -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_fd91a.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_fd91a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fd91a.dir/link.txt --verbose=1
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -DCHECK_FUNCTION_EXISTS=setmode -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_fd91a.dir/CheckFunctionExists.c.o -o cmTC_fd91a
CMakeFiles/cmTC_fd91a.dir/CheckFunctionExists.c.o: In function `main':
CheckFunctionExists.c:(.text.startup.main+0xc): undefined reference to `setmode'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_fd91a.dir/build.make:97: recipe for target 'cmTC_fd91a' failed
make[1]: *** [cmTC_fd91a] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_fd91a/fast' failed
make: *** [cmTC_fd91a/fast] Error 2

Build output check failed:
Regex: 'command line option .* is valid for .* but not for C\+\+'
Output line: 'cc1plus: warning: command line option ‘-Wno-missing-prototypes’ is valid for C/ObjC but not for C++'
Compilation failed:
source file: '~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx'
check option: ' -Wno-missing-prototypes'
===== BUILD LOG =====
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_fc97d/fast"
/usr/bin/make -f CMakeFiles/cmTC_fc97d.dir/build.make CMakeFiles/cmTC_fc97d.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_fc97d.dir/src.cxx.o
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-missing-declarations -Wno-unused-parameter -O3 -DNDEBUG -fPIE -Wno-missing-prototypes -std=c++11 -o CMakeFiles/cmTC_fc97d.dir/src.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx
cc1plus: warning: command line option ‘-Wno-missing-prototypes’ is valid for C/ObjC but not for C++
~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx:1:0: warning: ignoring #pragma [-Wunknown-pragmas]
#pragma

Linking CXX executable cmTC_fc97d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fc97d.dir/link.txt --verbose=1
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-missing-declarations -Wno-unused-parameter -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_fc97d.dir/src.cxx.o -o cmTC_fc97d
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'

===== END =====

Build output check failed:
Regex: 'unrecognized .*option'
Output line: 'cc1: warning: unrecognized command line option ‘-Wno-absolute-value’'
Compilation failed:
source file: '~/opencv-master/build/CMakeFiles/CMakeTmp/src.c'
check option: ' -Wno-absolute-value'
===== BUILD LOG =====
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_576bd/fast"
/usr/bin/make -f CMakeFiles/cmTC_576bd.dir/build.make CMakeFiles/cmTC_576bd.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_576bd.dir/src.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-implicit-function-declaration -Wno-uninitialized -Wno-missing-prototypes -Wno-unused-but-set-parameter -Wno-missing-declarations -Wno-unused -Wno-shadow -Wno-sign-compare -Wno-strict-overflow -Wno-pointer-compare -O3 -DNDEBUG -fPIE -Wno-absolute-value -o CMakeFiles/cmTC_576bd.dir/src.c.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/src.c
~/opencv-master/build/CMakeFiles/CMakeTmp/src.c:1:0: warning: ignoring #pragma [-Wunknown-pragmas]
#pragma

cc1: warning: unrecognized command line option ‘-Wno-absolute-value’
Linking C executable cmTC_576bd
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_576bd.dir/link.txt --verbose=1
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-implicit-function-declaration -Wno-uninitialized -Wno-missing-prototypes -Wno-unused-but-set-parameter -Wno-missing-declarations -Wno-unused -Wno-shadow -Wno-sign-compare -Wno-strict-overflow -Wno-pointer-compare -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_576bd.dir/src.c.o -o cmTC_576bd
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'

===== END =====

Build output check failed:
Regex: 'unrecognized .*option'
Output line: 'cc1plus: warning: unrecognized command line option ‘-Wno-inconsistent-missing-override’'
Compilation failed:
source file: '~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx'
check option: ' -Wno-inconsistent-missing-override'
===== BUILD LOG =====
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_ca285/fast"
/usr/bin/make -f CMakeFiles/cmTC_ca285.dir/build.make CMakeFiles/cmTC_ca285.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_ca285.dir/src.cxx.o
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-shadow -Wno-unused -Wno-sign-compare -Wno-undef -Wno-missing-declarations -Wno-uninitialized -Wno-switch -Wno-parentheses -Wno-array-bounds -Wno-extra -Wno-deprecated-declarations -Wno-misleading-indentation -Wno-deprecated -Wno-suggest-override -O3 -DNDEBUG -fPIE -Wno-inconsistent-missing-override -std=c++11 -o CMakeFiles/cmTC_ca285.dir/src.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx
~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx:1:0: warning: ignoring #pragma [-Wunknown-pragmas]
#pragma

cc1plus: warning: unrecognized command line option ‘-Wno-inconsistent-missing-override’
Linking CXX executable cmTC_ca285
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ca285.dir/link.txt --verbose=1
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-shadow -Wno-unused -Wno-sign-compare -Wno-undef -Wno-missing-declarations -Wno-uninitialized -Wno-switch -Wno-parentheses -Wno-array-bounds -Wno-extra -Wno-deprecated-declarations -Wno-misleading-indentation -Wno-deprecated -Wno-suggest-override -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_ca285.dir/src.cxx.o -o cmTC_ca285
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'

===== END =====

Determining if the Q_WS_WIN exist failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_47b2b/fast"
/usr/bin/make -f CMakeFiles/cmTC_47b2b.dir/build.make CMakeFiles/cmTC_47b2b.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_47b2b.dir/CheckSymbolExists.cxx.o
/usr/bin/g++ -I/usr/include/qt4 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -std=c++11 -o CMakeFiles/cmTC_47b2b.dir/CheckSymbolExists.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx: In function ‘int main(int, char**)’:
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: error: ‘Q_WS_WIN’ was not declared in this scope
return ((int*)(&Q_WS_WIN))[argc];
^~~~~~~~
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: note: suggested alternative: ‘Q_WS_X11’
return ((int*)(&Q_WS_WIN))[argc];
^~~~~~~~
Q_WS_X11
CMakeFiles/cmTC_47b2b.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_47b2b.dir/CheckSymbolExists.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_47b2b.dir/CheckSymbolExists.cxx.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_47b2b/fast' failed
make: *** [cmTC_47b2b/fast] Error 2

File ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#include <QtCore/qglobal.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef Q_WS_WIN
return ((int*)(&Q_WS_WIN))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the Q_WS_QWS exist failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_f1e16/fast"
/usr/bin/make -f CMakeFiles/cmTC_f1e16.dir/build.make CMakeFiles/cmTC_f1e16.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_f1e16.dir/CheckSymbolExists.cxx.o
/usr/bin/g++ -I/usr/include/qt4 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -std=c++11 -o CMakeFiles/cmTC_f1e16.dir/CheckSymbolExists.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx: In function ‘int main(int, char**)’:
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: error: ‘Q_WS_QWS’ was not declared in this scope
return ((int*)(&Q_WS_QWS))[argc];
^~~~~~~~
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: note: suggested alternative: ‘Q_WS_X11’
return ((int*)(&Q_WS_QWS))[argc];
^~~~~~~~
Q_WS_X11
CMakeFiles/cmTC_f1e16.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_f1e16.dir/CheckSymbolExists.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_f1e16.dir/CheckSymbolExists.cxx.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f1e16/fast' failed
make: *** [cmTC_f1e16/fast] Error 2

File ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#include <QtCore/qglobal.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef Q_WS_QWS
return ((int*)(&Q_WS_QWS))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the Q_WS_MAC exist failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_0328e/fast"
/usr/bin/make -f CMakeFiles/cmTC_0328e.dir/build.make CMakeFiles/cmTC_0328e.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_0328e.dir/CheckSymbolExists.cxx.o
/usr/bin/g++ -I/usr/include/qt4 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -std=c++11 -o CMakeFiles/cmTC_0328e.dir/CheckSymbolExists.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx: In function ‘int main(int, char**)’:
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: error: ‘Q_WS_MAC’ was not declared in this scope
return ((int*)(&Q_WS_MAC))[argc];
^~~~~~~~
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:8:19: note: suggested alternative: ‘Q_WS_X11’
return ((int*)(&Q_WS_MAC))[argc];
^~~~~~~~
Q_WS_X11
CMakeFiles/cmTC_0328e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_0328e.dir/CheckSymbolExists.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_0328e.dir/CheckSymbolExists.cxx.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_0328e/fast' failed
make: *** [cmTC_0328e/fast] Error 2

File ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#include <QtCore/qglobal.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef Q_WS_MAC
return ((int*)(&Q_WS_MAC))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the pthread_create exist failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_32b5a/fast"
/usr/bin/make -f CMakeFiles/cmTC_32b5a.dir/build.make CMakeFiles/cmTC_32b5a.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_32b5a.dir/CheckSymbolExists.c.o
/usr/bin/gcc -fPIC -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_32b5a.dir/CheckSymbolExists.c.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_32b5a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_32b5a.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_32b5a.dir/CheckSymbolExists.c.o -o cmTC_32b5a
CMakeFiles/cmTC_32b5a.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text.startup+0x3): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_32b5a.dir/build.make:97: recipe for target 'cmTC_32b5a' failed
make[1]: *** [cmTC_32b5a] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_32b5a/fast' failed
make: *** [cmTC_32b5a/fast] Error 2

File ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_31869/fast"
/usr/bin/make -f CMakeFiles/cmTC_31869.dir/build.make CMakeFiles/cmTC_31869.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_31869.dir/CheckFunctionExists.c.o
/usr/bin/gcc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_31869.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_31869
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_31869.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_31869.dir/CheckFunctionExists.c.o -o cmTC_31869 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_31869.dir/build.make:97: recipe for target 'cmTC_31869' failed
make[1]: *** [cmTC_31869] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_31869/fast' failed
make: *** [cmTC_31869/fast] Error 2

Determining if the include file sys/videoio.h exists failed with the following output:
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_70175/fast"
/usr/bin/make -f CMakeFiles/cmTC_70175.dir/build.make CMakeFiles/cmTC_70175.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_70175.dir/CheckIncludeFile.c.o
/usr/bin/gcc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_70175.dir/CheckIncludeFile.c.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
~/opencv-master/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/videoio.h: No such file or directory
#include <sys/videoio.h>
^~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/cmTC_70175.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_70175.dir/CheckIncludeFile.c.o' failed
make[1]: *** [CMakeFiles/cmTC_70175.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_70175/fast' failed
make: *** [cmTC_70175/fast] Error 2

Build output check failed:
Regex: 'unrecognized .*option'
Output line: 'cc1plus: warning: unrecognized command line option ‘-Wno-unused-private-field’'
Compilation failed:
source file: '~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx'
check option: ' -Wno-unused-private-field'
===== BUILD LOG =====
Change Dir: ~/opencv-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_6bce1/fast"
/usr/bin/make -f CMakeFiles/cmTC_6bce1.dir/build.make CMakeFiles/cmTC_6bce1.dir/build
make[1]: Entering directory '~/opencv-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_6bce1.dir/src.cxx.o
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-unused-function -Wno-deprecated-declarations -Wno-overloaded-virtual -O3 -DNDEBUG -fPIE -Wno-unused-private-field -std=c++11 -o CMakeFiles/cmTC_6bce1.dir/src.cxx.o -c ~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx
~/opencv-master/build/CMakeFiles/CMakeTmp/src.cxx:1:0: warning: ignoring #pragma [-Wunknown-pragmas]
#pragma

cc1plus: warning: unrecognized command line option ‘-Wno-unused-private-field’
Linking CXX executable cmTC_6bce1
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6bce1.dir/link.txt --verbose=1
/usr/bin/g++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -Wno-unused-function -Wno-deprecated-declarations -Wno-overloaded-virtual -O3 -DNDEBUG -Wl,--gc-sections CMakeFiles/cmTC_6bce1.dir/src.cxx.o -o cmTC_6bce1
make[1]: Leaving directory '~/opencv-master/build/CMakeFiles/CMakeTmp'

===== END =====

Steps to reproduce

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_GSTREAMER=ON -D WITH_PROTOBUF=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_GSTREAMER_0_10=OFF -D WITH_OPENCL=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D WITH_FFMPEG=ON -D WITH_CUFFT=ON -D WITH_V4L=ON -D WITH_V4L2=ON -D WITH_LIBV4L2=ON -D WITH_LIBV4L=ON -D OPENCV_ENABLE_NONFREE=ON -D CMAKE_CXX_COMPILER=g++ -D CMAKE_C_COMPILER=gcc -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ..

Issue 2:
System information (version)

OpenCV => 4.0.1

Operating System / Platform => Linux 64-bit (Ubuntu 18.04)

Compiler => Clang 7.0.1

Detailed description

The following test in imgcodecs is failing:

[ RUN ] imgcodecs/Imgcodecs_Image.read_write/3, where GetParam() = "jp2"
warning: empty layer generated
opencv/modules/imgcodecs/test/test_read_write.cpp:75: Failure
Expected: (psnr) > (thresDbell), actual: 13.2068 vs 32
warning: empty layer generated
opencv/modules/imgcodecs/test/test_read_write.cpp:93: Failure
Expected: (psnr) > (thresDbell), actual: 13.2068 vs 32
[ FAILED ] imgcodecs/Imgcodecs_Image.read_write/3, where GetParam() = "jp2" (303 ms)

Other unit tests in that library pass just fine, and there don't seem to be any problems compiling opencv or other tests failing in other modules.

The particular test does not fail when compiling with GCC 8.2.

Steps to reproduce

Tested on both 4.0.1 and 3.4.5, same behavior

Relevant cmake configuration:

-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/local/bin/clang++ (ver 7.0.1)
-- Media I/O:
-- TIFF: build (ver 42 - 4.0.9)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)