This repository has been archived by the owner. It is now read-only.

Failed to find kqueue on FreeBSD #915

Closed
lichray opened this Issue Apr 13, 2011 · 3 comments

Comments

Projects
None yet
3 participants

lichray commented Apr 13, 2011

On FreeBSD, kqueue is defined in sys/event.h . Yes, the wscript checked the availability of event.h, but failed with following errors:
./build/config.log:Checking for header sys/event.h
./build/config.log:#include <sys/event.h>
./build/config.log:/usr/include/sys/event.h:58:2: error: unknown type name 'uintptr_t'
./build/config.log:/usr/include/sys/event.h:60:2: error: unknown type name 'u_short'
./build/config.log:/usr/include/sys/event.h:61:2: error: unknown type name 'u_int'
./build/config.log:/usr/include/sys/event.h:62:2: error: unknown type name 'intptr_t'

This is because event.h requires sys/types.h and sys/time.h The C program generated by wscript does not included that.

It looks as though a patch for this issue was offered here: http://groups.google.com/group/nodejs-dev/browse_thread/thread/3aaf7fe2ca390fdc

. . . but the wscript portion was not applied. I just built from FreeBSD ports with the following portion of the first patch from that discussion, and that appears to have done the trick.

--- deps/libev/wscript.orig
+++ deps/libev/wscript
@@ -27,12 +23,17 @@ def configure(conf):
   if conf.check_cc(header_name="poll.h"):
     conf.check_cc(header_name="poll.h", function_name="poll")

-  conf.check_cc(header_name="sys/event.h")
-  conf.check_cc(header_name="sys/queue.h")
-  if PLATFORM_IS_DARWIN:
-    conf.check_cc(header_name="sys/event.h", function_name="kqueue")
-  else:
-    conf.check_cc(header_name="sys/queue.h", function_name="kqueue")
+  kqueue_headers = []
+  # On FreeBSD event.h is not selfcontained and requires types.h
+  event_headers = ["sys/types.h", "sys/event.h"]
+  if conf.check_cc(header_name=event_headers, define_name="HAVE_SYS_EVENT_H"):
+    kqueue_headers += event_headers
+
+  if conf.check_cc(header_name="sys/queue.h"):
+    kqueue_headers.append("sys/queue.h")
+
+  if kqueue_headers:
+    conf.check_cc(header_name=kqueue_headers, function_name="kqueue")

pquerna commented Jul 4, 2011

Pull request merged, thanks!

@pquerna pquerna closed this Jul 4, 2011

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.