moonlight-stream / moonlight-embedded

Gamestream client for embedded systems
https://github.com/moonlight-stream/moonlight-embedded/wiki
GNU General Public License v3.0
1.49k stars 324 forks source link

Problem with FFmpeg when building from source #753

Closed aSempruch closed 5 years ago

aSempruch commented 5 years ago

NVidia Geforce Experience version: 3.19 Moonlight Embedded version: 2.4.10 & 2.4.6 Moonlight Embedded source: compiled from source Moonlight Embedded running on: Raspberry Pi Moonlight Embedded running on distribution: Raspbian jessie

After following the instructions on the wiki as well as this guide for installing ffmpeg, I encounter these undefined references to functions when running make, that to my understanding are defined in the ffmpeg library.

[ 65%] Linking C executable moonlight
/usr/bin/ld: warning: libssl.so.1.0.0, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libcurl.so, may conflict with libssl.so.1.1
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/libcurl.so, may conflict with libcrypto.so.1.1
CMakeFiles/moonlight.dir/src/video/ffmpeg.c.o: In function `ffmpeg_get_frame':
ffmpeg.c:(.text+0x454): undefined reference to `avcodec_receive_frame'
CMakeFiles/moonlight.dir/src/video/ffmpeg.c.o: In function `ffmpeg_decode':
ffmpeg.c:(.text+0x58c): undefined reference to `avcodec_send_packet'
CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o: In function `va_get_format':
ffmpeg_vaapi.c:(.text+0x20): undefined reference to `av_hwframe_ctx_alloc'
ffmpeg_vaapi.c:(.text+0xa8): undefined reference to `av_hwframe_ctx_init'
CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o: In function `va_get_buffer':
ffmpeg_vaapi.c:(.text+0x158): undefined reference to `av_hwframe_get_buffer'
CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o: In function `vaapi_init_lib':
ffmpeg_vaapi.c:(.text+0x190): undefined reference to `av_hwdevice_ctx_create'
collect2: error: ld returned 1 exit status
CMakeFiles/moonlight.dir/build.make:546: recipe for target 'moonlight' failed
make[2]: *** [moonlight] Error 1
CMakeFiles/Makefile2:106: recipe for target 'CMakeFiles/moonlight.dir/all' failed
make[1]: *** [CMakeFiles/moonlight.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I suspect this to be a problem with my ffmpeg installation, however I can't find any problems. I've checked that the missing functions are in fact defined under /usr/local/include/libavutil, and running the command ffmpeg produces this output

ffmpeg version git-2019-07-03-9654e97 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10+deb8u2)
  configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.100 /  7. 56.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

which I believe means ffmpeg is installed correctly.

Also, when attempting to make version 2.4.6, I encounter this error

[ 83%] Building C object CMakeFiles/moonlight.dir/src/video/ffmpeg.c.o
/home/pi/Downloads/moonlight-embedded-2.4.6/src/video/ffmpeg.c: In function ‘ffmpeg_init’:
/home/pi/Downloads/moonlight-embedded-2.4.6/src/video/ffmpeg.c:55:3: warning: ‘avcodec_register_all’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4155) [-Wdeprecated-declarations]
   avcodec_register_all();
   ^
/home/pi/Downloads/moonlight-embedded-2.4.6/src/video/ffmpeg.c:99:27: error: ‘CODEC_FLAG_LOW_DELAY’ undeclared (first use in this function)
     decoder_ctx->flags |= CODEC_FLAG_LOW_DELAY;
                           ^
/home/pi/Downloads/moonlight-embedded-2.4.6/src/video/ffmpeg.c:99:27: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/moonlight.dir/build.make:326: recipe for target 'CMakeFiles/moonlight.dir/src/video/ffmpeg.c.o' failed
make[2]: *** [CMakeFiles/moonlight.dir/src/video/ffmpeg.c.o] Error 1
CMakeFiles/Makefile2:106: recipe for target 'CMakeFiles/moonlight.dir/all' failed
make[1]: *** [CMakeFiles/moonlight.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Any help would be appreciated, thanks. 😄

aSempruch commented 5 years ago

Decided to try again with a fresh raspbian install. Guide on wiki worked perfectly 👍