OpenBSD 6.1 termio.h: No such file or directory - c

I try to build my code with OpenBSD 6.1 but I get this error message.
sh.h:98:20: error: termio.h: No such file or directory
In file included from edit.c:1:
sh.h:235: error: conflicting types for 'rlim_t'
/usr/include/sys/types.h:145: error: previous declaration of 'rlim_t' was here
In file included from edit.c:1:
sh.h:2291: warning: 'struct termio' declared inside parameter list
sh.h:2291: warning: its scope is only this definition or declaration, which is probably not what you want
edit.c: In function 'x_mode':
edit.c:3256: error: invalid use of undefined type 'struct termio'
edit.c:3256: error: 'VERASE' undeclared (first use in this function)
edit.c:3256: error: (Each undeclared identifier is reported only once
edit.c:3256: error: for each function it appears in.)
edit.c:3256: error: invalid use of undefined type 'struct termio'
edit.c:3257: error: invalid use of undefined type 'struct termio'
edit.c:3257: error: 'VKILL' undeclared (first use in this function)
edit.c:3257: error: invalid use of undefined type 'struct termio'
edit.c:3258: error: invalid use of undefined type 'struct termio'
edit.c:3258: error: 'VINTR' undeclared (first use in this function)
edit.c:3258: error: invalid use of undefined type 'struct termio'
edit.c:3259: error: invalid use of undefined type 'struct termio'
edit.c:3259: error: 'VQUIT' undeclared (first use in this function)
edit.c:3259: error: invalid use of undefined type 'struct termio'
edit.c:3260: error: invalid use of undefined type 'struct termio'
edit.c:3260: error: 'VEOF' undeclared (first use in this function)
edit.c:3260: error: invalid use of undefined type 'struct termio'
edit.c:3293: error: 'TCSETAW' undeclared (first use in this function)
*** Error 1 in src (Makefile:774 'edit.o')
*** Error 1 in . (Makefile:834 'all-recursive')
*** Error 1 in /root/opsh (Makefile:750 'all')
# pkg_add termios
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find termios
# pkg_add termios
# termios
ksh: termios: not found
# termio
ksh: termio: not found
# pkg_add libc6-dev
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find libc6-dev
# pkg_add libc6
quirks-2.304 signed on 2017-04-02T15:01:33Z
Can't find libc6
#
What can I do about it? The code compiles with Ubuntu 1604.

The <termio.h> header is not standard, even though it is available on Linux. The standard header is POSIX <termios.h>.
On my Ubuntu 16.04 LTS VM image, the file contains, in its entirety:
/* Compatible <termio.h> for old `struct termio' ioctl interface.
This is obsolete; use the POSIX.1 `struct termios' interface
defined in <termios.h> instead. */
#include <termios.h>
#include <sys/ioctl.h>
If you use non-standard headers, you can expect not to find them on other systems. You can create yourself a copy of <termio.h> using the information above. You may be lucky and find that the BSD <sys/ioctl.h> (it does exist) contains the information you need — if any — but it is not a header standardized by POSIX so all bets are off. If you're only using standard symbols from <termios.h>, you should be safe.

Related

Compiling PostgreSQL extension, getting "error: ‘work_mem’ undeclared (first use in this function)"

When I compile the extension I've got, I'm getting
error: ‘work_mem’ undeclared (first use in this function)
17 | Tuplestorestate *tupstore = tuplestore_begin_heap(true, false, work_mem);
What header includes work_mem?
The work_mem symbol is provided by misadmin.h you will have to add that header into your .c file.
#include "miscadmin.h"

'SOL_SOCKET' undeclared (first use in this function) while installing collectd in RHEL6

I am trying to install collectd on RHEL6. While running 'make', i am facing the below issue.
error:
network.c: In function 'network_bind_socket':
network.c:1854: error: 'SOL_SOCKET' undeclared (first use in this function)
network.c:1854: error: (Each undeclared identifier is reported only once
network.c:1854: error: for each function it appears in.)
network.c:1854: error: 'SO_REUSEADDR' undeclared (first use in this function)
make[3]: *** [network_la-network.lo] Error 1
The getsockopt() specifies be included and i have added <sys/socket.h> header in the 'network.c', still I am facing the same issue.

C compiling error with shellforge

l made a C program and l want to compile it using shell forge but I had several errors, how can I solve them?
Errors
##[ERROR]## compiler reported error 1 while compiling /tmp/sfvLvXlY/sonu.c
##[ERROR]## In file included from :1:
././sflib/linux_amd64/sflib.h:93: warning: "struct rusage" declared inside parameter list
././sflib/linux_amd64/sflib.h:93: warning: its scope is only this definition or declaration, which is probably not what you want
././sflib/linux_amd64/sflib.h:97: warning: "struct sembuf" declared inside parameter list
In file included from /usr/include/stdio.h:34,
from /tmp/sfvLvXlY/sonu.c:3:
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h:213: error: conflicting types for 'size_t'
././sflib/linux_amd64/../common/sftypes.h:25: error: previous declaration of 'size_t' was here

Compilation Error of C code on Linux (Same code compiles on OSX)

I am trying to compile some code on linux that I KNOW compiles on OSX, but I am getting some issues.
All of the files have headers named .h, and all of the files are in the same directory. I am compiling like this:
gcc *.c -std=c99 -lpthread
And while this code does compile on OSX, I get a bunch of weird linker errors on my Ubuntu install. Am I missing a few compiler options? It is a default Ubuntu-server install with the additional packages gcc and build-essential installed.
In file included from errorLogger.h:24:0,
from configParser.h:17,
from configParser.c:9:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
configParser.c: In function ‘parseConfigFile’:
configParser.c:114:5: warning: implicit declaration of function ‘getline’ [-Wimplicit-function-declaration]
In file included from errorLogger.h:24:0,
from global.h:18,
from connection.h:19,
from connection.c:10:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
connection.c: In function ‘createConnectionQueue’:
connection.c:189:28: warning: assignment makes integer from pointer without a cast [enabled by default]
In file included from errorLogger.h:24:0,
from database.h:16,
from database.c:9:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
In file included from errorLogger.h:24:0,
from errorLogger.c:10:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
errorLogger.c: In function ‘reportError’:
errorLogger.c:63:5: warning: implicit declaration of function ‘strerror_r’ [-Wimplicit-function-declaration]
errorLogger.c: In function ‘logMessage’:
errorLogger.c:87:5: warning: implicit declaration of function ‘localtime_r’ [-Wimplicit-function-declaration]
errorLogger.c: In function ‘processErrorQueue’:
errorLogger.c:131:17: warning: implicit declaration of function ‘open’ [-Wimplicit-function-declaration]
errorLogger.c:131:57: error: ‘O_APPEND’ undeclared (first use in this function)
errorLogger.c:131:57: note: each undeclared identifier is reported only once for each function it appears in
errorLogger.c:131:68: error: ‘O_CREAT’ undeclared (first use in this function)
errorLogger.c:131:78: error: ‘O_WRONLY’ undeclared (first use in this function)
errorLogger.c:131:88: error: ‘S_IWRITE’ undeclared (first use in this function)
errorLogger.c:131:99: error: ‘S_IREAD’ undeclared (first use in this function)
errorLogger.c:146:13: warning: implicit declaration of function ‘fsync’ [-Wimplicit-function-declaration]
errorLogger.c: In function ‘startErrorLogger’:
errorLogger.c:167:36: error: ‘O_APPEND’ undeclared (first use in this function)
errorLogger.c:167:47: error: ‘O_CREAT’ undeclared (first use in this function)
errorLogger.c:167:57: error: ‘O_WRONLY’ undeclared (first use in this function)
errorLogger.c:167:67: error: ‘S_IWRITE’ undeclared (first use in this function)
errorLogger.c:167:78: error: ‘S_IREAD’ undeclared (first use in this function)
errorLogger.c:214:57: error: ‘O_EXCL’ undeclared (first use in this function)
errorLogger.c:231:27: warning: assignment makes integer from pointer without a cast [enabled by default]
errorLogger.c: In function ‘closeErrorLogger’:
errorLogger.c:246:9: warning: implicit declaration of function ‘pthread_kill’ [-Wimplicit-function-declaration]
In file included from errorLogger.h:24:0,
from global.h:18,
from global.c:9:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
In file included from main.c:23:0:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
main.c: In function ‘main’:
main.c:53:5: warning: implicit declaration of function ‘blockSignals’ [-Wimplicit-function-declaration]
main.c:61:45: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
main.c:62:29: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
main.c:64:10: error: dereferencing pointer to incomplete type
main.c:65:10: error: dereferencing pointer to incomplete type
main.c:66:10: error: dereferencing pointer to incomplete type
main.c:66:23: error: ‘AI_PASSIVE’ undeclared (first use in this function)
main.c:66:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:69:5: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
main.c:73:9: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
main.c:73:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat]
main.c:73:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat]
main.c:81:41: error: dereferencing pointer to incomplete type
main.c:83:30: error: dereferencing pointer to incomplete type
main.c:83:46: error: dereferencing pointer to incomplete type
main.c:83:64: error: dereferencing pointer to incomplete type
main.c:96:30: error: dereferencing pointer to incomplete type
main.c:96:44: error: dereferencing pointer to incomplete type
main.c:112:5: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
main.c:138:9: error: unknown type name ‘fd_set’
main.c:142:9: warning: implicit declaration of function ‘FD_ZERO’ [-Wimplicit-function-declaration]
main.c:143:9: warning: implicit declaration of function ‘FD_SET’ [-Wimplicit-function-declaration]
main.c:145:9: warning: implicit declaration of function ‘pselect’ [-Wimplicit-function-declaration]
In file included from signalHandling.c:10:0:
signalHandling.h:24:18: error: unknown type name ‘sigset_t’
signalHandling.c:12:18: error: unknown type name ‘sigset_t’
signalHandling.c: In function ‘setHandler’:
signalHandling.c:51:53: error: invalid application of ‘sizeof’ to incomplete type ‘struct sigaction’
signalHandling.c:52:36: error: invalid application of ‘sizeof’ to incomplete type ‘struct sigaction’
signalHandling.c:54:5: warning: implicit declaration of function ‘sigemptyset’ [-Wimplicit-function-declaration]
signalHandling.c:54:30: error: dereferencing pointer to incomplete type
signalHandling.c:60:9: warning: implicit declaration of function ‘sigaddset’ [-Wimplicit-function-declaration]
signalHandling.c:60:35: error: dereferencing pointer to incomplete type
signalHandling.c:67:17: error: dereferencing pointer to incomplete type
signalHandling.c:72:9: warning: implicit declaration of function ‘sigaction’ [-Wimplicit-function-declaration]
You are probably missing some #includes which are brought in implicitly on OS X, but not on Linux.
Judging from the error messages, you are probably missing includes for at least:
<signal.h> (for sigset_t and others)
<fcntl.h> (for O_*)
<unistd.h> (for a bunch of stuff)
<netdb.h> (for various network functions and constants)
<stdio.h> (for getline)
You may also need to define some feature macros (e.g, _POSIX_C_SOURCE) to get certain system-dependent functions, including strerror_r and pselect.
I'm assuming that the immediate objective is to get the code to compile at all, and that once that's done, you'll go back and revise the source so it works out of the box on both platforms. That means that hacks are acceptable very short-term; they'll be fixed properly as you gain knowledge about what the portability issues are. (If it's any consolation, the first alternative system to the one where the software was originally developed is usually the hardest; after that, it generally gets easier.)
The first thing to try is:
gcc *.c -std=gnu99 -lpthread
This tells system header files to define many more symbols than -std=c99. (There's some dissent on this topic, which is OK. At the least, if you add -pedantic to a -std=c99 compilation, then symbols in standard C headers defined by POSIX are not exposed unless you also request POSIX support — see below. Since you don't have -pedantic, that may not be a factor in the compilations, in which case quietly move on to the next recommendation, which is the basis for future portability to POSIX systems.)
If that is insufficient to get you back on track, then you'll probably need to use something like:
gcc *.c -std=gnu99 -D_XOPEN_SOURCE=700 -lpthread
This says "Provide me with the POSIX and X/Open functions corresponding to POSIX 2008". You can try 600 and 500 for older versions, but you probably won't need to do so on Linux. In due course, you're likely to set _XOPEN_SOURCE automatically, either through a configuration header or via a configuration tool. While you're getting things to compile at all, specifying it on the command line is OK. In due course, you'll be using a makefile or equivalent to control the compilation and not typing a gcc command line at the shell.)
The sigset_t is defined in <signal.h> under POSIX. So, requesting POSIX support explicitly should get things to compile again properly. If you still get types such as sigset_t undeclared, then there must be a header on Mac OS X that includes the standard headers such as <signal.h> but which does some unrelated task on Linux (and therefore does not include <signal.h>). That will require source code scrutiny. However, it is relatively unlikely to be necessary.
You need to include additional header files because different system headers include other different system headers.
Also for example gcc has been working hard to not included headers that it should not.
Is signalHandling.h including #include <signal.h> where sigset_t is defined?
EDIT
After talking with the OP it seems the problems was a compile/link problem. Compiling the source into object files first and then linking them after seemed to have solved their problem.

About how to link Quicktime.framework with libvidcap

I am tring to capture video using libvidcap in mac
I got the following errors while installing libvidcap:
quicktime/sg_manager.c:73: error: 'struct sg_source' has no member named 'channel'
quicktime/sg_manager.c:74: error: 'sgDeviceListIncludeInputs' undeclared (first use in this function)
quicktime/sg_manager.c:75: error: 'device_list' undeclared (first use in this function)
quicktime/sg_manager.c:82: error: 'dlr' undeclared (first use in this function)
quicktime/sg_manager.c:103: error: 'SGDeviceInputListPtr' undeclared (first use in this function)
quicktime/sg_manager.c:103: error: expected ';' before 'ilr'
quicktime/sg_manager.c:109: error: 'ilr' undeclared (first use in this function)
quicktime/sg_manager.c:128: warning: implicit declaration of function 'SGDisposeDeviceList'
quicktime/sg_manager.c:128: error: 'struct sg_source' has no member named 'grabber'
I added the QuickTime/QuickTimeComponents.h header in my source, but this did not solve the problem. What else do I need to do?
./configure CFLAGS="-arch i386" LDFLAGS="-arch i386"

Resources