Unable to build static version of Qt 5.15.2
-
wrote on 27 Sept 2022, 19:06 last edited by
I am trying to build qt-everywhere-src-5.15.2 statically but am getting a bunch of errors.
Steps to reproduce:
- Download https://download.qt.io/archive/qt/5.15/5.15.2/single/
- Unzip and cd into directory
- Run:
./configure -static
Here's some of the output:
qt-everywhere-src-5.15.2/qtbase/include/QtCore/../../src/corelib/global/qfloat16.h:300:7: error: ‘numeric_limits’ is not a class template 300 | class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
-
What MSVC version do you use?
-
wrote on 27 Sept 2022, 20:22 last edited by
@Christian-Ehrlicher said in Unable to build static version of Qt 5.15.2:
MSVC
I'm not sure. Where would I find that info?
-
@Christian-Ehrlicher said in Unable to build static version of Qt 5.15.2:
MSVC
I'm not sure. Where would I find that info?
@robertwilliamallen said in Unable to build static version of Qt 5.15.2:
Where would I find that info?
What version of Visual Studio did you install?
-
@robertwilliamallen said in Unable to build static version of Qt 5.15.2:
Where would I find that info?
What version of Visual Studio did you install?
wrote on 28 Sept 2022, 14:13 last edited by@jsulm I don't have Visual Studio installed. I am working on Ubuntu 22.
-
Lifetime Qt Championwrote on 28 Sept 2022, 14:31 last edited by Christian Ehrlicher
Ok, it looked like an error from MSVC and you did not tell us before what OS and compiler you're using.
What gcc version doe you use?
/edit: maybe this is your problem: https://codereview.qt-project.org/c/qt/qtbase/+/330713
-
Ok, it looked like an error from MSVC and you did not tell us before what OS and compiler you're using.
What gcc version doe you use?
/edit: maybe this is your problem: https://codereview.qt-project.org/c/qt/qtbase/+/330713
wrote on 29 Sept 2022, 14:57 last edited by@Christian-Ehrlicher
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 -
@Christian-Ehrlicher
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0So apply the patch in my links since it's for gcc11 and up.
-
So apply the patch in my links since it's for gcc11 and up.
wrote on 29 Sept 2022, 20:50 last edited by@Christian-Ehrlicher Will try and report back. Thanks!
-
So apply the patch in my links since it's for gcc11 and up.
wrote on 30 Sept 2022, 14:59 last edited by@Christian-Ehrlicher I have never applied a patch and not sure how to do that. Is there a guide somewhere I can follow?
-
Manually adding two include statements in two files shouldn't be that hard
-
Manually adding two include statements in two files shouldn't be that hard
wrote on 30 Sept 2022, 15:34 last edited by@Christian-Ehrlicher Yep. I figured as much after I asked. So that is done and it seemed to get further in the compilation but I'm still getting errors:
Creating qmake... ........................................In file included from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearray.cpp:43: /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h: In static member function ‘static QStaticByteArrayMatcherBase::Skiptable QStaticByteArrayMatcherBase::generate(const char*, uint)’: /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h:103:38: error: ‘numeric_limits’ is not a member of ‘std’ 103 | const auto uchar_max = (std::numeric_limits<uchar>::max)(); | ^~~~~~~~~~~~~~ /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h:103:58: error: expected primary-expression before ‘>’ token 103 | const auto uchar_max = (std::numeric_limits<uchar>::max)(); | ^ /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h:103:61: error: ‘::max’ has not been declared; did you mean ‘std::max’? 103 | const auto uchar_max = (std::numeric_limits<uchar>::max)(); | ^~~ | std::max In file included from /usr/include/c++/11/algorithm:62, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:142, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/qglobal.h:1, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/../../src/corelib/thread/qatomic.h:41, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/qatomic.h:1, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/../../src/corelib/tools/qrefcount.h:43, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/include/QtCore/qrefcount.h:1, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearray.h:44, from /home/robert/Documents/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearray.cpp:42: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ gmake: *** [Makefile:350: qbytearray.o] Error 1
-
As you can see the compiler complains again about numeric_limits so add this include there too.
-
As you can see the compiler complains again about numeric_limits so add this include there too.
wrote on 30 Sept 2022, 15:45 last edited by@Christian-Ehrlicher Added
#include <limits>
toqbytearraymatcher.h
and it worked. Thanks for your help! Just getting into Qt and definitely feeling the learning curve. -
@Christian-Ehrlicher Added
#include <limits>
toqbytearraymatcher.h
and it worked. Thanks for your help! Just getting into Qt and definitely feeling the learning curve.wrote on 7 Dec 2022, 06:41 last edited by@robertwilliamallen It works,good job!!!
-
-
@Christian-Ehrlicher Added
#include <limits>
toqbytearraymatcher.h
and it worked. Thanks for your help! Just getting into Qt and definitely feeling the learning curve.wrote on 31 Jul 2023, 07:37 last edited by@robertwilliamallen thanks
-
wrote on 5 Sept 2023, 06:52 last edited by
@papaya said in Unable to build static version of Qt 5.15.2:
It works,good job!!!
-
wrote on 18 Oct 2023, 16:27 last edited by
I am using Qt5.12.6 and I was getting the same error. While attempting this solution I noticed that qglobal.h is included in all these files mentioned, so I added limits include to the __cplusplus check like this and it worked:
#ifdef __cplusplus # include <type_traits> # include <limits> # include <cstddef> # include <utility> #endif
-
As you can see the compiler complains again about numeric_limits so add this include there too.
wrote on 27 Nov 2023, 13:49 last edited by@Christian-Ehrlicher Hello,
is there anywhere we can ask for the files to be updated? the ones in the https://download.qt.io/official_releases/qt/5.15/5.15.2/single/
still have this issue I struggled to compile it until I found this post by chance.... would be great to rectify this for other future people out there.... -
@Christian-Ehrlicher Hello,
is there anywhere we can ask for the files to be updated? the ones in the https://download.qt.io/official_releases/qt/5.15/5.15.2/single/
still have this issue I struggled to compile it until I found this post by chance.... would be great to rectify this for other future people out there....@otaolafr Hi,
If you are building from source anyway, you should download a more recent version such as 5.15.11. See the content of the 5.15 releases folder.