MayaPosch / NymphCast

Audio and video casting system with support for custom applications.
http://nyanko.ws/nymphcast.php
BSD 3-Clause "New" or "Revised" License
2.41k stars 81 forks source link

Installation - screensaver make failed #28

Closed BatBat81 closed 4 years ago

BatBat81 commented 4 years ago

Hi, I'm quit new on linux, so sorry if my question is a dummy one. Actually I run into an issue when installing NymphCast server on my system. During the "make" screensaver failed. Here is my issue:

g++ -c -o obj/screensaver.o screensaver.cpp -f function-sections -fdata-sections -g3 -O0 -I . -I ffplay -I angelscript/angelscript/include -I angelscript/add_on -I angelscript/json `sdl2-config --cflags` -std=c++17
screensaver.cpp:6:10: fatal error: filesystem: No such file or directory #include <filesystem>   // C++17

The previous steps ran just fine but here I don't know what I can do. Note: screensaver.cpp is in the NymphCast/src/server (like the config_paser.cpp which is built correctly)

My system: odroid-c2 running Ubuntu mate 18.04

Dependencies seems ok: libpoco-dev is already the newest version (1.8.0.1-1ubuntu4). libsdl2-image-dev is already the newest version (2.0.3+dfsg1-1). libavcodec-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libavdevice-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libavformat-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libavutil-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libpostproc-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libswresample-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libswscale-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1). libsdl2-dev is already the newest version (2.0.8+dfsg1-1ubuntu2).

NymphRPC library found in /usr/local/lib. Skipping installation.

Thanks for the help.

MayaPosch commented 4 years ago

Hello, and welcome :)

The issue is that the compiler cannot find the <filesystem> header, which is used for filesystem-related functionality. This is a C++17 feature.

It appears that Ubuntu 18:04 uses GCC 7.4 by default: https://packages.ubuntu.com/bionic/g++

GCC 8 was the first to provide <filesystem> https://en.cppreference.com/w/cpp/compiler_support

Some people are installing GCC 9 on Ubuntu 18.04: https://askubuntu.com/questions/1140183/install-gcc-9-on-ubuntu-18-04

The easiest way to solve this issue would be to update to a newer GCC version. It appears that GCC 8 is directly available, as the g++-8 package:

sudo apt-get update sudo apt-get install gcc-8 g++-8 gcc-X --version

(Via: https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu)

Hope this helps! :)

BatBat81 commented 4 years ago

Great. That solved the issue. I run it using gcc-8 and g++-8.

I managed to fix another issue due to ubuntu 18.04.

g++ -c -o obj/ffplay/stream_handler.o ffplay/stream_handler.cpp -ffunction-sections -fdata-sections -g3 -O0 -I . -I ffplay -I angelscript/angelscript/include -I angelscript/add_on -I angelscript/json `sdl2-config --cflags` -std=c++17
In file included from ffplay/types.h:38,
                 from ffplay/frame_queue.h:7,
                 from ffplay/stream_handler.cpp:3:
ffplay/cmdutils.h:640:34: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
     snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
                                  ^
ffplay/stream_handler.cpp: In function 'int is_realtime(AVFormatContext*)':
ffplay/stream_handler.cpp:357:33: error: 'AVFormatContext' {aka 'struct AVFormatContext'} has no member named 'url'
     if(s->pb && (   !strncmp(s->url, "rtp:", 4)
                                 ^~~
ffplay/stream_handler.cpp:358:33: error: 'AVFormatContext' {aka 'struct AVFormatContext'} has no member named 'url'
                  || !strncmp(s->url, "udp:", 4)
                                 ^~~
ffplay/stream_handler.cpp: In static member function 'static int StreamHandler::read_thread(void*)':
ffplay/stream_handler.cpp:686:61: error: 'AVFormatContext' {aka 'struct AVFormatContext'} has no member named 'url'
                        "%s: error while seeking\n", is->ic->url);
                                                             ^~~
Makefile:75: recipe for target 'obj/ffplay/stream_handler.o' failed
make: *** [obj/ffplay/stream_handler.o] Error 1

It is due to the official libAV for Ubuntu 18.04 seems to be v3. But I find a rep with the ffmpeg v4.

ppa:jonathonf/ffmpeg-4

Then, I was able to finish the installation. :)

So, now I will play a little bit with NymphCast. Thanks.

MayaPosch commented 4 years ago

I'm glad you got it working :)