iamscottxu / obs-rtspserver

RTSP server plugin for obs-studio
https://obsproject.com/forum/resources/obs-rtspserver.1037/
GNU General Public License v2.0
441 stars 55 forks source link

Unable to build from source at least on ArchLinux #58

Closed tytan652 closed 3 years ago

tytan652 commented 3 years ago

I'm trying to update my AUR recipe of obs-rtspserver but when I compile it, I get this:

/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-26.1.2/plugins/obs-rtspserver-2.0.3/rtsp-server/xop/AACSource.cpp: In member function ‘virtual std::string xop::AACSource::GetAttribute()’:
/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-26.1.2/plugins/obs-rtspserver-2.0.3/rtsp-server/xop/AACSource.cpp:73:34: error: format not a string literal and no format arguments [-Werror=format-security]
   73 |   snprintf(nullptr, 0, rtpmap_fmt) + strlen(fmtp_fmt);
      |                                  ^
cc1plus: some warnings being treated as errors
make[2]: *** [plugins/obs-rtspserver-2.0.3/rtsp-server/CMakeFiles/rtsp-server.dir/build.make:314: plugins/obs-rtspserver-2.0.3/rtsp-server/CMakeFiles/rtsp-server.dir/xop/AACSource.cpp.o] Error 1
make[2]: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-26.1.2/build'
make[1]: *** [CMakeFiles/Makefile2:1705: plugins/obs-rtspserver-2.0.3/rtsp-server/CMakeFiles/rtsp-server.dir/all] Error 2
make[1]: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-26.1.2/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-26.1.2/build'

Note that AUR packagers should not modify default flags. Edit: The same happen with 2.0.1 and 2.0.2. I tried to build it on another ArchLinux machine same happen



PS: There is two AUR recipes for obs-rtspserver:

brodi1 commented 3 years ago

Hi @tytan652 Does this warning / error still occur with OBS 27 / obs-rtspserver 2.0.4?

tytan652 commented 3 years ago

I'm actually giving it a try.

tytan652 commented 3 years ago

Same error with 2.0.4 with OBS 27

/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-27.0.0/plugins/obs-rtspserver-2.0.4/rtsp-server/xop/AACSource.cpp: In member function 'virtual std::string xop::AACSource::GetAttribute()':
/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-27.0.0/plugins/obs-rtspserver-2.0.4/rtsp-server/xop/AACSource.cpp:75:25: error: format not a string literal and no format arguments [-Werror=format-security]
   75 |                 snprintf(nullptr, 0, rtpmap_fmt) + strlen(fmtp_fmt);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make[2]: *** [plugins/obs-rtspserver-2.0.4/rtsp-server/CMakeFiles/rtsp-server.dir/build.make:314: plugins/obs-rtspserver-2.0.4/rtsp-server/CMakeFiles/rtsp-server.dir/xop/AACSource.cpp.o] Error 1
make[2]: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-27.0.0/build'
make[1]: *** [CMakeFiles/Makefile2:1192: plugins/obs-rtspserver-2.0.4/rtsp-server/CMakeFiles/rtsp-server.dir/all] Error 2
make[1]: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-27.0.0/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/home/tytan652/Programming/AUR/obs-rtspserver/src/obs-studio-27.0.0/build'
tytan652 commented 3 years ago

When I look at this Changing:

snprintf(nullptr, 0, rtpmap_fmt) + strlen(fmtp_fmt);

To:

snprintf(nullptr, 0, "%s", rtpmap_fmt) + strlen(fmtp_fmt);

Make the compilation work, I don't know if it's a good fix.

brodi1 commented 3 years ago

@tytan652 I just compiled it with "%d" Did you tried if the .so file loads?

Edit: I just tried loading the .so file and it loads!

tytan652 commented 3 years ago

It loads with %s even the setting window show up but I got memory leaks 11 on my side.

Edit: 11 memory leaks with %d Edit: even with obs-rtspserver-bin I get the 11 memory leaks

tytan652 commented 3 years ago

https://github.com/iamscottxu/obs-rtspserver/blob/master/rtsp-server/xop/AACSource.cpp#L69 Since it's strings like %s shall be used

brodi1 commented 3 years ago

@tytan652 you are right....

brodi1 commented 3 years ago

Edit: even with obs-rtspserver-bin I get the 11 memory leaks

hmm.... I think it is because the other plugins are installed for me there are 13 memory leaks.

obs-rtspserver-bin contains the binary (which was compiled by @iamscottxu) and is downloaded directly from github.

tytan652 commented 3 years ago

I think the 11 memory leaks is another issue. Those one are surely done by not freeing correctly some variable.