You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
O_CLOEXEC is relatively new (for some definition of new), it was included in POSIX 2008. It was available earlier on Linux, but only if _GNU_SOURCE was defined.
This leads to libugpio failing to compile for some environments, my Debian Squeeze box for example:
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT gpio.lo -MD -MP -MF .deps/gpio.Tpo -c -o gpio.lo gpio.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT gpio.lo -MD -MP -MF .deps/gpio.Tpo -c gpio.c -fPIC -DPIC -o .libs/gpio.o
gpio.c: In function ‘gpio_check’:
gpio.c:71: error: ‘O_CLOEXEC’ undeclared (first use in this function)
gpio.c:71: error: (Each undeclared identifier is reported only once
gpio.c:71: error: for each function it appears in.)
make[2]: *** [gpio.lo] Error 1
I can see three possible solutions:
Add a simple
define _GNU_SOURCE
before including fcntl.h
This will only work on Linux (but hey, I don't think any other OS uses sysfs gpio... :-)
Add a:
ifndef O_CLOEXEC
define O_CLOEXEC 0
endif
Will eliminate the compile error, but may disable O_CLOEXEC where it actually could work.
Do some autoconf magic (which I am not a master of)
The text was updated successfully, but these errors were encountered:
O_CLOEXEC is relatively new (for some definition of new), it was included in POSIX 2008. It was available earlier on Linux, but only if _GNU_SOURCE was defined.
This leads to libugpio failing to compile for some environments, my Debian Squeeze box for example:
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT gpio.lo -MD -MP -MF .deps/gpio.Tpo -c -o gpio.lo gpio.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT gpio.lo -MD -MP -MF .deps/gpio.Tpo -c gpio.c -fPIC -DPIC -o .libs/gpio.o
gpio.c: In function ‘gpio_check’:
gpio.c:71: error: ‘O_CLOEXEC’ undeclared (first use in this function)
gpio.c:71: error: (Each undeclared identifier is reported only once
gpio.c:71: error: for each function it appears in.)
make[2]: *** [gpio.lo] Error 1
I can see three possible solutions:
Add a simple
define _GNU_SOURCE
before including fcntl.h
This will only work on Linux (but hey, I don't think any other OS uses sysfs gpio... :-)
Add a:
ifndef O_CLOEXEC
define O_CLOEXEC 0
endif
Will eliminate the compile error, but may disable O_CLOEXEC where it actually could work.
The text was updated successfully, but these errors were encountered: