Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on OpenBSD: SIGWINCH #110

Open
vext01 opened this issue Jan 30, 2018 · 1 comment
Open

Build failure on OpenBSD: SIGWINCH #110

vext01 opened this issue Jan 30, 2018 · 1 comment

Comments

@vext01
Copy link

vext01 commented Jan 30, 2018

$ ./waf
Waf: Entering directory `/home/edd/source/termbox/build'
[ 1/12] c: src/termbox.c -> build/src/termbox.c.1.o
[ 2/12] c: src/utf8.c -> build/src/utf8.c.1.o
[ 3/12] c: src/termbox.c -> build/src/termbox.c.2.o
[ 4/12] c: src/utf8.c -> build/src/utf8.c.2.o
../src/termbox.c: In function 'tb_init_fd':
../src/termbox.c:99: error: 'SIGWINCH' undeclared (first use in this function)
../src/termbox.c:99: error: (Each undeclared identifier is reported only once
../src/termbox.c:99: error: for each function it appears in.)

../src/termbox.c: In function 'tb_init_fd':
../src/termbox.c:99: error: 'SIGWINCH' undeclared (first use in this function)
../src/termbox.c:99: error: (Each undeclared identifier is reported only once
../src/termbox.c:99: error: for each function it appears in.)

Waf: Leaving directory `/home/edd/source/termbox/build'
Build failed
 -> task in 'termbox_shared' failed (exit status 1): 
        {task 7395741466256: c termbox.c -> termbox.c.1.o}
['/usr/bin/gcc', '-std=gnu99', '-Wall', '-Wextra', '-D_XOPEN_SOURCE', '-O3', '-fPIC', '../src/termbox.c', '-c', '-o', '/home/edd/source/termbox/build/src/termbox.c.1.o']
 -> task in 'termbox_static' failed (exit status 1): 
        {task 7395741577296: c termbox.c -> termbox.c.2.o}
['/usr/bin/gcc', '-std=gnu99', '-Wall', '-Wextra', '-D_XOPEN_SOURCE', '-O3', '../src/termbox.c', '-c', '-o', '/home/edd/source/termbox/build/src/termbox.c.2.o']

The fix is to set __BSD_VISIBLE to 1 before including <signal.h>.

In <signal.h>:

...
#define	SIGVTALRM 26	/* virtual time alarm */
#define	SIGPROF	27	/* profiling time alarm */
#if __BSD_VISIBLE
#define SIGWINCH 28	/* window size changes */
#define SIGINFO	29	/* information request */
#endif
#define SIGUSR1 30	/* user defined signal 1 */
#define SIGUSR2 31	/* user defined signal 2 */
...

Cheers.

@rofl0r
Copy link
Contributor

rofl0r commented Jan 30, 2018

__BSD_VISIBLE is an internal macro, that's not the right fix. you need to use the right feature test macro http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

liweitianux added a commit to liweitianux/termbox-next that referenced this issue Oct 5, 2018
This patch makes it working on BSD (tested on DragonFly BSD, should be
the same on FreeBSD).  Fix issue: nsf#110

On Linux, such features macros (_POSIX_C_SOURCE, _XOPEN_SOURCE) are
required to expose more functions.  However, on *BSD, almost everything
is exposed when no feature macros are defined, while defining feature
macros would restrict the functions to be exposed.

See more information at:
https://lists.freebsd.org/pipermail/freebsd-standards/2004-March/000474.html
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
This patch makes it working on BSD (tested on DragonFly BSD, should be
the same on FreeBSD).  Fix issue: nsf#110

On Linux, such features macros (_POSIX_C_SOURCE, _XOPEN_SOURCE) are
required to expose more functions.  However, on *BSD, almost everything
is exposed when no feature macros are defined, while defining feature
macros would restrict the functions to be exposed.

See more information at:
https://lists.freebsd.org/pipermail/freebsd-standards/2004-March/000474.html
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
This patch makes it working on BSD (tested on DragonFly BSD, should be
the same on FreeBSD).  Fix issue: nsf#110

On Linux, such features macros (_POSIX_C_SOURCE, _XOPEN_SOURCE) are
required to expose more functions.  However, on *BSD, almost everything
is exposed when no feature macros are defined, while defining feature
macros would restrict the functions to be exposed.

See more information at:
https://lists.freebsd.org/pipermail/freebsd-standards/2004-March/000474.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants