$ make
gcc -std=gnu99 -g -fno-pie -rdynamic -fPIC -Wall -o dwdebug src/dwdebug.c -lusb -ldl
In file included from src/system/system.c:5,
from src/dwdebug.c:3:
src/system/SerialPort.c: In function ‘MakeSerialPort’:
src/system/SerialPort.c:81:9: error: implicit declaration of function ‘ioctl’ [-Wimplicit-function-declaration]
81 | if (ioctl(*SerialPort, TCGETS2, &config)) {Close(*SerialPort); *SerialPort = 0; return;}
| ^~~~~
make: *** [Makefile:48: dwdebug] Error 1
Arch Linux x86_64, glibc-2.39.
In Linux, ioctl() is defined in sys/ioctl.h but in src/system/SerialPort.c it is included only if __APPLE__ is defined.
Naive attempt to include sys/ioctl.h into SerialPort.c leads to following errors:
$ make
gcc -std=gnu99 -g -fno-pie -rdynamic -fPIC -Wall -o dwdebug src/dwdebug.c -lusb -ldl
In file included from /usr/include/sys/ioctl.h:29,
from src/system/SerialPort.c:11,
from src/system/system.c:5,
from src/dwdebug.c:3:
/usr/include/bits/ioctl-types.h:27:8: error: redefinition of ‘struct winsize’
27 | struct winsize
| ^~~~~~~
In file included from /usr/include/asm/termios.h:1,
from src/system/SystemServices.c:37,
from src/system/system.c:1:
/usr/include/asm-generic/termios.h:15:8: note: originally defined here
15 | struct winsize {
| ^~~~~~~
/usr/include/bits/ioctl-types.h:36:8: error: redefinition of ‘struct termio’
36 | struct termio
| ^~~~~~
/usr/include/asm-generic/termios.h:23:8: note: originally defined here
23 | struct termio {
| ^~~~~~
make: *** [Makefile:48: dwdebug] Error 1
Following patch seems to fix the issue, but it's hard to create proper pull request due to mess of C sources inclusions. I can't be sure it doesn't break build in other systems.
Arch Linux x86_64, glibc-2.39.
In Linux,
ioctl()
is defined insys/ioctl.h
but insrc/system/SerialPort.c
it is included only if__APPLE__
is defined. Naive attempt to includesys/ioctl.h
intoSerialPort.c
leads to following errors:Following patch seems to fix the issue, but it's hard to create proper pull request due to mess of C sources inclusions. I can't be sure it doesn't break build in other systems.