OpenCV Cmake error with TestEndianess.c

asked 2016-10-04 06:29:06 -0600

Johan gravatar image

I am using cmake version 3.5.2 and g++ (GCC) 5.2.0 version to build opencv with tag 3.1.0.

I use following command to configure the build:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$HOME/local  \
-D INSTALL_C_EXAMPLES=ON  \
-D WITH_FFMPEG=OFF  \
-D WITH_V4L=OFF  \
-D WITH_LIBV4L=OFF  \
-D INSTALL_PYTHON_EXAMPLES=ON  \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules  \
-D BUILD_EXAMPLES=ON  \
-D WITH_SDL2APPLICATION=OFF .."

I could resolve a couple of errors I got, but not this. Would be great if someone could help!

Determining if the system is big endian passed with the following output:
Change Dir: /cluster/home/stegeran/opencv/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_c39f0/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_c39f0.dir/build.make CMakeFiles/cmTC_c39f0.dir/build
gmake[1]: Entering directory `/cluster/home/stegeran/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c39f0.dir/TestEndianess.c.o
/cluster/apps/gcc/4.8.2/bin/gcc    -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden  -O3 -DNDEBUG   -o CMakeFiles/cmTC_c39f0.dir/TestEndianess.c.o   -c /cluster/home/stegeran/opencv/build/CMakeFiles/CMakeTmp/TestEndianess.c
Linking C executable cmTC_c39f0
/cluster/apps/cmake/3.5.2/x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c39f0.dir/link.txt --verbose=1
/cluster/apps/gcc/4.8.2/bin/gcc     -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden  -O3 -DNDEBUG    CMakeFiles/cmTC_c39f0.dir/TestEndianess.c.o  -o cmTC_c39f0 -rdynamic 
gmake[1]: Leaving directory `/cluster/home/stegeran/opencv/build/CMakeFiles/CMakeTmp'

TestEndianess.c:
/* A 16 bit integer is required. */
typedef unsigned short cmakeint16;

/* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
   On a big endian machine the characters will be exchanged pairwise. */
const cmakeint16 info_little[] =  {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};

/* on a big endian machine, these 16bit ints will give "THIS IS BIG ENDIAN."
   On a little endian machine the characters will be exchanged pairwise. */
const cmakeint16 info_big[] =     {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};

#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
  int require = 0;
  require += info_little[argc];
  require += info_big[argc];
  (void)argv; 
  return require;
}
edit retag flag offensive close merge delete

Comments

1

I have the same problem...

zeroptr gravatar imagezeroptr ( 2016-10-04 10:05:25 -0600 )edit

@zeroptr, still, don't make an answer, if you don't have one.

berak gravatar imageberak ( 2016-10-04 10:17:40 -0600 )edit

Any hint would help!

Johan gravatar imageJohan ( 2016-10-05 03:32:37 -0600 )edit