Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Fixed compile with libwebscokets error

Hi,

When I compile mosquitto on Ubuntu 12.04 x86 ( git version),  the following error occurred. 

>>>>>>>>>>>>>>>>>>>>>>

make[1]: Leaving directory `/home/topeet/work/org.eclipse.mosquitto/client'

make[1]: Entering directory `/home/topeet/work/org.eclipse.mosquitto/src'

cc -Wall -ggdb -O2  -I. -I.. -I../lib  -DVERSION="\"1.4.3\"" -DTIMESTAMP="\"2015-09-10 13:35:33+0800\"" -DWITH_BROKER -DWITH_TLS -DWITH_TLS_PSK -DWITH_UUID -DWITH_BRIDGE -DWITH_PERSISTENCE -DWITH_MEMORY_TRACKING -DWITH_SYS_TREE -DWITH_WEBSOCKETS -DWITH_EC -c mosquitto.c -o mosquitto.o

mosquitto.c: In function ‘main’:

mosquitto.c:275: error: expected _expression_ before ‘,’ token

mosquitto.c:290: error: expected _expression_ before ‘)’ token

mosquitto.c:368: error: expected _expression_ before ‘)’ token

<<<<<<<<<<<<<<<<<<<<<<<<


so, I google it, but nothing. I analyzed the reasons, maybe the reasons is macro "VERSION" value is empty. So, I change macro "VERSION" name to "MVERSION", is work.

>>> patch: 

diff --git a/client/pub_client.c b/client/pub_client.c
index b29dd60..e9d6b22 100644
--- a/client/pub_client.c
+++ b/client/pub_client.c
@@ -204,7 +204,7 @@ void print_usage(void)
 
  mosquitto_lib_version(&major, &minor, &revision);
  printf("mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.\n");
- printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision);
+ printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n\n", MVERSION, major, minor, revision);
  printf("Usage: mosquitto_pub [-h host] [-k keepalive] [-p port] [-q qos] [-r] {-f file | -l | -n | -m message} -t topic\n");
 #ifdef WITH_SRV
  printf("                     [-A bind_address] [-S]\n");
diff --git a/client/sub_client.c b/client/sub_client.c
index 3c6c225..42c8392 100644
--- a/client/sub_client.c
+++ b/client/sub_client.c
@@ -128,7 +128,7 @@ void print_usage(void)
 
  mosquitto_lib_version(&major, &minor, &revision);
  printf("mosquitto_sub is a simple mqtt client that will subscribe to a single topic and print all messages it receives.\n");
- printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision);
+ printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n\n", MVERSION, major, minor, revision);
  printf("Usage: mosquitto_sub [-c] [-h host] [-k keepalive] [-p port] [-q qos] [-R] -t topic ...\n");
  printf("                     [-C msg_count] [-T filter_out]\n");
 #ifdef WITH_SRV
diff --git a/config.mk b/config.mk
index 2d377e1..9594493 100644
--- a/config.mk
+++ b/config.mk
@@ -58,14 +58,14 @@ WITH_MEMORY_TRACKING:=yes
 WITH_SYS_TREE:=yes
 
 # Build with SRV lookup support.
-WITH_SRV:=yes
+WITH_SRV:=no
 
 # Build using libuuid for clientid generation (Linux only - please report if
 # supported on your platform).
 WITH_UUID:=yes
 
 # Build with websockets support on the broker.
-WITH_WEBSOCKETS:=no
+WITH_WEBSOCKETS:=yes
 
 # Use elliptic keys in broker
 WITH_EC:=yes
@@ -83,7 +83,7 @@ WITH_SOCKS:=yes
 
 # Also bump lib/mosquitto.h, CMakeLists.txt,
 # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi
-VERSION=1.4.3
+MVERSION=1.4.3
 TIMESTAMP:=$(shell date "+%F %T%z")
 
 # Client library SO version. Bump if incompatible API/ABI changes are made.
@@ -112,8 +112,8 @@ LIB_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I. -I.. -I../lib
 LIB_CXXFLAGS:=$(LIB_CFLAGS) ${CPPFLAGS}
 LIB_LDFLAGS:=${LDFLAGS}
 
-BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DTIMESTAMP="\"${TIMESTAMP}\"" -DWITH_BROKER
-CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I../lib -DVERSION="\"${VERSION}\""
+BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DMVERSION="\"${MVERSION}\"" -DTIMESTAMP="\"${TIMESTAMP}\"" -DWITH_BROKER
+CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I../lib -DMVERSION="\"${MVERSION}\""
 
 ifneq ($(or $(find $(UNAME),FreeBSD), $(find $(UNAME),OpenBSD)),)
  BROKER_LIBS:=-lm
diff --git a/src/conf.c b/src/conf.c
index 6edd705..6085c63 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -307,7 +307,7 @@ void mqtt3_config_cleanup(struct mqtt3_config *config)
 
 static void print_usage(void)
 {
- printf("mosquitto version %s (build date %s)\n\n", VERSION, TIMESTAMP);
+ printf("mosquitto version %s (build date %s)\n\n", MVERSION, TIMESTAMP);
  printf("mosquitto is an MQTT v3.1 broker.\n\n");
  printf("Usage: mosquitto [-c config_file] [-d] [-h] [-p port]\n\n");
  printf(" -c : specify the broker config file.\n");
diff --git a/src/mosquitto.c b/src/mosquitto.c
index eaf4395..3956a69 100644
--- a/src/mosquitto.c
+++ b/src/mosquitto.c
@@ -272,7 +272,7 @@ int main(int argc, char *argv[])
  /* Initialise logging only after initialising the database in case we're
  * logging to topics */
  mqtt3_log_init(&config);
- _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s (build date %s) starting", VERSION, TIMESTAMP);
+ _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s (build date %s) starting", MVERSION, TIMESTAMP);
  if(config.config_file){
  _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "Config loaded from %s.", config.config_file);
  }else{
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
 #ifdef WITH_SYS_TREE
  if(config.sys_interval > 0){
  /* Set static $SYS messages */
- snprintf(buf, 1024, "mosquitto version %s", VERSION);
+ snprintf(buf, 1024, "mosquitto version %s", MVERSION);
  mqtt3_db_messages_easy_queue(&int_db, NULL, "$SYS/broker/version", 2, strlen(buf), buf, 1);
  snprintf(buf, 1024, "%s", TIMESTAMP);
  mqtt3_db_messages_easy_queue(&int_db, NULL, "$SYS/broker/timestamp", 2, strlen(buf), buf, 1);
@@ -365,7 +365,7 @@ int main(int argc, char *argv[])
  run = 1;
  rc = mosquitto_main_loop(&int_db, listensock, listensock_count, listener_max);
 
- _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s terminating", VERSION);
+ _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s terminating", MVERSION);
  mqtt3_log_close(&config);
 
 #ifdef WITH_PERSISTENCE

Attachment: patch_compile_version_error.patch
Description: Binary data


Back to the top