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

field ‘timestamp’ has incomplete type error during build. #30

Open
RichAyotte opened this issue Feb 4, 2017 · 11 comments
Open

field ‘timestamp’ has incomplete type error during build. #30

RichAyotte opened this issue Feb 4, 2017 · 11 comments

Comments

@RichAyotte
Copy link

I get the following error during installation.

$ npm install

> v4l2camera@1.0.4 install /home/rich/Projects/tmp/v4l2camera
> node-gyp rebuild

make: Entering directory '/home/rich/Projects/tmp/v4l2camera/build'
  CXX(target) Release/obj.target/v4l2camera/v4l2camera.o
  CC(target) Release/obj.target/v4l2camera/capture.o
In file included from ../capture.h:7:0,
                 from ../capture.c:1:
/usr/include/linux/videodev2.h:2127:20: error: field ‘timestamp’ has incomplete type
  struct timespec   timestamp;
                    ^~~~~~~~~
v4l2camera.target.mk:112: recipe for target 'Release/obj.target/v4l2camera/capture.o' failed
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ../node_modules/nan/nan_callbacks.h:83:0,
                 from ../node_modules/nan/nan.h:146,
                 from ../v4l2camera.cc:3:
../node_modules/nan/nan_callbacks_12_inl.h: In instantiation of ‘v8::Local<v8::Function> Nan::FunctionCallbackInfo<T>::Callee() const [with T = v8::Value]’:
../v4l2camera.cc:255:48:   required from here
../node_modules/nan/nan_callbacks_12_inl.h:108:71: warning: ‘v8::Local<v8::Function> v8::FunctionCallbackInfo<T>::Callee() const [with T = v8::Value]’ is deprecated: Use Data() to explicitly pass Callee instead [-Wdeprecated-declarations]
   inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
                                                                       ^
In file included from /home/rich/.node-gyp/7.5.0/include/node/node.h:42:0,
                 from ../node_modules/nan/nan.h:47,
                 from ../v4l2camera.cc:3:
/home/rich/.node-gyp/7.5.0/include/node/v8.h:8119:17: note: declared here
 Local<Function> FunctionCallbackInfo<T>::Callee() const {
                 ^~~~~~~~~~~~~~~~~~~~~~~

I was able to fix it by adding #include <time.h> to the top of capture.h

#ifndef CAMERA_H
#define CAMERA_H

#include <time.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <linux/videodev2.h>
#ifndef __V4L2_COMMON__
#  define CAMERA_OLD_VIDEODEV2_H
#endif
@troywweber7
Copy link

@RichAyotte it doesn't seem your like change has been pulled in yet. Can you recommend which of the forks one ought to use? Or is progress on this npm module at a standstill?

@troywweber7
Copy link

For the sake of completeness, here are my errors:

$ npm i v4l2camera

> v4l2camera@1.0.4 install /home/troyw/code-local/experiments/v4l2camera/node_modules/v4l2camera
> node-gyp rebuild

make: Entering directory '/home/troyw/code-local/experiments/v4l2camera/node_modules/v4l2camera/build'
  CC(target) Release/obj.target/v4l2camera/capture.o
In file included from ../capture.h:7:0,
                 from ../capture.c:1:
/usr/include/linux/videodev2.h:2190:20: error: field ‘timestamp’ has incomplete type
  struct timespec   timestamp;
                    ^~~~~~~~~
v4l2camera.target.mk:112: recipe for target 'Release/obj.target/v4l2camera/capture.o' failed
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: Leaving directory '/home/troyw/code-local/experiments/v4l2camera/node_modules/v4l2camera/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/troyw/.nvm/versions/node/v7.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.10.0-24-generic
gyp ERR! command "/home/troyw/.nvm/versions/node/v7.10.0/bin/node" "/home/troyw/.nvm/versions/node/v7.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/troyw/code-local/experiments/v4l2camera/node_modules/v4l2camera
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/home/troyw/code-local/experiments/v4l2camera/package.json'
npm WARN v4l2camera No description
npm WARN v4l2camera No repository field.
npm WARN v4l2camera No README data
npm WARN v4l2camera No license field.
npm ERR! Linux 4.10.0-24-generic
npm ERR! argv "/home/troyw/.nvm/versions/node/v7.10.0/bin/node" "/home/troyw/.nvm/versions/node/v7.10.0/bin/npm" "i" "v4l2camera"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! v4l2camera@1.0.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the v4l2camera@1.0.4 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the v4l2camera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs v4l2camera
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls v4l2camera
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/troyw/.npm/_logs/2017-06-26T20_54_17_262Z-debug.log

@RichAyotte
Copy link
Author

I reported the issue but didn't submit a PR. The fix is simple though, just add #include <time.h> to the top of capture.h.

@bellbind
Copy link
Owner

bellbind commented Jul 28, 2017

It seems distribution dependent problems around linux-headers.

Ubuntu-17.04's videodev2.h includes <sys/time.h> not libc's <time.h> above.
The videodev2.h also uses struct timeval not in the libc <time.h>.

If the fix required, #include <sys/time.h> would be valid.


Or <linux/time.h> would be better if:

#include <stdio.h>
#include <sys/time.h>

int main() {
  printf("timespec: %zu\n", sizeof (struct timespec));
  printf("timeval: %zu\n", sizeof (struct timeval));
  return 0;
}

and

#include <stdio.h>
#include <linux/time.h>

int main() {
  printf("timespec: %zu\n", sizeof (struct timespec));
  printf("timeval: %zu\n", sizeof (struct timeval));
  return 0;
}

would be different in some platforms.

@MiguelGonzalezAravena
Copy link

MiguelGonzalezAravena commented Oct 11, 2017

I have this error when try to install with npm i --save v4l2camera. How i can install this?

meganetaaan added a commit to meganetaaan/node-v4l2camera that referenced this issue Oct 28, 2017
meganetaaan added a commit to meganetaaan/node-v4l2camera that referenced this issue Oct 28, 2017
@baragona
Copy link

I agree with meganetaaan's fix above, it worked for me.

@DanielWeigl
Copy link

DanielWeigl commented Jan 29, 2018

The fix got applied in e0bff49 and reverted in the very next commit
c2bb744 - I still get the same error

@pyn1
Copy link

pyn1 commented Feb 23, 2018

Has anyone found the fix. I'm also facing the same issue.

joepie91 added a commit to joepie91/node-v4l2camera that referenced this issue Feb 25, 2018
@RichAyotte
Copy link
Author

@bellbind Are you waiting for a PR or trying to decide on implementation?

@TomMettam
Copy link

Is this gunna get fixed?

@Satyam-code143
Copy link

Satyam-code143 commented Sep 14, 2020

It's Not merged, already requests have been sent. Plz merge or tell me some alternative PLZZZ

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

9 participants