Thanks for taking the time to answer Daklein, the fact is that as I wrote, I am a complete dumb on linux and It is really hard for me to get my head on this things.Maybe it's the 64b os, and paho mqtt not set up for 64bit? Just a guess. Maybe the paho makefile needs to be adjusted. Maybe see if there's a different version of it that would work, or ask at the paho github page? https://github.com/eclipse/paho.mqtt.c/releases
Anyway, if I compile not statically all is working fine; if I compile statically there is the error (so I guess that paho is fine with the 64 bit).