Skip to content

Commit 0aa3870

Browse files
Merge pull request #37 from tarantool/fix-build-static-mqtt-on-centos
Fix build static mqtt on centos
2 parents b2cf2c2 + 29e8eb3 commit 0aa3870

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mqtt/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libra
77

88
if( STATIC_BUILD )
99
set(WITH_STATIC_LIBRARIES ON)
10+
set(WITH_PIC ON)
1011
set(OPENSSL_USE_STATIC_LIBS ON)
1112
endif()
1213

@@ -18,7 +19,7 @@ endif()
1819
add_library(driver SHARED driver.c)
1920

2021
if( DEFINED STATIC_BUILD )
21-
unset(CMAKE_C_FLAGS)
22+
set(CMAKE_C_FLAGS "-ldl -lpthread")
2223
add_subdirectory(../third_party/mosquitto ../third_party/mosquitto/build)
2324
include_directories(../third_party/mosquitto/lib)
2425
if( STATIC_BUILD )

mqtt/driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ mosq_subscribe_f(struct mosquitto *mosq __attribute__((unused)),
547547
return;
548548
lua_rawgeti(ctx->L, LUA_REGISTRYINDEX, ctx->subscribe_ref);
549549
lua_pushinteger(ctx->L, mid);
550-
for (int i = 0; i < qos_count; i++)
550+
int i = 0;
551+
for (i = 0; i < qos_count; i++)
551552
lua_pushinteger(ctx->L, granted_qos[i]);
552553
if (lua_pcall(ctx->L, qos_count + 1, 0, 0) != LUA_OK)
553554
say_error("Subscribe callback failed: ref:%d, message: \"%s\"",

0 commit comments

Comments
 (0)