thecodemaiden / tinydtls-coap

An attempt to integrate the libcoap (http://libcoap.sourceforge.net/) and tinydtls (http://tinydtls.sourceforge.net/) client-server examples.
GNU Lesser General Public License v3.0
17 stars 11 forks source link

built as submodule but showing error #2

Open anupam19 opened 8 years ago

anupam19 commented 8 years ago

Hi, I had copied contents of libcoap-fork to coap directory of tinydtls-coap and copied tinydtls-form folder contents to dtls folder. Now built them and finally did make for tinydtls-coap. But there are many errors I am seeing here.

nforcen commented 8 years ago

Hi, I think I have the same problem that anupam19, I have compiled well both CoAP and TinyDTLS separately. Examples in each folder work correctly. The problem is when I try to compile the main project. I receive many errors, could you say me what they are due to? These are the errors I receive: root@broker-VirtualBox:~/Escritorio/coap_DTLS/tinydtls-coap-master# make cc -c -Wall -g -O0 -o coaps-client.o coaps-client.c -DDTLSv12 -DWITH_SHA256 -DWITH_POSIX In file included from /usr/include/syslog.h:1:0, from coap/debug.h:23, from coap/coap.h:17, from coaps-client.c:43: dtls/debug.h:32:16: error: expected identifier before numeric constant typedef enum { LOG_EMERG=0, LOG_ALERT, LOG_CRIT, LOG_WARN, ^ In file included from coaps-client.c:46:0: dtls/debug.h:49:0: warning: "info" redefined [enabled by default]

define info(...) dsrv_log(LOG_INFO, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:53:0: note: this is the location of the previous definition

define info(...) coap_log(LOG_INFO, VA_ARGS)

^ In file included from coaps-client.c:46:0: dtls/debug.h:50:0: warning: "warn" redefined [enabled by default]

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:54:0: note: this is the location of the previous definition

define warn(...) coap_log(LOG_WARNING, VA_ARGS)

^ In file included from coaps-client.c:46:0: dtls/debug.h:51:0: warning: "debug" redefined [enabled by default]

define debug(...) dsrv_log(LOG_DEBUG, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:55:0: note: this is the location of the previous definition

define debug(...) coap_log(LOG_DEBUG, VA_ARGS)

^ coaps-client.c: In function ‘read_from_peer’: coaps-client.c:142:4: warning: pointer targets in passing argument 1 of ‘coap_read_from_buf’ differ in signedness [-Wpointer-sign] return coap_read_from_buf(data, len, coapctx, &srcAddr); ^ In file included from coap/coap.h:22:0, from coaps-client.c:43: coap/net.h:351:5: note: expected ‘char ’ but argument is of type ‘uint8 ’ int coap_read_from_buf(char buf, ssize_t bytes_read, coap_context_t context, coap_address_t src); ^ In file included from coaps-client.c:46:0: coaps-client.c: In function ‘cmdline_content_type’: dtls/debug.h:50:28: error: ‘LOG_WARN’ undeclared (first use in this function)

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

                        ^

coaps-client.c:754:2: note: in expansion of macro ‘warn’ warn("W: unknown content-type '%s'\n",arg); ^ dtls/debug.h:50:28: note: each undeclared identifier is reported only once for each function it appears in

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

                        ^

coaps-client.c:754:2: note: in expansion of macro ‘warn’ warn("W: unknown content-type '%s'\n",arg); ^ coaps-client.c: In function ‘main’: coaps-client.c:1072:21: error: ‘LOG_WARN’ undeclared (first use in this function) log_t log_level = LOG_WARN; ^ coaps-client.c:1079:18: warning: variable ‘tv’ set but not used [-Wunused-but-set-variable] struct timeval tv, timeout; ^ coaps-client.c: At top level: coaps-client.c:71:23: warning: ‘proxy_port’ defined but not used [-Wunused-variable] static unsigned short proxy_port = COAP_DEFAULTPORT; ^ make: ** [coaps-client.o] Error 1 I receive many compilation errors. Could you help me with this?

The error which appear are: root@broker-VirtualBox:~/Escritorio/coap_DTLS/tinydtls-coap-master# make cc -c -Wall -g -O0 -o coaps-client.o coaps-client.c -DDTLSv12 -DWITH_SHA256 -DWITH_POSIX In file included from /usr/include/syslog.h:1:0, from coap/debug.h:23, from coap/coap.h:17, from coaps-client.c:43: dtls/debug.h:32:16: error: expected identifier before numeric constant typedef enum { LOG_EMERG=0, LOG_ALERT, LOG_CRIT, LOG_WARN, ^ In file included from coaps-client.c:46:0: dtls/debug.h:49:0: warning: "info" redefined [enabled by default]

define info(...) dsrv_log(LOG_INFO, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:53:0: note: this is the location of the previous definition

define info(...) coap_log(LOG_INFO, VA_ARGS)

^ In file included from coaps-client.c:46:0: dtls/debug.h:50:0: warning: "warn" redefined [enabled by default]

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:54:0: note: this is the location of the previous definition

define warn(...) coap_log(LOG_WARNING, VA_ARGS)

^ In file included from coaps-client.c:46:0: dtls/debug.h:51:0: warning: "debug" redefined [enabled by default]

define debug(...) dsrv_log(LOG_DEBUG, VA_ARGS)

^ In file included from coap/coap.h:17:0, from coaps-client.c:43: coap/debug.h:55:0: note: this is the location of the previous definition

define debug(...) coap_log(LOG_DEBUG, VA_ARGS)

^ coaps-client.c: In function ‘read_from_peer’: coaps-client.c:142:4: warning: pointer targets in passing argument 1 of ‘coap_read_from_buf’ differ in signedness [-Wpointer-sign] return coap_read_from_buf(data, len, coapctx, &srcAddr); ^ In file included from coap/coap.h:22:0, from coaps-client.c:43: coap/net.h:351:5: note: expected ‘char ’ but argument is of type ‘uint8 ’ int coap_read_from_buf(char buf, ssize_t bytes_read, coap_context_t context, coap_address_t src); ^ In file included from coaps-client.c:46:0: coaps-client.c: In function ‘cmdline_content_type’: dtls/debug.h:50:28: error: ‘LOG_WARN’ undeclared (first use in this function)

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

                        ^

coaps-client.c:754:2: note: in expansion of macro ‘warn’ warn("W: unknown content-type '%s'\n",arg); ^ dtls/debug.h:50:28: note: each undeclared identifier is reported only once for each function it appears in

define warn(...) dsrv_log(LOG_WARN, VA_ARGS)

                        ^

coaps-client.c:754:2: note: in expansion of macro ‘warn’ warn("W: unknown content-type '%s'\n",arg); ^ coaps-client.c: In function ‘main’: coaps-client.c:1072:21: error: ‘LOG_WARN’ undeclared (first use in this function) log_t log_level = LOG_WARN; ^ coaps-client.c:1079:18: warning: variable ‘tv’ set but not used [-Wunused-but-set-variable] struct timeval tv, timeout; ^ coaps-client.c: At top level: coaps-client.c:71:23: warning: ‘proxy_port’ defined but not used [-Wunused-variable] static unsigned short proxy_port = COAP_DEFAULTPORT; ^ make: ** [coaps-client.o] Error 1

ashubhatt commented 8 years ago

Found any solution?

anupam19 commented 8 years ago

Nope

On 08-Sep-2016 12:01 PM, "ashubhatt" notifications@github.com wrote:

Found any solution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thecodemaiden/tinydtls-coap/issues/2#issuecomment-245506164, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9rtyw-B-XaAYA3Ss2vWIPKfL3JBXwKks5qn6ujgaJpZM4HY0Ci .

thecodemaiden commented 8 years ago

Thanks for posting the error messages.

It looks like the debug functions/enums in coap and dtls are colliding. I pushed up changes to the submodules and to coaps-client that should fix it. Can you update your code and try again?