Hello,
while compiling libsrtp2, I got this error:
/usr/include/machine/types.h:35:8: error: redefinition of ‘struct flock’
35 | struct flock {
| ^~~~~
In file included from /usr/include/sys/types.h:222,
from
../gstreamer/subprojects/libsrtp-2.7.0/crypto/include/integers.h:60:
/usr/include/machine/types.h:35:8: note: originally defined here
35 | struct flock {
| ^~~~~
This happens because into the library there is this code:
<--- CUT --->
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MACHINE_TYPES_H
#include <machine/types.h>
#endif
<--- CUT --->
The first inclusion of "sys/types.h" includes also "machine/types.h"
and this is ok.
Next, the second directive includes again "machine/types.h" and here
it generates the error.
The problem comes out because "machine/types.h" has not a protection
against multiple inclusions. Actually, something like that should be
done on top and on the bottom of "machine/types.h", like I have seen
elsewhere on other libc:
#ifndef _MACHTYPES_H_
#define _MACHTYPES_H_
....
#endif /* _MACHTYPES_H_ */
By doing this change, everything will work properly because
"machine/types.h" won't try to declare again its types if it has been
already included. I don't know why libsrtp2 is doing this, perhaps it
is needed by other platforms.
However, I think that it should be quite easy to add this change and
make things more safe.
Sincerely,
Carlo Bramini.
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple