You can chat about native SDK questions and issues here.

User avatar
By GIThomas
#78064 Hello everybody,

I need your help regarding a compiling/linking problem with my C code using ESP8266 SDK with mosquitto.

I am trying to compile a C code using the ESP8266 SDK. I also included mosquitto.h. Therefore, I downloaded the latest version and compiled it on the target system (RPi3). When I want to compile my own code afterwards it fails with the error "undefined reference to `mosquitto_lib_init'".
I made two attempts to resolve this issue:
1) Added -lmosquitto in the makefile: Compiling fails with "cannot find -lmosquitto"
=> I used "sudo /xtensa-lx106-elf/bin/ld -lmosquitto --verbos" to figure out that the lib was skipped:
"skipping incompatible sysroot/usr/lib/libmosquitto.so when searching for -lmosquitto"
Since I didnt know how to continue I abort my attempt

2) Added -L/lib/libmosquitto.so.1 in the makefile: Compiling still fails with "undefined reference ..."

Does any body know what I am doing wrong? Which part of the code/Makefile do you need to see?

Thank you!