I am trying to integrate MQTT stack of AWS IoT Device SDK into my mangOH red board.
I downloaded latest SDK here:
and manage to make it work on local PC (Ubuntu 18.04 ) i.e. it can do mutual TLS authentication and simple MQTT publish to AWS IoT core cloud.
However when I tried to port over to mangOH platform, I made some progress but was stuck at compilation error which seemed from openssl library integration, it could not find function which was defined in this inclusion:
#include <openssl/ssl.h>
This mean, this library was recognized locally by my local PC OS but not by legato (release 16 ver 19.11.2). This is the snippet of compilation error:
<project_base>/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c:247:17: error: implicit declaration of function ‘SSL_set1_host’; did you mean ‘SSL_set_trust’? [-Werror=implicit-function-declaration]
sslStatus = SSL_set1_host( pOpensslParams->pSsl, pServerInfo->pHostName );
^~~~~~~~~~~~~
SSL_set_trust
<project_base>/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c: In function ‘setOptionalConfigurations’:
/home/iotlab0035x1804/repo/gatewayx/src/gateway/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c:533:13: error: implicit declaration of function ‘SSL_set_default_read_buffer_len’; did you mean ‘SSL_CTX_set_default_read_ahead’? [-Werror=implicit-function-declaration]
SSL_set_default_read_buffer_len( pSsl, ( size_t ) readBufferLength );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SSL_CTX_set_default_read_ahead
<project_base>/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c: In function ‘Openssl_Connect’:
<project_base>/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c:625:36: error: implicit declaration of function ‘TLS_client_method’; did you mean ‘DTLS_client_method’? [-Werror=implicit-function-declaration]
pSslContext = SSL_CTX_new( TLS_client_method() );
^~~~~~~~~~~~~~~~~
DTLS_client_method
<project_base>/src/gateway/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c:625:36: error: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Werror=int-conversion]
In file included from <project_base>/src/gateway/cloud/aws/sdk/platform/posix/transport/include/openssl_posix.h:59:0,
from <project_base>/gatewayx/src/gateway/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c:35:
<project_base>/gatewayx/leaf-data/r16/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/openssl/ssl.h:2131:10: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
^~~~~~~~~~~
This is snippet of my .cdef
cxxflags: {
-std=c++1z
-DMQTT_DO_NOT_USE_CUSTOM_CONFIG
-DDISABLE_LOGGING
-DLIBRARY_LOG_LEVEL=LOG_NONE
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/include
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/interface
-I$CURDIR/cloud/aws/sdk/platform/posix/transport/include
-I$CURDIR/cloud/aws/logging-stack
-I$CURDIR/cloud/aws/sdk/platform/include
-I$CURDIR/cloud/aws/sdk/platform/posix/transport/include
}
cflags: {
-std=c99
-DMQTT_DO_NOT_USE_CUSTOM_CONFIG
-DDISABLE_LOGGING
-DLIBRARY_LOG_LEVEL=LOG_NONE
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/include
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/
-I$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/interface
-I$CURDIR/cloud/aws/sdk/platform/posix/transport/include
-I$CURDIR/cloud/aws/logging-stack
-I$CURDIR/cloud/aws/sdk/platform/include
-I$CURDIR/cloud/aws/sdk/platform/posix/transport/include
}
provides: {
api: {
ipcGateway = $CURDIR/…/leipc/ipcGateway.api
}
}
sources: {
…
// AWS MQTT library
$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/core_mqtt.c
$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/core_mqtt_state.c
$CURDIR/cloud/aws/sdk/libraries/standard/coreMQTT/source/core_mqtt_serializer.c
$CURDIR/cloud/aws/sdk/platform/posix/transport/src/openssl_posix.c
}