Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use aqt for genbindings #156

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

Ahuge
Copy link

@Ahuge Ahuge commented Jan 31, 2025

This PR starts to switch to using aqt to target specific versions of Qt instead of relying on the version the distro provides

@Ahuge
Copy link
Author

Ahuge commented Jan 31, 2025

Currently getting numeric_limits errors

Not sure if that is related to my changes or not. I'll run some tests without my changes as well

error: no member named 'numeric_limits' in namespace 'std'
docker run --user $(id -u):$(id -g) -v ~/.cache/go-build:/.cache/go-build -v $PWD:/src -w /src miqt/genbindings:latest /bin/bash -c 'cd cmd/genbindings && go build && ./genbindings'
Found 577 header files to process.
Cleaning up output directory "../../qt"...
Removed 0 file(s).
Clang worker: starting
Clang worker: starting
No AST cache for file "qbytearraymatcher.h", running clang...
Clang worker got message for file "/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h"
No AST cache for file "qendian.h", running clang...
Clang worker got message for file "/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h"
No AST cache for file "qeventloop.h", running clang...
/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:103:38: error: no member named 'numeric_limits' in namespace 'std'
        const auto uchar_max = (std::numeric_limits<uchar>::max)();
                                ~~~~~^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:103:53: error: unexpected type name 'uchar': expected expression
        const auto uchar_max = (std::numeric_limits<uchar>::max)();
                                                    ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:103:59: error: no member named 'max' in the global namespace; did you mean 'std::max'?
        const auto uchar_max = (std::numeric_limits<uchar>::max)();
                                                          ^~~~~
                                                          std::max
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/algorithmfwd.h:407:5: note: 'std::max' declared here
    max(const _Tp&, const _Tp&);
    ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:103:20: warning: uninitialized variable in a constexpr function is a C++20 extension [-Wc++20-extensions]
        const auto uchar_max = (std::numeric_limits<uchar>::max)();
                   ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:104:15: warning: uninitialized variable in a constexpr function is a C++20 extension [-Wc++20-extensions]
        uchar max = n > uchar_max ? uchar_max : n;
              ^
In file included from /opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:44:
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:300:7: error: explicit specialization of undeclared template class 'numeric_limits'
class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:300:63: error: unknown template name 'numeric_limits'
class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
                                                              ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:344:18: error: explicit specialization of non-template class 'numeric_limits'
template<> class numeric_limits<const QT_PREPEND_NAMESPACE(qfloat16)>
                 ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:344:18: error: redefinition of 'numeric_limits'
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:300:7: note: previous definition is here
class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
      ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:345:14: error: unknown template name 'numeric_limits'
    : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
             ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:346:18: error: explicit specialization of non-template class 'numeric_limits'
template<> class numeric_limits<volatile QT_PREPEND_NAMESPACE(qfloat16)>
                 ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:346:18: error: redefinition of 'numeric_limits'
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:300:7: note: previous definition is here
class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
      ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:347:14: error: unknown template name 'numeric_limits'
    : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
             ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:348:18: error: explicit specialization of non-template class 'numeric_limits'
template<> class numeric_limits<const volatile QT_PREPEND_NAMESPACE(qfloat16)>
                 ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:348:18: error: redefinition of 'numeric_limits'
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:300:7: note: previous definition is here
class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
      ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qfloat16.h:349:14: error: unknown template name 'numeric_limits'
    : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
             ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:331:49: error: expected '(' for function-style cast or type construction
    { return QSpecialInteger(std::numeric_limits<T>::max()); }
                             ~~~~~~~~~~~~~~~~~~~^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:331:50: error: unexpected type name 'T': expected expression
    { return QSpecialInteger(std::numeric_limits<T>::max()); }
                                                 ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:331:52: error: no member named 'max' in the global namespace; did you mean simply 'max'?
    { return QSpecialInteger(std::numeric_limits<T>::max()); }
                                                   ^~~~~
                                                   max
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:330:45: note: 'max' declared here
    static Q_DECL_CONSTEXPR QSpecialInteger max()
                                            ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:333:49: error: expected '(' for function-style cast or type construction
    { return QSpecialInteger(std::numeric_limits<T>::min()); }
                             ~~~~~~~~~~~~~~~~~~~^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:333:50: error: unexpected type name 'T': expected expression
    { return QSpecialInteger(std::numeric_limits<T>::min()); }
                                                 ^
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:333:52: error: no member named 'min' in the global namespace; did you mean simply 'min'?
    { return QSpecialInteger(std::numeric_limits<T>::min()); }
                                                   ^~~~~
                                                   min
/opt/Qt/5.15.2/gcc_64/include/QtCore/qendian.h:332:45: note: 'min' declared here
    static Q_DECL_CONSTEXPR QSpecialInteger min()
                                            ^
2 warnings and 3 errors generated.
WARNING: Clang execution failed: Command: exit status 1
17 errors generated.
WARNING: Clang execution failed: Command: exit status 1

@ddkwork
Copy link

ddkwork commented Jan 31, 2025

nice work, please test build apk

@Ahuge
Copy link
Author

Ahuge commented Jan 31, 2025

Those errors do appear to be related to the aqt build. I don't get them with the standard docker image.

:/

I need to figure out what the cause of this error is:

/opt/Qt/5.15.2/gcc_64/include/QtCore/qbytearraymatcher.h:103:38: error: no member named 'numeric_limits' in namespace 'std'
        const auto uchar_max = (std::numeric_limits<uchar>::max)();

@Ahuge
Copy link
Author

Ahuge commented Jan 31, 2025

Ah
https://salsa.debian.org/qt-kde-team/qt/qtbase/-/blob/debian/5.15.2+dfsg-15/debian/patches/gcc_11_limits.diff?ref_type=tags

So it looks like the builds that Debian provide have patched headers and source files.

@Ahuge Ahuge marked this pull request as draft January 31, 2025 22:19
@arnetheduck
Copy link
Contributor

qt5.15.18 is out, why are you targeting .2?

ENV PATH=/opt/Qt/$QT6_VERSION/gcc_64/bin:$PATH
ENV LD_LIBRARY_PATH=/opt/Qt/$QT6_VERSION/gcc_64/lib
ENV QT_PLUGIN_PATH=/opt/Qt/$QT6_VERSION/gcc_64/plugins
ENV QTDIR=/opt/Qt/$QT6_VERSION/gcc_64
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these declarations overwrite the Qt5 ones? I think they're maybe not needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point.
They will be overriding the Qt5 ones.
We will likely need to generate the bindings for each major version in a separate step?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LD_LIBRARY_PATH and QT_PLUGIN_PATH are used by Qt apps at runtime to find their needed .so files. The PATH and QTDIR are only needed so that a developer can more easily run qmake.

I think Genbindings doesn't need any of those four, it should only need the Qt5Root change in config-libraries.go plus the new PKG_CONFIG_PATH entries.

@Ahuge
Copy link
Author

Ahuge commented Feb 1, 2025

qt5.15.18 is out, why are you targeting .2?

a

qt5.15.18 is out, why are you targeting .2?

https://download.qt.io/online/qtsdkrepository

The packages are provided by Qt project/The Qt company, not by aqtinstall project.

@Ahuge
Copy link
Author

Ahuge commented Feb 1, 2025

The Qt company doesn't have opensource releases for anything newer than 5.15.x

@Ahuge
Copy link
Author

Ahuge commented Feb 1, 2025

There may be a route forward, the debian patches are in their got. We could maybe pull down their patches for the release we're building against and apply any patches for headers we parse?

@mappu
Copy link
Owner

mappu commented Feb 1, 2025

Regarding #include <limits>, it was added to upstream Qt in 5.15.3 and later: qt/qtbase@0afad46

To use the 5.15.2 headers, another solution would be to put -include limits in the CFLAGS environment variable, or patch it into the CFLAGS included declared in the Qt5Widgets.pc file.

I think there are Qt 5.15.16 prebuilt binaries available in the https://download.qt.io/archive/qt/5.15/ directory, although they're not separated by target OS, so perhaps aqtinstall can't find them.

@Ahuge
Copy link
Author

Ahuge commented Feb 3, 2025

I think there are Qt 5.15.16 prebuilt binaries available in the https://download.qt.io/archive/qt/5.15/ directory, although they're not separated by target OS, so perhaps aqtinstall can't find them.

I think those are all source files actually. Just took a look and it seems like they might be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants