Hello,
I am cross-compiling an application for PLCnext controller using the SDK 2025.6.0.My Makefile compiles fine, but at the link stage I get errors:
cannot find …/usr/lib/libmosquitto.a: No such file or directory
cannot find …/usr/lib/libmodbus.a: No such file or directory
cannot find -lc: No such file or directory
collect2: error: ld returned 1 exit statusarm-pxc-linux-gnueabi-gcc -Wall -g -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard \
--sysroot=/opt/pxc/2025.6.0/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi \
-I…/usr/include \
-o HMI_Backend main.o modbus_tcp.o udp_server.o mqtt_publish.o \
/opt/…/usr/lib/libmosquitto.a /opt/…/usr/lib/libmodbus.a /opt/…/usr/lib/libcjson.a \
-lpthread -static
It looks like the SDK does not contain the static .a versions of these libraries, only the shared .so.
When I remove -static and switch to -lmosquitto -lmodbus -lcjson, the build goes further (uses shared libs).
My questions: Is static linking (-static
- ) supported with the PLCnext SDK?
- If not, is dynamic linking with the provided
.solibraries the recommended approach? - If I really need static linking, how can I build/get the
.alibraries for mosquitto, modbus, and cjson within the SDK?
And if I can compile and build my application inside PLCnext controller.
