cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.19k stars 472 forks source link

Include directory should point to 'include' not to 'include/srtp2' #570

Closed lanedis closed 2 years ago

lanedis commented 2 years ago

This is only affects srtp as a meson subproject, if you compile and install it stand-alone everything works fine. test_main.c:

#include <srtp2/srtp.h>
int main() { return 0; }

meson.build:

project('test_srtp', 'c')
# libsrtp_dep = dependency('libsrtp2') # works perfectly if libsrtp2 is installed
libsrtp = subproject('libsrtp2')
libsrtp_dep = libsrtp.get_variable('libsrtp2_dep') # this cause compilation error
executable('test_srtp', 'test_main.c', dependency: libsrtp_dep)

output:

../test_main.c:1:10: fatal error: srtp2/srtp.h: No such file or directory

This is because public_incs pointed to 'include/srtp2' instead of 'include' ps: also we can throw away public_incs and use srtp2_incs instead, not sure which one solution we should to prefer

pabuhler commented 2 years ago

@nirbheek @tp-m @xhaakon ?

nirbheek commented 2 years ago

This is correct, and I tested that it's broken before this and works with this patch applied. LGTM!

ps: also we can throw away public_incs and use srtp2_incs instead, not sure which one solution we should to prefer

Yeah, I think we can use srtp2_incs here. That's cleaner.

I think this happened because the tests are not using libsrtp2_dep, and are linking to the library directly, and adding include_directories: manually. For extra points (and to ensure that this doesn't break in the future), we could switch the tests over to libsrtp2_dep and libsrtp2_static_dep (a new declare_dependency()). But that can be done in a separate PR :)