Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compile using static Qt build with QtCreator - not using static OS libraries



  • I am attempting to build a stand-alone Qt desktop application for Ubuntu 18.04.
    I have build and installed Qt5.12.4 static libraries.
    My QtCreator version is: Qt Creator 4.13.2
    my .pro file includes: CONFIG += static
    Attempts to build and run the application appear to work and QtCreator appears to use the static Qt libraries as desired.
    However, QtCreator is linking the shared libraries from the operating system (OS), i.e. *.so files from Linux as shown in the compiler output below:

    ####################################################
    gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/actions_rootdialog.h -o moc_actions_rootdialog.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/customquery.h -o moc_customquery.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/datatablemodel.h -o moc_datatablemodel.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/datatableview.h -o moc_datatableview.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/hheaderview.h -o moc_hheaderview.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/plotactions.h -o moc_plotactions.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../deviceparameters/plotsmithactions.h -o moc_plotsmithactions.cpp
    /opt/Qtstatic_5.12.4/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB --include /carbonics/owncloudsync/programs/C++/build-deviceparameters-Qtstatic_5_12_4-Debug/moc_predefs.h -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -I/carbonics/owncloudsync/programs/C++/deviceparameters -I/usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include /opt/QcustomPlot/qcustomplot/qcustomplot.h -o moc_qcustomplot.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_abstractactions.o moc_abstractactions.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions.o moc_actions.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_DCstatic.o moc_actions_DCstatic.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_DCsweptVgs.o moc_actions_DCsweptVgs.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_parameters.o moc_actions_parameters.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_parameters_DCstatic.o moc_actions_parameters_DCstatic.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_parameters_DCsweptVgs.o moc_actions_parameters_DCsweptVgs.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_actions_rootdialog.o moc_actions_rootdialog.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_customquery.o moc_customquery.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_datatablemodel.o moc_datatablemodel.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_datatableview.o moc_datatableview.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_hheaderview.o moc_hheaderview.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_plotactions.o moc_plotactions.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_plotsmithactions.o moc_plotsmithactions.cpp
    g++ -c -pipe -g -std=gnu++1z -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../deviceparameters -I. -isystem /usr/include/eigen3 -I/opt/userlibs -I/opt/QcustomPlot/qcustomplot -I/opt/Qtstatic_5.12.4/include -I/opt/Qtstatic_5.12.4/include/QtPrintSupport -I/opt/Qtstatic_5.12.4/include/QtWidgets -I/opt/Qtstatic_5.12.4/include/QtGui -I/opt/Qtstatic_5.12.4/include/QtSql -I/opt/Qtstatic_5.12.4/include/QtCore -I. -I. -I/opt/Qtstatic_5.12.4/mkspecs/linux-g++ -o moc_qcustomplot.o moc_qcustomplot.cpp
    g++ -Wl,--gc-sections -o deviceparameters abstractactions.o abstractdatabase.o actions.o actions_DCstatic.o actions_DCsweptVgs.o actions_parameters.o actions_parameters_DCstatic.o actions_parameters_DCsweptVgs.o actions_rootdialog.o customquery.o datatablemodel.o datatableview.o hheaderview.o main.o measureddatabase.o plotactions.o plotcurve.o plotsmithactions.o qcustomplot.o deviceparameters_plugin_import.o moc_abstractactions.o moc_actions.o moc_actions_DCstatic.o moc_actions_DCsweptVgs.o moc_actions_parameters.o moc_actions_parameters_DCstatic.o moc_actions_parameters_DCsweptVgs.o moc_actions_rootdialog.o moc_customquery.o moc_datatablemodel.o moc_datatableview.o moc_hheaderview.o moc_plotactions.o moc_plotsmithactions.o moc_qcustomplot.o /opt/Qtstatic_5.12.4/plugins/platforms/libqxcb.a /opt/Qtstatic_5.12.4/plugins/xcbglintegrations/libqxcb-egl-integration.a /opt/Qtstatic_5.12.4/lib/libQt5XcbQpa.a /usr/lib/x86_64-linux-gnu/libXrender.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /opt/Qtstatic_5.12.4/lib/libxcb-static.a /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so /usr/lib/x86_64-linux-gnu/libxkbcommon.so /opt/Qtstatic_5.12.4/plugins/imageformats/libqgif.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqicns.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqico.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqjpeg.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqtga.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqtiff.a /usr/lib/x86_64-linux-gnu/libtiff.so /opt/Qtstatic_5.12.4/plugins/imageformats/libqwbmp.a /opt/Qtstatic_5.12.4/plugins/imageformats/libqwebp.a /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libwebpdemux.so /opt/Qtstatic_5.12.4/plugins/egldeviceintegrations/libqeglfs-emu-integration.a /opt/Qtstatic_5.12.4/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.a /opt/Qtstatic_5.12.4/lib/libQt5EglFsKmsSupport.a /opt/Qtstatic_5.12.4/lib/libQt5KmsSupport.a -ldl /opt/Qtstatic_5.12.4/lib/libQt5EdidSupport.a /usr/lib/x86_64-linux-gnu/libdrm.so /opt/Qtstatic_5.12.4/plugins/egldeviceintegrations/libqeglfs-x11-integration.a /opt/Qtstatic_5.12.4/lib/libQt5EglFSDeviceIntegration.a /opt/Qtstatic_5.12.4/lib/libQt5EventDispatcherSupport.a /opt/Qtstatic_5.12.4/lib/libQt5ServiceSupport.a /opt/Qtstatic_5.12.4/lib/libQt5ThemeSupport.a /opt/Qtstatic_5.12.4/lib/libQt5FontDatabaseSupport.a /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libfreetype.so /opt/Qtstatic_5.12.4/lib/libQt5FbSupport.a /opt/Qtstatic_5.12.4/lib/libQt5EglSupport.a /opt/Qtstatic_5.12.4/lib/libQt5InputSupport.a /opt/Qtstatic_5.12.4/lib/libQt5PlatformCompositorSupport.a /opt/Qtstatic_5.12.4/lib/libQt5DeviceDiscoverySupport.a /lib/x86_64-linux-gnu/libudev.so /opt/Qtstatic_5.12.4/lib/libQt5DBus.a /usr/lib/x86_64-linux-gnu/libX11-xcb.so /usr/lib/x86_64-linux-gnu/libxcb.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libm.so /usr/lib/x86_64-linux-gnu/libEGL.so /opt/Qtstatic_5.12.4/plugins/sqldrivers/libqsqlite.a /opt/Qtstatic_5.12.4/plugins/sqldrivers/libqsqlmysql.a /usr/lib/x86_64-linux-gnu/libmysqlclient.so /opt/Qtstatic_5.12.4/plugins/sqldrivers/libqsqlodbc.a /usr/lib/x86_64-linux-gnu/libodbc.so /opt/Qtstatic_5.12.4/plugins/sqldrivers/libqsqlpsql.a /usr/lib/x86_64-linux-gnu/libpq.so /opt/Qtstatic_5.12.4/lib/libQt5PrintSupport.a /opt/Qtstatic_5.12.4/lib/libQt5Widgets.a /opt/Qtstatic_5.12.4/lib/libQt5Gui.a /opt/Qtstatic_5.12.4/lib/libqtlibpng.a /opt/Qtstatic_5.12.4/lib/libqtharfbuzz.a /opt/Qtstatic_5.12.4/lib/libQt5Sql.a /opt/Qtstatic_5.12.4/lib/libQt5Core.a -lm /usr/lib/x86_64-linux-gnu/libicui18n.so /usr/lib/x86_64-linux-gnu/libicuuc.so /usr/lib/x86_64-linux-gnu/libicudata.so /usr/lib/x86_64-linux-gnu/libdl.so /opt/Qtstatic_5.12.4/lib/libqtpcre2.a /usr/lib/x86_64-linux-gnu/libgthread-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/lib/x86_64-linux-gnu/libGLESv2.so -lpthread
    13:30:27: The process "/usr/bin/make" exited normally.
    13:30:27: Elapsed time: 00:29.

    #####################################################################################

    For instance, I see references to *.so files in the output above e.g. /usr/lib/x86_64-linux-gnu/libicuuc.so ......
    I believe that the *.so files all have static counterparts installed on my Ubuntu OS but QtCreator appears to be linking the *.so versions from the OS.
    Is there a way to get QtCreator to link the *.a (static) versions of the OS libraries instead, so that I have a truely standalone executable which does not depend on having the proper versions of the OS shared libraries?
    Thanks so much,
    Phil


  • Lifetime Qt Champion

    Hi,

    @montanaviking said in Compile using static Qt build with QtCreator - not using static OS libraries:

    I believe that the *.so files all have static counterparts installed on my Ubuntu OS but QtCreator appears to be linking the *.so versions from the OS.

    You should rather check that you actually have them at hand.

    By default gcc selects the shared version of the libraries unless -static is passed to it.

    The libraries you see there are likely the Qt dependencies. You can have static libraries that have dynamic dependencies,



  • @SGaist Thanks for your advice! My Qt Creator is statically linking (using .a files) all the Qt libraries called in my Qt application. However, it's dynamically linking (.so files) all the Linux system library dependencies - even though a check of my Linux system libraries show that the corresponding *.a library files are available. If I try to specify each of the Linux *.a files via the LIBS+=/libdirectory/xxxx.a ... directive in my *.pro file, then the *.a Linux libraries are linked but strangely, the corresponding *.so Linux libraries are STILL linked as well and I cannot stop QtCreator from linking these *.so system files.

    Modifying the MakeFile file output by QtCreator to replace all the Linux *.so files with Linux *.a files did "work" except that I then discovered that, in fact, I was still missing, actually missing some Linux *.a files for which I had *.so files but not the corresponding *.a files. And when I tried linking the *.so files for these cases, I wound up with a missing dependency.

    In any case, I'm wondering if it's actually impossible to compile my Qt application down to a single *.exe file that calls NO dynamic libraries? Will I always need to either distribute the Linux *.so dependencies with my application (this is solved for the Qt dependencies now) or tell the end users that they must recompile the application to use their versions of Linux *.so files?

    Perhaps these are obvious questions except that I am a rank amateur and still learning about C++ building.
    Thanks,
    Phil


  • Lifetime Qt Champion

    To simplify your life, you might want to consider using the linuxdeployqt project.

    That said, to ensure full static build, you will have to either create you own mkspec or alter the current one to explicitly link to the static versions of the dependencies.



  • Hi and thanks,
    But, is there no way to have Qt Creator automate the process of static linking of Linux OS libraries when possible?
    Thanks,
    Phil


  • Lifetime Qt Champion

    Qt Creator has nothing to do with that. It's on the linker level that it happens.

    As I wrote before, you can make your own mkspec to modify the flags.

    One thing that you also have to take into account is the licensing constraints the comes with a static build of Qt and the dependencies your are using.