I am running Kali-Linux (debian+gnome). When I compile I get compilation error:
cc -Wall -g -c -o frag.o frag.c
frag.c:7:10: fatal error: stropts.h: No such file or directory
7 | #include <stropts.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: frag.o] Error 1
Can anyone tell me what am I missing and what should I install?
I tried installing glibc-sources but still it didn’t work out.
3
Answers
stropts.h
is part of the Posix STREAMS extension, which Linux never supported. (Since 2008, it has also been marked as obsolescent by Posix, so it may be removed in some future standard revision.)There have been third-party implementations of STREAMS for Linux, but I don’t kniw if any of them are still supported. One which is used by Linux-based telephony apps is contained in openss7.
As mentioned by the other answer, this library is not used on Linux. Since this came up when trying to compile an application on Linux, it’s possible an
#if
was not set correctly.As a workaround, look at the source code to see what the
#if
surrounding the#include
is, and set that to false when compiling.For example, if the code looked like:
And if you are using cmake or gcc, run them with
-DHAVE_STROPTS_H=0
.Another reason not yet mentioned might be the confusion manual introduces. If you need to use
ioctl()
call, the quickest way to find out the header to include might be pulling up aman ioctl
. Well, it turns out there are 2 different manual pages forioctl()
, and having both on the system will result in this misleading and wrong suggestion (accessible directly asman 3 ioctl
) of including thestropts.h
.More likely you actually need a
sys/ioctl.h
, described inman 2 ioctl
: