Can't initialize IoTHub_init() azure-iot-sdk-c on docker linux

Juan Carrasco 1 Reputation point
2022-08-04T08:19:40.28+00:00

Hello, I'm using Azure Iot Edge on my embedded device (ARM32v7) and I'm trying to deploy a custom module on the target. The proble is that I'm still getting the same error when I try to initilizae my IoTHub_init() with the azure-iot-sdk-c.

I've already tried different supported distros (bionic,xenial,trusty) by the azure-iot-sdk-c without success.

This is the docker logs output for my custom module:

16:45:12 2022 File:/build/azure-c-shared-util-w6wmSB/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:openssl_static_locks_uninstall Line:585 Locks already uninstalled

I don't know if there's a component missing on my docker container as this is the dockerfile:

FROM arm32v7/ubuntu:bionic AS base
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:aziotsdklinux/ppa-azureiot && \
apt-get update && \
apt-get install -y azure-iot-sdk-c-dev && \
apt-get install -y sqlite3 libsqlite3-dev && \
apt-get install -y libmodbus-dev && \
apt-get install -y libjson-c-dev && \
rm -rf /var/lib/apt/lists/*

FROM base AS build-env
RUN apt-get update && \
apt-get install -y --no-install-recommends cmake gcc g++ make libcurl5-openssl-dev && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY . ./
RUN cmake .
RUN make

FROM base
WORKDIR /app
COPY --from=build-env /app ./
RUN useradd -ms /bin/bash moduleuser
RUN chown moduleuser /app
USER moduleuser
CMD ["./main"]

Thanks

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
531 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
207 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 28,236 Reputation points MVP
    2022-08-04T15:37:33.28+00:00

    Hello @JuanCarrasco-824,

    the Azure IoT Edge development tools come with a Visual Studio or VS Code extension where custom modules can be created based on templates.

    Did you try the custom C template for Azure IoT Edge modules first?