unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7
@ 2017-02-19  8:18 ilove zfs
  2017-02-20 22:06 ` bug#25790: guile-2.1.7 SOCK_CLOEXEC etc Matt Wette
  2017-02-21 21:15 ` bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 Andy Wingo
  0 siblings, 2 replies; 3+ messages in thread
From: ilove zfs @ 2017-02-19  8:18 UTC (permalink / raw)
  To: 25790

[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]

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.
```

[-- Attachment #2.1: Type: text/html, Size: 3405 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#25790: guile-2.1.7 SOCK_CLOEXEC etc
  2017-02-19  8:18 bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 ilove zfs
@ 2017-02-20 22:06 ` Matt Wette
  2017-02-21 21:15 ` bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Wette @ 2017-02-20 22:06 UTC (permalink / raw)
  To: 25790

I see the same problem on Mac OS.

If the following appeared in a header somewhere CLOEXEC would work:
#define SOCK_CLOEXEC FD_CLOEXEC
It would work.  Note the implementation in lib/accept4.c:
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0
#endif
Then later the flags to accept4 have SOCK_CLOEXEC set, then the call to fcntl includes FD_CLOEXEC. 
So any system that defines FD_CLOEXEC should be able to use SOCK_CLOEXEC.  But it needs to be defined.

I assume if a system supports O_NONBLOCK then something could be done with SOCK_NONBLOCK also.

I was going to submit a patch that is the same, except that I removed the text “No ifdef as accept4 has a gnulib implementation.”

Matt







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7
  2017-02-19  8:18 bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 ilove zfs
  2017-02-20 22:06 ` bug#25790: guile-2.1.7 SOCK_CLOEXEC etc Matt Wette
@ 2017-02-21 21:15 ` Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2017-02-21 21:15 UTC (permalink / raw)
  To: ilove zfs; +Cc: 25790-done

On Sun 19 Feb 2017 09:18, ilove zfs <ilovezfs@icloud.com> writes:

> 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.

Yeah sorry about that.  Fixed I think (we just don't define
SOCK_NONBLOCK et al now).

Andy





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-21 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-19  8:18 bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 ilove zfs
2017-02-20 22:06 ` bug#25790: guile-2.1.7 SOCK_CLOEXEC etc Matt Wette
2017-02-21 21:15 ` bug#25790: SOCK_CLOEXEC and SOCK_NONBLOCK undeclared identifier errors with 2.1.7 Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).