bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors w


From: ilove zfs
Subject: bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7
Date: Sun, 19 Feb 2017 08:18:53 +0000 (GMT)

Despite the "accept4 flags.  No ifdef as accept4 has a gnulib implementation" building 2.1.7 fails with undeclared identifier errors for SOCK_CLOEXEC and SOCK_NONBLOCK on macOS. Wrapping the relevant sections in ifdef SOCK_CLOEXEC and ifdef SOCK_NONBLOCK seems to work around the build failure, but I'm not sure if there are any problems with doing this, or why the build isn't correctly taking advantage of the gnulib accept4 implementation.

Build logs here:
https://gist.github.com/ilovezfs/248677aac5bededf97ce429245295cd0
https://gist.github.com/21924118f0954831f2d62e7a79bef81d

Build failure is
```
  CC       libguile_2.2_la-net_db.lo
  CC       libguile_2.2_la-socket.lo
socket.c:1658:47: error: use of undeclared identifier 'SOCK_CLOEXEC'
  scm_c_define ("SOCK_CLOEXEC", scm_from_int (SOCK_CLOEXEC));
                                              ^
socket.c:1659:48: error: use of undeclared identifier 'SOCK_NONBLOCK'
  scm_c_define ("SOCK_NONBLOCK", scm_from_int (SOCK_NONBLOCK));
                                               ^
2 errors generated.
make[3]: *** [libguile_2.2_la-socket.lo] Error 1
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2
```

The workaround I'm using is here https://gist.githubusercontent.com/ilovezfs/90060a1be3b0478c1c89e78d23377ff8/raw/eed5c6beb984e13ab52bf7942360383488cd43d3/gistfile1.txt
```
diff --git a/libguile/socket.c b/libguile/socket.c
index 64df64f..446243c 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -1655,8 +1655,12 @@ scm_init_socket ()
 
   /* accept4 flags.  No ifdef as accept4 has a gnulib
      implementation.  */
+#ifdef SOCK_CLOEXEC
   scm_c_define ("SOCK_CLOEXEC", scm_from_int (SOCK_CLOEXEC));
+#endif
+#ifdef SOCK_NONBLOCK
   scm_c_define ("SOCK_NONBLOCK", scm_from_int (SOCK_NONBLOCK));
+#endif
 
   /* setsockopt level.
```

reply via email to

[Prev in Thread] Current Thread [Next in Thread]