RJVB / macstrop

RJVB's repository of alternative macports, with ports missing from or overriding those in the standard collection, including a set of KF5 ports.
20 stars 9 forks source link

Qt/KDE installation issues #54

Closed Tatsh closed 4 years ago

Tatsh commented 4 years ago

I was unable to run port install --unrequested qt5-kde without first running port -f deactivate pkgconfig.

The logic in proc qt5.active_version in qt5-*-1.0.tcl checks to see if pkg-config exists but if this exists but Qt core is not installed, the proc raises. Maybe it should check that pkg-config succeeds?

proc qt5.active_version {} {
    global prefix
    namespace upvar ::qt5 active_version av
    if {[info exists av]} {
        return ${av}
    }
    if {[info exists building_qt5]} {
        set av ${version}
        return ${av}
    # This condition
    } elseif {[file exists ${prefix}/bin/pkg-config]} {
        set av [exec ${prefix}/bin/pkg-config --modversion Qt5Core]
        return ${av}
...

Something like:

try {
    set av [exec ${prefix}/bin/pkg-config --modversion Qt5Core]
} trap CHILDSTATUS {} {
    set av 0.0.0
}
return ${av}

Qt version mentioned in the current 5.9.7 Portfile is missing the last part in the branch name. Maybe this changed but Qt releases now have the the minor release number in the URL (5.9 not just 5):

http://download.qt.io/official_releases/qt/**5.9**/5.9.7/single/

With the current way the Portfile works (with the portgroup), it tries to use http://download.qt.io/official_releases/qt/5/5.9.7/single/.

With that change, the qt5-kde port works and installs.

Then kf5-kconfig fails:

:info:build Undefined symbols for architecture x86_64:
:info:build   "bool QTest::qCompare<QByteArray, QStringBuilder<QStringBuilder<QByteArray, QByteArray>,
 QByteArray> >(QByteArray const&, QStringBuilder<QStringBuilder<QByteArray, QByteArray>, QByteArray> c
onst&, char const*, char const*, char const*, int)", referenced from:
:info:build       KConfigTest::testQStringUtf8() in kconfigtest.cpp.o
:info:build ld: symbol(s) not found for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
Tatsh commented 4 years ago

That fixes the package a bit further but then it fails at link stage due to an issue with qt_metacall, like incompatible just like with qCompare.

Should I just use *-devel packages?

Tatsh commented 4 years ago

The URL issue isn't fixed. qt5.active_branch returns 5 but the URL needs have to 5.9 (seems this was changed recently by Qt devs). Extremely temporary workaround:

diff --git a/aqua/qt5-kde-devel/Portfile b/aqua/qt5-kde-devel/Portfile
index 2319872a..ecf1f160 100644
--- a/aqua/qt5-kde-devel/Portfile
+++ b/aqua/qt5-kde-devel/Portfile
@@ -179,7 +179,7 @@ platform darwin {

 distname            qt-everywhere-opensource-src-${version}

-master_sites        http://download.qt.io/official_releases/qt/${branch}/${version}/single/
+master_sites        http://download.qt.io/official_releases/qt/${branch}.9/${version}/single/

 use_xz              yes
RJVB commented 4 years ago

The URL issue isn't fixed. qt5.active_branch returns 5 but the URL needs have to 5.9 (seems this was changed recently by Qt devs). Extremely temporary workaround:

I meant to ask: what does port -v distfiles qt5-kde return for you? For me it returns the correct URL.

RJVB commented 4 years ago

That fixes the package a bit further but then it fails at link stage due to an issue with qt_metacall, like incompatible just like with qCompare.

Should I just use *-devel packages?

Same source file, same functions? That would suggest that you did an incremental build.

Anyway, yes, it seems that installing qt5-kde-devel would be a good idea if you don't want to run into this kind of issues which I would have to fix more or less blindly (I cannot build on my Mac right now). I have been planning to bump port:qt5-kde to 5.9.8 too, making the 2 ports more or less identical.

If you do install qt5-kde-devel and are in the process of rebuilding all its dependents anyway, would you mind testing the +large_json variant? It should allow using JSON files that are almost 6x larger than the current maximum (around 130Mb).

Tatsh commented 4 years ago

Building with +large_json now. What is this used for?

Is Qt going to be updated to 5.12?

Tatsh commented 4 years ago

I meant to ask: what does port -v distfiles qt5-kde return for you? For me it returns the correct URL.

Looks like this is now working for me.

Tatsh commented 4 years ago

Got some strange errors with the package 'legacy-support'.

:info:build "/usr/bin/clang" -c -Iinclude "-Os -fPIC src/macports_legacy_sysconf.c -o src/macports_leg
acy_sysconf.dl.o
:info:build /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
:info:build /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
:info:build /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
:info:build /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'

main.log

RJVB commented 4 years ago

Building with +large_json now. What is this used for?

For instance when you use KDevelop with the cmake wrappers I provide, which enable the old cmake-based project importer that reads the compile_commands.json file. This mode is a lot faster than the standard, fancier import which uses the CMake server, and other KDevelop utilities also use the file. But that file can get big, too big for a project like digikam for instance.

Is Qt going to be updated to 5.12?

I probably should and I'm debating how I could. I do not really feel like upgrading my OS X just for that (will probably take me months before I have everything working like I want again).

Tatsh commented 4 years ago

+large_json built without issue.

Tatsh commented 4 years ago

kf5-osx-integration-devel still failing. Relevant part of log:

:info:build /opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_kf5-osx-integration/kf5-osx-integration-devel/work/kf5-osx-integration-5/src/qcocoa-qpa/qnsview.mm:844:52: error: no viable conversion from 'QList<QCocoaWindow *>::iterator' to 'QList<QCocoaWindow *>::const_iterator'
:info:build         for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {
:info:build                                                    ^    ~~~~~~~~~~~~~~~
:info:build /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers/qlist.h:287:16: note: candidate constructor not viable: no known conversion from 'QList<QCocoaWindow *>::iterator' to 'QList<QCocoaWindow *>::Node *' for 1st argument
:info:build         inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {}
:info:build                ^

:info:build /opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_kf5-osx-integration/kf5-osx-integration-devel/work/kf5-osx-integration-5/src/qcocoa-qpa/qnsview.mm:844:52: error: no viable conversion from 'QList<QCocoaWindow *>::iterator' to 'QList<QCocoaWindow *>::const_iterator'
:info:build         for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {
:info:build                                                    ^    ~~~~~~~~~~~~~~~
:info:build /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers/qlist.h:287:16: note: candidate constructor not viable: no known conversion from 'QList<QCocoaWindow *>::iterator' to 'QList<QCocoaWindow *>::Node *' for 1st argument
:info:build         inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {}
:info:build                ^
:info:build /opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/Headers/qlist.h:291:16: note: candidate constructor not viable: no known conversion from 'QList<QCocoaWindow *>::iterator' to 'const QList<QCocoaWindow *>::const_iterator &' for 1st argument
:info:build         inline const_iterator(const const_iterator &o) Q_DECL_NOTHROW : i(o.i) {}
:info:build                ^

Of course there are tons of warnings about deprecated things but these can be ignored.

RJVB commented 4 years ago

On Wednesday August 07 2019 09:31:57 Tatsh wrote:

:info:build /opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_kf5-osx-integration/kf5-osx-integration-devel/work/kf5-osx-integration-5/src/qcocoa-qpa/qnsview.mm:844:52: error: no viable conversion from 'QList<QCocoaWindow >::iterator' to 'QList<QCocoaWindow >::const_iterator' :info:build for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {

That looks like a freak error: AFAIK it should be possible to assign a Foo::iterator to a Foo::const_iterator...

Also, you have already built an almost identical version of qnsview.mm when you built qt5-kde-devel...

Tatsh commented 4 years ago

Is this simple to patch? Replace ::const_iterator with ::iterator?

RJVB commented 4 years ago

Is this simple to patch? Replace ::const_iterator with ::iterator?

I guess you could (if nothing inside the loop requires a const_iterator). Or maybe the loop could be rewritten to use a C++11 foreach construct.

But this shouldn't be necessary; the error really makes no sense to me. Annoyingly I cannot really do any building on my Mac until somewhere next week ... and this is of course something that I cannot test and figure out on Linux.

Tatsh commented 4 years ago

Or maybe the loop could be rewritten to use a C++11 foreach construct.

I'll try this later.

RJVB commented 4 years ago

Could you try this patch?

diff --git a/src/qcocoa-qpa/qnsview.mm b/src/qcocoa-qpa/qnsview.mm
index 67ce005d815f68f31507722374edeb47cd08ff7c..ff26e4ea45f422ddc9e3d9a80baf8adbf904791a 100644
--- a/src/qcocoa-qpa/qnsview.mm
+++ b/src/qcocoa-qpa/qnsview.mm
@@ -841,7 +841,7 @@ static bool _q_dontOverrideCtrlLMB = false;
         // Check if the click is outside all popups.
         bool inside = false;
         QPointF qtScreenPoint = qt_mac_flipPoint([self screenMousePoint:theEvent]);
-        for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {
+        for (QList<QCocoaWindow *>::const_iterator it = popups->cbegin(); it != popups->cend(); ++it) {
             if ((*it)->geometry().contains(qtScreenPoint.toPoint())) {
                 inside = true;
                 break;

or this

diff --git a/src/qcocoa-qpa/qnsview.mm b/src/qcocoa-qpa/qnsview.mm
index 67ce005d815f68f31507722374edeb47cd08ff7c..d099a4b0e406740867134dcdd888f6fc514cb542 100644
--- a/src/qcocoa-qpa/qnsview.mm
+++ b/src/qcocoa-qpa/qnsview.mm
@@ -841,8 +841,8 @@ static bool _q_dontOverrideCtrlLMB = false;
         // Check if the click is outside all popups.
         bool inside = false;
         QPointF qtScreenPoint = qt_mac_flipPoint([self screenMousePoint:theEvent]);
-        for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {
-            if ((*it)->geometry().contains(qtScreenPoint.toPoint())) {
+        for (const QCocoaWindow *popup : *popups) {
+            if (popup->geometry().contains(qtScreenPoint.toPoint())) {
                 inside = true;
                 break;
             }
Tatsh commented 4 years ago

The first patch worked.

Tatsh commented 4 years ago

My issue now is with kf5-plasma-framework. An reinplace call fails. I think it's this line which seems to be missing a file name.

Patches from the PortGroup work:

--->  Patching CMakeLists.txt: /ADD_SUBDIRECTORY.*([ ]*doc[ ]*)/d
DEBUG: Executing reinplace: /usr/bin/sed {/ADD_SUBDIRECTORY.*([ ]*doc[ ]*)/d} </opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_KF5-Frameworks/kf5-plasma-framework/work/plasma-framework-5.60.0/CMakeLists.txt >@file13
DEBUG: euid/egid changed to: 0/0
DEBUG: chowned /opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_KF5-Frameworks/kf5-plasma-framework/work/plasma-framework-5.60.0/CMakeLists.txt to macports
DEBUG: euid/egid changed to: 502/501
DEBUG: euid/egid changed to: 0/0
DEBUG: setting attributes on /opt/local/var/macports/build/_Users_tatsh_dev_macstrop_kf5_KF5-Frameworks/kf5-plasma-framework/work/plasma-framework-5.60.0/CMakeLists.txt
DEBUG: euid/egid changed to: 502/501

in the Portfile:

DEBUG: Executing proc-post-org.macports.patch-patch-1
Error: Failed to patch kf5-plasma-framework: reinplace ?-E? ?-n? ?-q? ?-W dir? pattern file ...
DEBUG: Error code: NONE
DEBUG: Backtrace: reinplace ?-E? ?-n? ?-q? ?-W dir? pattern file ...
    while executing
Tatsh commented 4 years ago

I added "${worksrcpath}/CMakeLists.txt" to that line and I was able to install kf5-kate, which was my goal.

The install KF5 app instructions should be like this for now:

port install --unrequsted qt5-kde-devel
port install kf5-kate # or some other kf5 package
Tatsh commented 4 years ago
diff --git a/kf5/KF5-Frameworks/Portfile b/kf5/KF5-Frameworks/Portfile
index 9108ed2b..7a5f9c67 100644
--- a/kf5/KF5-Frameworks/Portfile
+++ b/kf5/KF5-Frameworks/Portfile
@@ -2080,7 +2080,7 @@ subport kf5-plasma-framework {
         if {[vercmp [qt5.active_version] 5.11.0] < 0 &&
             [vercmp ${kf5.latest_qt59_version} ${kf5.dep_version}] <0} {
             reinplace -q \
-                    "s|KF5_DEP_VERSION \"${kf5.dep_version}\"|KF5_DEP_VERSION \"${kf5.latest_qt59_version}\"|g"
+                    "s|KF5_DEP_VERSION \"${kf5.dep_version}\"|KF5_DEP_VERSION \"${kf5.latest_qt59_version}\"|g" "${worksrcpath}/CMakeLists.txt"
         }
         reinplace "s|/usr/share/inkscape|${prefix}/share/inkscape|g" "${worksrcpath}/src/tools/inkscape extensions/plasmarename.py"
         reinplace "s|/usr/bin/perl|${prefix}/bin/perl5|g" ${worksrcpath}/src/tools/currentColorFillFix.sh
diff --git a/kf5/kf5-osx-integration/Portfile b/kf5/kf5-osx-integration/Portfile
index 3353591d..f14f57d7 100644
--- a/kf5/kf5-osx-integration/Portfile
+++ b/kf5/kf5-osx-integration/Portfile
@@ -67,6 +67,8 @@ if {${subport} eq "${name}-devel"} {
     epoch           2
     worksrcdir      ${name}-5
     distname        ${name}-5
+    patchfiles cxx.patch
+    patch.pre_args      -p1
 } else {
     github.setup    RJVB osx-integration 0
     github.tarball_from releases
@@ -77,6 +79,7 @@ if {${subport} eq "${name}-devel"} {
     description     ${description} This port doesn't have a release version yet.
     long_description \
                     ${long_description} This port doesn't have a release version yet.
+
     pre-fetch {
         ui_error "This port doesn't have a release version (yet), use ${name}-devel instead."
         return -code error "This port doesn't have a release version (yet)."

cxx.patch is just one of the patches above.

RJVB commented 4 years ago

The first patch worked.

Does that mean that the 2nd patch didn't work? It should according to the parser.

RJVB commented 4 years ago

port install --unrequsted qt5-kde-devel

Why the unrequested argument?

RJVB commented 4 years ago

I'll commit the osx-integration change to the repo directly.

Tatsh commented 4 years ago

I don't see why the second one wouldn't work but I didn't try it.

I tend to use --unrequested for packages I don't use directly like libraries. I don't see a way for kf5-kate to pull in qt5-kde-devel.

Once certain kf5 packages are installed, from what I can tell based on the portgroup, any valid qt-kde package will become a dependency of those. So qt5-kde doesn't need to be requested, but if you want -devel you have to install it first so it gets detected by active_branch in qt5 port group.

RJVB commented 4 years ago

I tend to use --unrequested for packages I don't use directly like libraries. I don't see a way for kf5-kate to pull in qt5-kde-devel.

No, but it will pull in qt5-kde if no Qt5 package has been installed yet.

I wasn't aware of the option; from what I see now it corresponds to apt-get install foo ; apt-mark auto foo on Debuntu.

Tatsh commented 4 years ago

Just need the C++ patch for kf5-osx-integration and I'll consider this ticket done.