Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] 'SRTO_STRICTENC’ undeclared (first use in this function); did you mean ‘SRTO_STATE’ #1382

Closed
loverdeveloper opened this issue Jun 26, 2020 · 13 comments
Labels
Type: Question Questions or things that require clarification

Comments

@loverdeveloper
Copy link

loverdeveloper commented Jun 26, 2020

Describe the bug

FAILED : 'SRTO_STRICTENC’ undeclared (first use in this function); did you mean ‘SRTO_STATE’? (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||


/home/user/ffmpeg_build/include/srt/srt.h:735:41: note: declared here SRT_ATR_DEPRECATED_PX SRT_API SRTSOCKET srt_socket(int, int, int) SRT_ATR_DEPRECATED;

To Reproduce
Steps to reproduce the behavior:

  • sudo apt-get install libssl-dev
  • cd ~/ffmpeg_sources
  • git clone --depth 1 https://github.com/Haivision/srt.git
  • mkdir srt/build
  • cd srt/build
  • cmake -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_C_DEPS=ON -DENABLE_SHARED=OFF -DENABLE_STATIC=ON ..
  • make
  • make install

  • cd ~/ffmpeg_sources &&
    wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 &&
    tar xjvf ffmpeg-snapshot.tar.bz2 &&
    cd ffmpeg &&
    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure
    --prefix="$HOME/ffmpeg_build"
    --pkg-config-flags="--static"
    --extra-cflags="-I$HOME/ffmpeg_build/include"
    --extra-ldflags="-L$HOME/ffmpeg_build/lib"
    --extra-libs="-lpthread -lm"
    --bindir="$HOME/bin"
    --enable-gpl
    --enable-libass
    --enable-libfdk-aac
    --enable-libfreetype
    --enable-libmp3lame
    --enable-libopus
    --enable-libvorbis
    --enable-libvpx
    --enable-libx264
    --enable-libx265
    --enable-nonfree
    --enable-libsrt
  • PATH="$HOME/bin:$PATH" make
  • BANG ERROR HAPPEND HERE

Expected behavior
Install FFMPEG with libsrt

Desktop (please provide the following information):

  • OS: Linux
  • SRT: Master branch

Additional context
libavformat/libsrt.c: In function ‘libsrt_set_options_pre’: libavformat/libsrt.c:317:66: error: ‘SRTO_STRICTENC’ undeclared (first use in this function); did you mean ‘SRTO_STATE’? (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) || ^~~~~~~~~~~~~~ SRTO_STATE libavformat/libsrt.c:317:66: note: each undeclared identifier is reported only once for each function it appears in libavformat/libsrt.c:336:50: error: ‘SRTO_SMOOTHER’ undeclared (first use in this function); did you mean ‘SRTO_SENDER’? (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) || ^~~~~~~~~~~~~ SRTO_SENDER libavformat/libsrt.c: In function ‘libsrt_setup’: libavformat/libsrt.c:409:5: warning: ‘srt_socket’ is deprecated [-Wdeprecated-declarations] fd = srt_socket(cur_ai->ai_family, cur_ai->ai_socktype, 0); ^~ In file included from libavformat/libsrt.c:24: /home/user/ffmpeg_build/include/srt/srt.h:735:41: note: declared here SRT_ATR_DEPRECATED_PX SRT_API SRTSOCKET srt_socket(int, int, int) SRT_ATR_DEPRECATED; ^~~~~~~~~~ make: *** [ffbuild/common.mak:59: libavformat/libsrt.o] Error 1

@loverdeveloper loverdeveloper added the Type: Bug Indicates an unexpected problem or unintended behavior label Jun 26, 2020
@KevinJW
Copy link

KevinJW commented Jun 26, 2020

Looks to me that this was triggered by 0e2201a which was removing deprecated APIs. So you could try checkout the v1.4.1 tag of SRT.

If you need the head of SRT then FFmpeg will need patching to use the updated API

Kevin

@hydra3333
Copy link

also referenced in 0e2201a#commitcomment-40195285

hydra3333 referenced this issue Jun 26, 2020
* Cleared difference in cmake file
* ATTICs decommissioned
@hydra3333
Copy link

ffmpeg ticket created https://trac.ffmpeg.org/ticket/8760

@ethouris
Copy link
Collaborator

Deprecated options are not forever, sorry. I was hoping I did my best also to issue clear warnings for them. Thanks for the ticket for ffmpeg.

@hydra3333
Copy link

thank you.

@hydra3333
Copy link

Just wondering,

is there a document/link outlining the deprecated functions and how to migrate to the current functions ?

@ethouris
Copy link
Collaborator

When a symbol is deprecated, it should be clearly marked in the header file where it is declared, with also provided explanation what the replacement is, at least in the comments above.

I found however that with this SRTO_STRICTENC option there was no replacement name given, but still, it has been assigned a number, the same as SRTO_ENFORCEDENCRYPTION. There were actually 2 options that were renamed, the other being SRTO_SMOOTHER (renamed to SRTO_CONGESTION), rest of them are options that were experimental, were never used, or refer to some old, abandoned implementation.

@andreweon
Copy link

hi @ethouris I'm getting the same error but I can't seem to understand what's the fix?
https://trac.ffmpeg.org/ticket/8760 Do I have to update /libavformat/libsrt.c as it's stated there?
thanks!

@ethouris
Copy link
Collaborator

ethouris commented Jul 2, 2020

@andreweon : The following symbols were renamed (with old name now removed), which might still be in use somewhere:

SRTO_SMOOTHER -> SRTO_CONGESTION
SRTO_STRICTENC -> SRTO_ENFORCEDENCRYPTION
SRTO_TSBPDDELAY -> SRTO_LATENCY

I wish I could react sooner on the fact that obsolete symbols are in use somewhere, but all I can do is to use some compiler tricks (as this isn't even portable up to C++17 compiler, and for C compilers it's even worse) to warn about them.

@andreweon
Copy link

What would you suggest to do for now? @ethouris

@ethouris
Copy link
Collaborator

ethouris commented Jul 2, 2020

Projects that still use old names should be fixed to use new names as soon as possible. I wish I could do something to prevent problems like these happen in the future.

@andreweon
Copy link

@loverdeveloper @ethouris
As a temporary solution you can clone the repo and go back in commits to this one 10ed37b. I succesfully installed it that way

@maxsharabayko maxsharabayko added Type: Question Questions or things that require clarification and removed Type: Bug Indicates an unexpected problem or unintended behavior labels Jul 13, 2020
@ethouris
Copy link
Collaborator

SOLUTION: The problem was raised by the fact that the dependent project was using a deprecated API, so final removal of the deprecated API caused compile error. SRT project is considered to have provided warnings that it may happen in future soon enough, so the dependent projects should be fixed in order to use the latest version.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Type: Question Questions or things that require clarification
Projects
None yet
Development

No branches or pull requests

6 participants