I'm currently trying to set up a Docker container containing Qt 6.5.0 LTS. My goal is to statically compile Qt programs using qmake, so that I don't have to install any dependencies to run the executable. However, I'm facing some issues and need assistance with the following error messages:
./echoWebSocket: error while loading shared libraries: libQt6Widgets.so.6: cannot open shared object file: No such file or directory
or
./echoWebSocket: error while loading shared libraries: libQt5Widgets.so.6: cannot open shared object file: No such file or directory
To address this problem, I added the staticlib flag to the .pro file:
CONFIG += staticlib
However, when I build the project, I encounter the following error:
/usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libQt5Widgets.so'
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: echoWebSocket] Error 1
Can someone please guide me on how to install the static version of the libQt5Widgets and libQt6Widgets libraries?
Below is the configuration command I used for the ./configure step:
./configure -commercial \
-release \
-static \
-static-runtime \
-static-libgcc \
-static-libstdc++ \
-reduce-relocations \
-no-pch \
-prefix "/qt-${QT_VERSION_B}-static" \
-no-rpath \
-fontconfig \
-nomake tests \
-nomake examples \
-skip qtwebengine \
-skip qtdoc \
-skip qttools \
-skip qtwebkit-example \
-skip qtsensors \
-skip qttranslations \
-skip qtpdf
I would greatly appreciate any assistance you can provide. Thank you!