Motion - Bug Report 2014x 04x 26x 081707
You are here: Foswiki>Motion Web>BugReports>BugReport2014x04x26x081707 (26 Apr 2014, MartinGogo)Edit Attach

BUG: Compilation fails at video2.c on Raspberry Pi

I've seen many people posting a similar problem.

The basic problem I have is that motion fails after a change is detected from a netcam_url. I've read in the FAQ that I need to make sure I use the same version of ffmpeg.

http://www.lavrsen.dk/foswiki/bin/view/Motion/FrequentlyAskedQuestions#Motion_crashes_with_segmentation_fault_the_first_time_it_detects_Motion

So I compiled ffmpeg (2.2.git) and got the latest motion from git. But compilation fails at video2.c. I've seen posts about including <linux/videodev2.h>, but from what I can tell, the git version already have these bugs fixed.

What am I doing wrong?

Thank you!
$ uname -a
Linux myraspi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux

$ ffmpeg -h
ffmpeg version N-62497-ga3bd33a Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 18 2014 12:05:44 with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration: 
  libavutil      52. 76.100 / 52. 76.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 37.100 / 55. 37.100
  libavdevice    55. 13.100 / 55. 13.100
  libavfilter     4.  4.100 /  4.  4.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
Hyper fast Audio and Video encoder


~/downloads/motion $ ./configure 
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for Darwin... no
checking for *BSD... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking threads... yes
checking for sdl... no
checking for libjpeg-turbo... skipping
checking for libjpeg-mmx... skipping
checking for jpeg_set_defaults in -ljpeg... yes
checking for ffmpeg autodetecting libraries... found in /usr/local/lib
checking for ffmpeg headers in /usr/local... found /usr/local/include/libavformat/avformat.h
checking file_protocol is defined in ffmpeg ?... no
checking for sqlite3_open in -lsqlite3... no
checking for mysql support... testing
checking autodect mysql headers... /usr/include/mysql yes
checking autodect mysql libs... not found
Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.
checking for PostgreSQL... testing
checking autodect pgsql headers... yes /usr/include/postgresql
checking autodect pgsql libs... /usr/lib
checking for PQconnectStart in -lpq... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for unistd.h... (cached) yes
checking for stdint.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking linux/videodev.h usability... yes
checking linux/videodev.h presence... yes
checking for linux/videodev.h... yes
checking linux/videodev2.h usability... yes
checking linux/videodev2.h presence... yes
checking for linux/videodev2.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for sys/types.h... (cached) yes
checking for get_current_dir_name... yes
checking for struct v4l2_buffer... no
checking for V42L support... no
checking for V42L *old* support... testing
checking for linux/videodev2.h... (cached) yes
checking size of short... 2
checking size of int... 4
checking size of long int... 4
checking size of long long... 8
checking size of int *... 4
checking size of void *... 4
checking for an ANSI C-conforming const... yes
Detected CPU: ARMv6-compatible processor rev 7 (v6l)
cc1: error: bad value (native) for -march switch
cc1: error: bad value (native) for -mtune switch
No CPU optimizations will be added
checking for bswap instruction... yes
checking for avformat_alloc_context... yes
checking for av_avformat_alloc_context... no
checking for av_register_protocol2... no
checking for av_register_protocol... no
checking for av_get_media_type_string... yes
configure: creating ./config.status
config.status: creating thread1.conf
config.status: creating thread2.conf
config.status: creating thread3.conf
config.status: creating thread4.conf
config.status: creating motion-dist.conf
config.status: creating motion.init-FreeBSD.sh
config.status: creating motion.init-Debian
config.status: creating motion.init-Fedora
config.status: creating motion.spec
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged

   **************************
      Configure status       
      motion Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0
   **************************

OS             :     Linux
pthread support:     Yes
jpeg support:        Yes
V4L support:         Yes
V4L2 support:        Yes
SDL support:         No
FFmpeg support:      Yes
SQLite3 support:     No
MYSQL support:       No
PostgreSQL support:  Yes

CFLAGS:  -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP   
LIBS: -lm  -lpthread -ljpeg -L/usr/local/lib -lavformat -lavcodec -lavutil -lm -lz -L/usr/lib -lpq
LDFLAGS:   -L/usr/local/lib

Install prefix:       /usr/local


~/downloads/motion $ make
Welcome to the setup procedure for Motion, the motion detection daemon! If you get
error messages during this procedure, please report them to the mailing list. The
Motion Guide contains all information you should need to get Motion up and running.
Run &#34;make updateguide&#34; to download the latest version of the Motion Guide.

Version: Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0
Platform: Linux (if this is incorrect, please read README.FreeBSD)

Generating dependencies, please wait...

Compiling Motion object files...
--------------------------------------------------------------------------------
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o motion.o motion.c
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o logger.o logger.c
logger.c: In function ‘motion_log’:
logger.c:226:2: warning: #warning &#34;************************************&#34; [-Wcpp]
logger.c:227:2: warning: #warning &#34;* Using XSI-COMPLIANT strerror_r() *&#34; [-Wcpp]
logger.c:228:2: warning: #warning &#34;************************************&#34; [-Wcpp]
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o conf.o conf.c
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o draw.o draw.c
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o jpegutils.o jpegutils.c
jpegutils.c: In function ‘decode_jpeg_gray_raw’:
jpegutils.c:773:20: warning: variable ‘hsf’ set but not used [-Wunused-but-set-variable]
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o vloopback_motion.o vloopback_motion.c
vloopback_motion.c: In function ‘v4l_open_vidpipe’:
vloopback_motion.c:48:15: warning: variable ‘ostatus’ set but not used [-Wunused-but-set-variable]
vloopback_motion.c:44:15: warning: variable ‘loop’ set but not used [-Wunused-but-set-variable]
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o video.o video.c
gcc -g -O2 -D_REENTRANT -DHAVE_FFMPEG -I/usr/local/include -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -I/usr/include/postgresql -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT=&#34;int&#34; -DHAVE_BSWAP    -Wall -DVERSION=\&#34;Git-28b7cb2a4297c78b9c08c9ce29a648aeb22120d0\&#34; -Dsysconfdir=\&#34;/usr/local/etc\&#34;    -c -o video2.o video2.c
video2.c:143:5: error: ‘V4L2_CID_BRIGHTNESS’ undeclared here (not in a function)
video2.c:144:5: error: ‘V4L2_CID_CONTRAST’ undeclared here (not in a function)
video2.c:145:5: error: ‘V4L2_CID_SATURATION’ undeclared here (not in a function)
video2.c:146:5: error: ‘V4L2_CID_HUE’ undeclared here (not in a function)
video2.c:148:5: error: ‘V4L2_CID_RED_BALANCE’ undeclared here (not in a function)
video2.c:149:5: error: ‘V4L2_CID_BLUE_BALANCE’ undeclared here (not in a function)
video2.c:150:5: error: ‘V4L2_CID_GAMMA’ undeclared here (not in a function)
video2.c:151:5: error: ‘V4L2_CID_EXPOSURE’ undeclared here (not in a function)
video2.c:152:5: error: ‘V4L2_CID_AUTOGAIN’ undeclared here (not in a function)
video2.c:153:5: error: ‘V4L2_CID_GAIN’ undeclared here (not in a function)
video2.c:155:5: error: ‘V4L2_CID_PRIVATE_BASE’ undeclared here (not in a function)
video2.c:164:28: error: field ‘cap’ has incomplete type
video2.c:165:24: error: field ‘src_fmt’ has incomplete type
video2.c:166:24: error: field ‘dst_fmt’ has incomplete type

....and many more video2.c errors.

Environment

Motion version: Git-ad7e243fcaee500f67297305d9235556fb4270b9
ffmpeg version: N-62497-ga3bd33a
Shared libraries: mysql, postgresql
Server OS: Linux Raspbian kernel 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014
-- MartinGogo - 26 Apr 2014

Follow up

Fix record

Topic revision: r1 - 26 Apr 2014, MartinGogo
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.