Search code examples
node.jsjsdomcontextify

Building contextify fails with error: field ‘time’ has incomplete type


Background: I'm using jquery to test JavaScript code (which is using jQuery objects) with nodeunit. For jquery I need jsdom to provide a window object. Building jsdom fails because it requires contextify, which does not build on 64-bit Debian. I tested it on Linux Mint, both standard Ubuntu and Debian edition, same result.

Problem: node.js is in both cases 0.11.11-release, and built from the git repository. When building, time, it_interval, and many more are incomplete. Why?

The full build log is here: http://pastebin.com/iTq75435 It starts with:

npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.6 install /tmp/node_modules/contextify
> node-gyp rebuild

make: Entering directory `/tmp/node_modules/contextify/build'
  CXX(target) Release/obj.target/contextify/src/contextify.o
In file included from /home/sie/.node-gyp/0.11.11/src/node.h:61:0,
                 from ../src/contextify.cc:1:
/home/sie/.node-gyp/0.11.11/deps/v8/include/v8.h: In member function ‘void v8::ReturnValue<T>::Set(uint32_t)’:
/home/sie/.node-gyp/0.11.11/deps/v8/include/v8.h:5816:31: warning: typedef ‘I’ locally defined but not used [-Wunused-local-typedefs]
   typedef internal::Internals I;
                               ^
In file included from /usr/include/x86_64-linux-gnu/bits/time.h:86:0,
                 from /usr/include/time.h:41,
                 from /usr/include/pthread.h:24,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h:148,
                 from /usr/include/c++/4.8/ext/atomicity.h:35,
                 from /usr/include/c++/4.8/bits/basic_string.h:39,
                 from /usr/include/c++/4.8/string:52,
                 from ../src/contextify.cc:3:
/usr/include/x86_64-linux-gnu/bits/timex.h: At global scope:
/usr/include/x86_64-linux-gnu/bits/timex.h:36:18: error: field ‘time’ has incomplete type
   struct timeval time;  /* (read only) */
                  ^
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h:148,
                 from /usr/include/c++/4.8/ext/atomicity.h:35,
                 from /usr/include/c++/4.8/bits/basic_string.h:39,
                 from /usr/include/c++/4.8/string:52,
                 from ../src/contextify.cc:3:
/usr/include/time.h:163:21: error: field ‘it_interval’ has incomplete type
     struct timespec it_interval;
                     ^
/usr/include/time.h:164:21: error: field ‘it_value’ has incomplete type
     struct timespec it_value;
                     ^
/usr/include/time.h:189:8: error: ‘clock_t’ does not name a type
 extern clock_t clock (void) __THROW;
        ^
/usr/include/time.h:192:8: error: ‘time_t’ does not name a type
 extern time_t time (time_t *__timer) __THROW;
        ^
/usr/include/time.h:195:25: error: ‘time_t’ was not declared in this scope
 extern double difftime (time_t __time1, time_t __time0)

Solution

  • I already suggested this as a comment, but i'll post it as an answer here as well.

    Using unstable versions of software can be dangerous. Often, libraries are configured to work with the past and current versions, but not always future versions. Especially future versions that are constantly changing. 0.11 probably obsoletes or changes some 0.10 features that your library is expecting.