简体   繁体   中英

How do I install libraries for <stropts.h>?

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.

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:

#if HAVE_STROPTS_H
#include <stropts.h>
#endif

And if you are using cmake or gcc, run them with -DHAVE_STROPTS_H=0 .

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 .

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 a man ioctl . Well, it turns out there are 2 different manual pages for ioctl() , and having both on the system will result in this misleading and wrong suggestion ( accessible directly as man 3 ioctl ) of including the stropts.h .

More likely you actually need a sys/ioctl.h , described in man 2 ioctl :

#include <sys/ioctl.h>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM