Skip to content

Commit a52c046

Browse files
committed
feat(mosq): Add support for linux build
1 parent 25d54ef commit a52c046

File tree

7 files changed

+19
-5
lines changed

7 files changed

+19
-5
lines changed

components/mosquitto/examples/broker/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,14 @@
33
cmake_minimum_required(VERSION 3.16)
44

55
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
if("${IDF_TARGET}" STREQUAL "linux")
8+
list(APPEND EXTRA_COMPONENT_DIRS
9+
"../../../../common_components/linux_compat")
10+
# "$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs")
11+
12+
endif()
13+
14+
idf_build_set_property(MINIMAL_BUILD ON)
15+
616
project(broker)

components/mosquitto/examples/broker/main/example_broker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ static void mqtt_app_start(struct mosq_broker_config *config)
132132
}
133133
#endif // CONFIG_EXAMPLE_BROKER_RUN_LOCAL_MQTT_CLIENT
134134

135-
void app_main(void)
135+
// void app_main(void)
136+
int main(int argc, char *argv[])
136137
{
137138
ESP_ERROR_CHECK(nvs_flash_init());
138139
ESP_ERROR_CHECK(esp_netif_init());

components/mosquitto/port/broker.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "mosquitto_broker_internal.h"
1010
#include "memory_mosq.h"
1111
#include "mosq_broker.h"
12+
#include <time.h>
13+
#include <sys/time.h>
1214

1315
static struct mosquitto__listener_sock *listensock = NULL;
1416
static int listensock_count = 0;

components/mosquitto/port/config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "utlist.h"
1515
#include "lib_load.h"
1616
#include "syslog.h"
17+
#include <limits.h>
1718
#include "sdkconfig.h"
1819

1920

components/mosquitto/port/mosq_time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <time.h>
1010
#include "time_mosq.h"
11-
11+
#include "esp_err.h"
1212
#include "esp_timer.h"
1313

1414
void mosquitto_time_init(void)

components/mosquitto/port/priv_include/config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <ctype.h>
1818
#include "net/if.h"
1919

20-
#undef isspace
21-
#define isspace(__c) (__ctype_lookup((int)__c)&_S)
20+
// #undef isspace
21+
// #define isspace(__c) (__ctype_lookup((int)__c)&_S)
2222

2323
#define VERSION "v2.0.20~5"

components/mosquitto/port/priv_include/sys/syslog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030

3131
#define syslog(sev, format, ... ) ESP_LOG_LEVEL_LOCAL(sev-2, "mosquitto", format, ##__VA_ARGS__)
3232

33-
#define gai_strerror(x) "gai_strerror() not supported"
33+
// #define gai_strerror(x) "gai_strerror() not supported"
3434
#define openlog(a, b, c)
3535
#define closelog()

0 commit comments

Comments
 (0)