[FieldTrip] Request for help in debugging real-time buffer compilation error

Suhas G suhasg10495 at gmail.com
Tue Jan 3 13:02:13 CET 2017


Hi,

We are using 128 channel Biosemi Active Two device. We are working on a BCI
project, where we want to acquire data in real-time from Biosemi.

We are trying to incorporate fieldtrip real time buffer for our real time
data acquisition. For the implementation we are following the steps
provided on the fieldtrip website. We are getting certain errors during
this implementation for which we request your guidance.
Windows:

We are using Windows 7, 64 bit system.
Installed Softwares:
Microsoft Visual C++ 2005, 2008, 2010, 2012 and 2013
Microsoft Windows SDK 7.1
MinGW compiler and MSYS
Cygwin

1. The matlab inside part of buffer compilation, i.e creation of mex file
on matlab using 'compile' in src/buffer/matlab directory, gave the
following error.
We tried it using Visual Studio and minGW compilers.

*>> mex -setup *
*MEX configured to use 'Microsoft Windows SDK 7.1 (C)' for C language
compilation.*
*Warning: The MATLAB C and Fortran API has changed to support MATLAB*
*  variables with more than 2^32-1 elements. In the near future*
*  you will be required to update your code to utilize the*
*  new API. You can find more information about this at:*
*
 http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
<http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html>.*

*To choose a different language, select one from the following:*
* mex -setup C++ *
* mex -setup FORTRAN*

*>> compile('vc')*
*Compiling library functions in util.c ...*
*Building with 'Microsoft Windows SDK 7.1 (C)'.*
*Error using mex*
*util.c*
*C:\Program*
*Files\MATLAB\R2016a\toolbox\fieldtrip-20170102\fieldtrip-20170102\realtime\src\buffer\src\util.c(13)
: fatal*
*error C1083: Cannot open include file: 'sys/time.h': No such file or
directory*

*Error in compile (line 156)*
*  eval(cmd);*


*>> compile('mingw','C:/MinGW/lib')*
*Compiling library functions in util.c ...*
*Building with 'Microsoft Windows SDK 7.1 (C)'.*
*Error using mex*
*util.c*
*C:\Program*
*Files\MATLAB\R2016a\toolbox\fieldtrip-20170102\fieldtrip-20170102\realtime\src\buffer\src\util.c(13)
: fatal*
*error C1083: Cannot open include file: 'sys/time.h': No such file or
directory*

*Error in compile (line 156)*
*  eval(cmd);*


2. The matlab outside part compilation of buffer in src/buffer/src
directory was attempted using make in cygwin terminal. We got the following
error:

EEG-EGI at EEG-EGI-PC /cygdrive/c/Program
Files/MATLAB/R2016a/toolbox/fieldtrip-201
70102/fieldtrip-20170102/realtime/src/buffer/src
$ make
gcc -I. -Wunused -Wall -pedantic -O0 -fPIC -g   -c -o tcpserver.o
tcpserver.c
tcpserver.c:1:0: warning: -fPIC ignored for target (all code is position
indepen                     dent)
 /*
 ^
tcpserver.c: In function ‘cleanup_tcpserver’:
tcpserver.c:31:5: warning: implicit declaration of function ‘closesocket’
[-Wimp                     licit-function-declaration]
     closesocket(threadlocal->fd);
     ^
tcpserver.c: In function ‘tcpserver’:
tcpserver.c:51:22: error: storage size of ‘sa’ isn’t known
   struct sockaddr_in sa;
                      ^
tcpserver.c:102:12: warning: implicit declaration of function ‘socket’
[-Wimplic                     it-function-declaration]
   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
            ^
tcpserver.c:102:19: error: ‘PF_INET’ undeclared (first use in this function)
   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
                   ^
tcpserver.c:102:19: note: each undeclared identifier is reported only once
for e                     ach function it appears in
tcpserver.c:102:28: error: ‘SOCK_STREAM’ undeclared (first use in this
function)
   if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
                            ^
tcpserver.c:136:7: warning: implicit declaration of function ‘setsockopt’
[-Wimp                     licit-function-declaration]
   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval,
sizeof(optv                     al)) < 0) {
       ^
tcpserver.c:136:21: error: ‘SOL_SOCKET’ undeclared (first use in this
function)
   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval,
sizeof(optv                     al)) < 0) {
                     ^
tcpserver.c:136:33: error: ‘SO_REUSEADDR’ undeclared (first use in this
function                     )
   if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval,
sizeof(optv                     al)) < 0) {
                                 ^
tcpserver.c:142:19: error: ‘AF_INET’ undeclared (first use in this function)
   sa.sin_family = AF_INET;
                   ^
tcpserver.c:143:19: warning: implicit declaration of function ‘htons’
[-Wimplici                     t-function-declaration]
   sa.sin_port   = htons(host->port);
                   ^
tcpserver.c:145:7: error: ‘INADDR_ANY’ undeclared (first use in this
function)
   if (INADDR_ANY)
       ^
tcpserver.c:146:26: warning: implicit declaration of function ‘htonl’
[-Wimplici                     t-function-declaration]
     sa.sin_addr.s_addr = htonl(INADDR_ANY);
                          ^
tcpserver.c:148:7: warning: implicit declaration of function ‘bind’
[-Wimplicit-                     function-declaration]
   if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0) {
       ^
tcpserver.c:153:7: warning: implicit declaration of function ‘listen’
[-Wimplici                     t-function-declaration]
   if (listen(s, BACKLOG)<0) {
       ^
tcpserver.c:168:9: warning: implicit declaration of function ‘accept’
[-Wimplici                     t-function-declaration]
     c = accept(s, (struct sockaddr *)&sa, &b);
         ^
tcpserver.c:186:9: warning: implicit declaration of function ‘usleep’
[-Wimplici                     t-function-declaration]
         usleep(ACCEPTSLEEP);
         ^
tcpserver.c:202:23: error: storage size of ‘lg’ isn’t known
         struct linger lg;
                       ^
tcpserver.c:207:35: error: ‘SO_LINGER’ undeclared (first use in this
function)
         setsockopt(s, SOL_SOCKET, SO_LINGER, (char *) &lg, sizeof(lg));
                                   ^
tcpserver.c:202:23: warning: unused variable ‘lg’ [-Wunused-variable]
         struct linger lg;
                       ^
tcpserver.c:213:37: error: ‘SO_RCVBUF’ undeclared (first use in this
function)
       if (setsockopt(c, SOL_SOCKET, SO_RCVBUF, (const char*)&optval,
sizeof(opt                     val)) < 0) {
                                     ^
tcpserver.c:220:37: error: ‘SO_SNDBUF’ undeclared (first use in this
function)
       if (setsockopt(c, SOL_SOCKET, SO_SNDBUF, (const char*)&optval,
sizeof(opt                     val)) < 0) {
                                     ^
tcpserver.c:249:50: warning: cast to pointer from integer of different size
[-Wi                     nt-to-pointer-cast]
       rc = pthread_create(&tid, NULL, tcpsocket, (void *)c);
                                                  ^
tcpserver.c:267:10: warning: zero-length gnu_printf format string
[-Wformat-zero                     -length]
   printf("");
          ^
tcpserver.c:267:10: warning: zero-length gnu_printf format string
[-Wformat-zero                     -length]
tcpserver.c:56:23: warning: unused variable ‘oldcanceltype’
[-Wunused-variable]
   int oldcancelstate, oldcanceltype;
                       ^
tcpserver.c:56:7: warning: unused variable ‘oldcancelstate’
[-Wunused-variable]
   int oldcancelstate, oldcanceltype;
       ^
tcpserver.c:51:22: warning: unused variable ‘sa’ [-Wunused-variable]
   struct sockaddr_in sa;
                      ^
make: *** [<builtin>: tcpserver.o] Error 1

Please help us debug the same.

Thank you.
Suhas G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170103/9af653e7/attachment.html>


More information about the fieldtrip mailing list