Arduino shield and Arduino DUE

Tried again on my windows PC using the windows subsystem for linux (which I’d installed a while ago but not had the chance to play with). Got the same error as the Macbook (SP_MODE_READ_WRITE undeclared). Maybe it’s a version thing…

You are missing the dependencies. Before build, install first libserialport and jansson.

I didn’t install them originally and it didn’t get this far, but all these issues are since the dependencies were installed :-/

The most meaningful error I can see at the moment is
[17/21] Compiling client/src/cc_client.c
…/lib/src/core.c: In function ‘serial_setup’:
…/lib/src/core.c:177:31: error: ‘SP_MODE_READ_WRITE’ undeclared (first use in this function)
ret = sp_open(handle->sp, SP_MODE_READ_WRITE);

Is that it trying to get to the libserialport library and not finding it?

Actually the first error I get when running sudo ./waf build -v is:

[18/21] Compiling client/src/sockcli.c
21:07:50 runner ['/usr/bin/gcc', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-fPIC', '-Ilib/src', '-I../lib/src', '-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"', '../client/src/cc_client.c', '-c', '-o/mnt/c/DEV/ArduinoFiles/cc-master-master/build/client/src/cc_client.c.4.o']
21:07:50 runner ['/usr/bin/gcc', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-fPIC', '-Ilib/src', '-I../lib/src', '-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"', '../client/src/sockcli.c', '-c', '-o/mnt/c/DEV/ArduinoFiles/cc-master-master/build/client/src/sockcli.c.4.o']
../client/src/base64.c:1:1: error: expected identifier or ‘(’ before ‘.’ token
 ../../server/src/base64.c
 ^

It seemed to be trying to point cc_base64.h and cc_base64.c in the client folder to the server versions but that failed to work. So I copied the content from the server’s cc_base64.h and base64.c into the client’s files and it then proceeded OK until I hit the SP_MODE_READ_WRITE error that I mentioned previously. Here’s the verbose output:

[17/21] Compiling client/src/cc_client.c
01:09:27 runner ['/usr/bin/gcc', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-Wall', '-Wextra', '-std=gnu99', '-O3', '-fPIC', '-Ilib/src', '-I../lib/src', '-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"', '../client/src/cc_client.c', '-c', '-o/mnt/c/DEV/ArduinoFiles/cc-master-master/build/client/src/cc_client.c.4.o']
../lib/src/core.c: In function ‘serial_setup’:
../lib/src/core.c:177:31: error: ‘SP_MODE_READ_WRITE’ undeclared (first use in this function)
     ret = sp_open(handle->sp, SP_MODE_READ_WRITE);
                               ^
../lib/src/core.c:177:31: note: each undeclared identifier is reported only once for each function it appears in
../lib/src/core.c:188:26: warning: implicit declaration of function ‘sp_get_port_usb_manufacturer’ [-Wimplicit-function-declaration]
     char *manufacturer = sp_get_port_usb_manufacturer(handle->sp);
                          ^
../lib/src/core.c:188:26: warning: initialization makes pointer from integer without a cast [-Wint-conversion]

In file included from ../client/src/cc_client.c:34:0:
../client/src/request.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
 ../../server/src/request.h
 ^
In file included from ../client/src/cc_client.c:35:0:
../client/src/sockcli.h:64:1: error: unknown type name ‘sockcli_t’
 sockcli_t* sockcli_init(const char *path);
 ^
../client/src/sockcli.h:65:21: error: unknown type name ‘sockcli_t’
 void sockcli_finish(sockcli_t *client);
                     ^
../client/src/sockcli.h:66:18: error: unknown type name ‘sockcli_t’
 int sockcli_read(sockcli_t *client, void *buffer, size_t size);
                  ^
../client/src/sockcli.h:67:19: error: unknown type name ‘sockcli_t’
 int sockcli_write(sockcli_t *client, const void *buffer, size_t size);
                   ^
../client/src/cc_client.c:63:5: error: unknown type name ‘sockcli_t’
     sockcli_t *socket;
     ^
../client/src/cc_client.c: In function ‘reader’:
../client/src/cc_client.c:94:17: warning: implicit declaration of function ‘sockcli_read’ [-Wimplicit-function-declaration]
         int n = sockcli_read(client->socket, buffer, READ_BUFFER_SIZE);
                 ^
../client/src/cc_client.c:121:39: error: ‘CC_DEV_STATUS_EVENT_FORMAT’ undeclared (first use in this function)
                     json_unpack(data, CC_DEV_STATUS_EVENT_FORMAT,
                                       ^
../client/src/cc_client.c:121:39: note: each undeclared identifier is reported only once for each function it appears in../client/src/cc_client.c:135:39: error: ‘CC_DATA_UPDATE_EVENT_FORMAT’ undeclared (first use in this function)
                     json_unpack(data, CC_DATA_UPDATE_EVENT_FORMAT,
                                       ^
../client/src/cc_client.c: In function ‘cc_client_request’:
../client/src/cc_client.c:178:15: warning: implicit declaration of function ‘sockcli_write’ [-Wimplicit-function-declaration]
     int ret = sockcli_write(client->socket, request_str, strlen(request_str) + 1);
               ^
../client/src/cc_client.c: In function ‘cc_client_delete’:
../client/src/cc_client.c:238:5: warning: implicit declaration of function ‘sockcli_finish’ [-Wimplicit-function-declaration]
     sockcli_finish(client->socket);
     ^
../client/src/cc_client.c: In function ‘cc_client_assignment’:
../client/src/cc_client.c:262:38: error: ‘CC_ASSIGNMENT_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_ASSIGNMENT_REQ_FORMAT,
                                      ^
../client/src/cc_client.c:282:27: error: ‘CC_ASSIGNMENT_REPLY_FORMAT’ undeclared (first use in this function)
         json_unpack(data, CC_ASSIGNMENT_REPLY_FORMAT, "assignment_id", &assignment_id);
                           ^
../client/src/cc_client.c: In function ‘cc_client_unassignment’:
../client/src/cc_client.c:298:38: error: ‘CC_UNASSIGNMENT_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_UNASSIGNMENT_REQ_FORMAT,
                                      ^
../client/src/cc_client.c: In function ‘cc_client_device_list’:
../client/src/cc_client.c:313:38: error: ‘CC_DEV_LIST_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_DEV_LIST_REQ_FORMAT);
                                      ^
../client/src/cc_client.c: In function ‘cc_client_device_descriptor’:
../client/src/cc_client.c:339:38: error: ‘CC_DEV_DESCRIPTOR_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_DEV_DESCRIPTOR_REQ_FORMAT,
                                      ^
../client/src/cc_client.c: In function ‘cc_client_device_disable’:
../client/src/cc_client.c:357:38: error: ‘CC_DEV_CONTROL_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_DEV_CONTROL_REQ_FORMAT, "device_id", device_id,
                                      ^
../client/src/cc_client.c: In function ‘cc_client_device_status_cb’:
../client/src/cc_client.c:374:38: error: ‘CC_DEV_STATUS_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_DEV_STATUS_REQ_FORMAT, "enable", enable);
                                      ^
../client/src/cc_client.c: In function ‘cc_client_data_update_cb’:
../client/src/cc_client.c:390:38: error: ‘CC_DATA_UPDATE_REQ_FORMAT’ undeclared (first use in this function)
     json_t *request_data = json_pack(CC_DATA_UPDATE_REQ_FORMAT, "enable", enable);

Feel a bit out of my depth with this stuff but one final question:

Should a Mega 2560 R3 be a drop in replacement for the UNO? I was naively assuming that it would be, but I find that that doesn’t work either.

Is there anything I should’ve changed to get that working?

Thanks

Ian