I'm currently working on a Streaming framework, and decided to use ffmpeg to encode and or decode my Video and or Audio.
So i clicked through https://ffmpeg.org for the api files, and downloaded the statically linked version only to find out it actually contained a .exe (I use Windows in development, but plan on using Linux in production) instead of one or more dll's and header informations.
Since i don't think i can use the 'exe' as replacement for an dll, i cloned the git source, and tried to compile it myself.
Then, while compiling i run into this error:
CC libavutil/random_seed.o
libavutil/random_seed.c: In function 'av_get_random_seed':
libavutil/random_seed.c:130:12: error: implicit declaration of function 'arc4random' [-Werror=implicit-function-declaration]
return arc4random();
^
cc1: some warnings being treated as errors
common.mak:60: recipe for target 'libavutil/random_seed.o' failed
make: *** [libavutil/random_seed.o] Error 1
As far as I can tell, this means that I'm missing the library arc4random, so I started searching for this lib, and found absolutly nothing, besides the fact that this library is somehow Apple related..., but no dll's and stuff or sources to compile it myself.
I use cygwin and its GCC to compile on 64-Bit windows 7 Machine.
Can anyone hint me to some location where I can get this missing library, or some other possibility to get ffmpeg as library into my project? (I would prefer something I can link statically , since this project is meant to be a lib by itself)
Maybe is there a way I can make use of that downloaded exe of ffmpeg, since i can borrow its headers from the source I cloned from Git?
Any Hint appreciated.
Best Regards,
Jannik Adam
This seems to be caused because the #if
is incorrectly reporting that the system has this function. I was able to get around it by editing a couple of files.
Open libavutil/random_seed.c
and look for #if HAVE_ARC4RANDOM
, should be around line 129, and remove that block of three lines:
129 #if HAVE_ARC4RANDOM
130 return arc4random();
131 #endif
When you run make again you'll probably get another similar failure in time.c for gettimeofday(), so open libavutil/time.c
and look for #if HAVE_GETTIMEOFDAY
which should be around line 41 and remove the first block there, like this:
Before changing:
41 #if HAVE_GETTIMEOFDAY
42 struct timeval tv;
43 gettimeofday(&tv, NULL);
44 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
45 #elif HAVE_GETSYSTEMTIMEASFILETIME
After changing:
41 #if HAVE_GETSYSTEMTIMEASFILETIME
After those two changes the compile got a lot further but failed on ffserver.c:
ffserver.c: In function ‘main’:
ffserver.c:4000:5: error: implicit declaration of function ‘sigaction’ [-Werror=implicit-function-declaration]
sigaction(SIGCHLD, &sigact, 0);
To fix this error I opened config.mak and added -D_XOPEN_SOURCE=700
to the end of CFLAGS, like this:
42 CFLAGS= -std=c99 -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized -D_XOPEN_SOURCE=700
This post explains a bit about why -D_XOPEN_SOURCE=700
helps.
Then I ran make
again and it finally succeeded. After running make install
all the binaries were put in place and I was able to successfully use it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With