# CMake/KDE in Poudriere



## astyle (Oct 17, 2022)

Dunno if this is the right sub-forum to post in... so, I'm gonna describe my setup, what I'm trying to do, and then describe the issues I'm having, and ask for help. So...


```
# uname -a
FreeBSD beastie.localhost.localdomain 13.0-RELEASE FreeBSD 13.0-RELEASE #0: Thu Jun 10 22:16:25 PDT 2021     alex@beastie.localhost.localdomain:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
# poudriere version
poudriere-git-3.3.99.20210828
# poudriere ports -l
freebsd_kde git+file 2022-10-16 16:11:04 /usr/local/poudriere/ports/freebsd_kde
# poudriere jail -l
kde_0    13.0-RELEASE-p7 amd64 http   2022-02-26 12:10:46 /usr/local/poudriere/jails/kde_0
```

Goal is to make KDE upgradeable independently from everything else. 

I started from KF5 5.82 and Plasma 5.21.5.  Pushed KF5 5.85 / Plasma 5.22.5 into the `freebsd_kde` poudriere tree. Then I ran `poudriere bulk -f /usr/home/user1/kde_upgrade.txt -p freebsd_kde -j kde_0`.

Now, x11/kf5-plasma-framework failed to build. Of course, Poudriere reported that it skipped 20 ports (as per .poudriere.ports.skipped logfile).

Now, this is where things get interesting. I tried to troubleshoot and compile stuff by hand, outside of the jail:

```
# cd /usr/local/poudriere/ports/freebsd_kde/x11/kf5-plasma-framework/
# make
```
`cmake` complains that *installed* stuff is at version 5.82, while it's looking for 5.85!


```
===>  Performing out-of-source build
/bin/mkdir -p /usr/local/poudriere/ports/freebsd_kde/x11/kf5-plasma-framework/work/.build
--

CMake Warning at /usr/local/share/ECM/find-modules/FindKF5.cmake:52 (find_package):
  Could not find a configuration file for package "KF5Activities" that is
  compatible with requested version "5.85.0".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/KF5Activities/KF5ActivitiesConfig.cmake, version: 5.82.0

Call Stack (most recent call first):
  CMakeLists.txt:45 (find_package)


-- Could NOT find KF5Activities , checked the following files:
    /usr/local/lib/cmake/KF5Activities/KF5ActivitiesConfig.cmake (version 5.82.0)
```

There's 20 of those, and none of them are reported as 'skipped' by Poudriere. Nonetheless, the ports are not compiled. `make` thinks that x11/kf5-plasma-framework has all dependencies satisfied, and invokes `cmake`, which complains that libs have the wrong version.

Funny thing is, I found x11/kf5-kactivities in my `freebsd_kde` poudriere tree. 
And - trying to compile that port alone using Poudriere did not work, Poudriere refused to queue it up for compilation.
_Outside of Poudriere_, I ran `make`, then `make package` - and I have a package in work/pkg port subdirectory, no complaints from `make`...

My thinking is, cmake is not looking in the right place... Any ideas on how to make this mess behave?


----------



## W.hâ/t (Oct 17, 2022)

please show the output

```
poudriere testport -j kde_0 x11/kf5-plasma-framework
```
The port Makefile also please.


----------



## astyle (Oct 17, 2022)

W.hâ/t said:


> please show the output
> 
> ```
> poudriere testport -j kde_0 x11/kf5-plasma-framework
> ...


running the code... I needed to add the -p freebsd_kde to the command. 

Update: Looks like i needed to supply the full path to the port... compilation failed. will be attaching a transcript later today


----------



## W.hâ/t (Oct 17, 2022)

Ooops, missing '-p freebsd_kde'


----------



## W.hâ/t (Oct 17, 2022)

from main branch

```
commit 33289b00b11ffa598ba8a76ed01c6a876395e33b
Author: Dima Panov <fluffy@FreeBSD.org>
Date:   Mon Sep 5 22:05:13 2022 +0300

    x11/kf5-plasma-framework: pet stage-qa
```


----------



## astyle (Oct 17, 2022)

W.hâ/t said:


> please show the output
> 
> ```
> poudriere testport -j kde_0 x11/kf5-plasma-framework
> ...


Uploaded, contained in typescript.txt... hope you can read it, there's a LOT..


----------



## W.hâ/t (Oct 18, 2022)

It's seems that you are missing the -lGL and -lEGL in the linker flags.
Does your Makefile looks like this?

```
USES=           cmake compiler:c++11-lib gettext gl kde:5 pkgconfig qt:5 tar:xz xorg
USE_GL=         egl gl
```

You may have to edit one of the CMakeLists.txt to add the flags.


```
FAILED: bin/libcorebindingsplugin.so
...
src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/windowthumbnail.cpp.o:(Plasma::DiscardEglPixmapRunnable::run())

ld: error: undefined symbol: glGetString
>>> referenced by windowthumbnail.cpp
>>>               src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/windowthumbnail.cpp.o:(Plasma::WindowThumbnail::xcbWindowToTextureEGL(Plasma::WindowTextureNode*))

ld: error: undefined symbol: glGenTextures
>>> referenced by windowthumbnail.cpp
```


----------



## astyle (Oct 18, 2022)

W.hâ/t said:


> It's seems that you are missing the -lGL and -lEGL in the linker flags.
> Does your Makefile looks like this?
> 
> ```
> ...


The original (v. 5.82) Makefile for x11/kf5-plasma-framework does have these lines, and so does the upgraded (v.5.85) version.

The only difference between the two that I'm noticing is this: (v. 5.85 has these lines, v. 5.82 does not)

```
PORTREVISION=1
...
PATCH_SITES=    https://invent.kde.org/frameworks/plasma-framework/-/commit/
PATCHFILES=     837bb6975f6a0661d211107823b7587808fc3d4e.diff:-p1
...
```

Also: after a fresh run of `updatedb`, `locate` found 51 instances of `CMakeLists.txt` just within the port's work/ subdirectory...

An educated assumption for me would be that the one on top of thework/ subdirectory structure is the one of interest: work/plasma-framework-5.85.0/CMakeLists.txt... Within that file, lines 213-218:

```
configure_package_config_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5PlasmaConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5PlasmaConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
  PATH_VARS  CMAKE_INSTALL_PREFIX
)
```

Does that look like I'm on the right track, or off the track completely?


----------



## W.hâ/t (Oct 18, 2022)

```
-- Found OpenGL: /usr/local/lib/libGL.so   
-- Performing Test HAVE_EGL
-- Performing Test HAVE_EGL - Success
-- Found EGL: /usr/local/include (found version "1.5")
-- Switch to EGL compatibility target EGL::EGL because OpenGL::EGL is not available
```
Not so sure it's the flag now, -lEGL might be enough. Anyway when looking for stuff in files `find ... -exec grep...` is your friend.


```
kde_0    13.0-RELEASE-p7 amd64 http   2022-02-26 12:10:46 /usr/local/poudriere/jails/kde_0
```
Upgrade to 13.1 first. The host first, jail after.


----------



## astyle (Oct 18, 2022)

W.hâ/t said:


> ```
> kde_0 13.0-RELEASE-p7 amd64 http 2022-02-26 12:10:46 /usr/local/poudriere/jails/kde_0
> ```
> Upgrade to 13.1 first. The host first, jail after.


Thanks for advice, I'll try that next weekend, too much other stuff (real-life stuff) on my plate this week.


----------



## astyle (Oct 21, 2022)

After re-reading my own transcript.txt from post #6:

Line 1898:

```
[ 99% 433/434] : && /usr/bin/c++ -fPIC -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -pedantic -Wzero-as-null-pointer-constant -fdiagnostics-color=always -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--enable-new-dtags  -fstack-protector-strong -Wl,-Bsymbolic-functions -shared -Wl,-soname,libcorebindingsplugin.so -o bin/libcorebindingsplugin.so src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/corebindingsplugin_autogen/mocs_compilation.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/corebindingsplugin.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/colorscope.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/datamodel.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/datasource.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/svgitem.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/fadingnode.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/framesvgitem.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/quicktheme.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/tooltip.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/tooltipdialog.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/serviceoperationstatus.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/iconitem.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/units.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/windowthumbnail.cpp.o src/declarativeimports/core/CMakeFiles/corebindingsplugin.dir/corebindingsplugin_autogen/EWIEGA46WW/qrc_shaders.cpp.o  -Wl,-rpath,/wrkdirs/usr/ports/x11/kf5-plasma-framework/work/.build/bin:/usr/local/lib:/usr/local/lib/qt5:  bin/libKF5PlasmaQuick.so.5.85.0  /usr/local/lib/libKF5QuickAddons.so.5.85.0  /usr/local/lib/libSM.so  /usr/local/lib/libICE.so  /usr/local/lib/libX11.so  /usr/local/lib/libXext.so  /usr/local/lib/libxcb.so  /usr/local/lib/libxcb-damage.so  /usr/local/lib/libxcb-composite.so  /usr/local/lib/libEGL.so  bin/libKF5Plasma.so.5.85.0  /usr/local/lib/libKF5Declarative.so.5.85.0  /usr/local/lib/qt5/libQt5Quick.so.5.15.2  /usr/local/lib/qt5/libQt5QmlModels.so.5.15.2  /usr/local/lib/qt5/libQt5Qml.so.5.15.2  /usr/local/lib/libKF5Package.so.5.85.0  /usr/local/lib/libKF5WindowSystem.so.5.85.0  /usr/local/lib/libKF5Service.so.5.85.0  /usr/local/lib/libKF5IconThemes.so.5.85.0  /usr/local/lib/qt5/libQt5Svg.so.5.15.2  /usr/local/lib/qt5/libQt5Network.so.5.15.2  /usr/local/lib/libKF5I18n.so.5.85.0  /usr/local/lib/libKF5ConfigCore.so.5.85.0  /usr/local/lib/libKF5CoreAddons.so.5.85.0  /usr/local/lib/qt5/libQt5X11Extras.so.5.15.2  /usr/local/lib/qt5/libQt5Widgets.so.5.15.2  /usr/local/lib/qt5/libQt5Gui.so.5.15.2  /usr/local/lib/qt5/libQt5Core.so.5.15.2  /usr/local/lib/libxcb-xfixes.so  /usr/local/lib/libxcb-render.so  /usr/local/lib/libxcb-shape.so  /usr/local/lib/libxcb.so  -Wl,-rpath-link,/usr/local/lib/qt5:/usr/local/lib && :
```

Compilation seems to be failing (as shown in post #7) because it's looking for libs like `/usr/local/lib/libKF5Service.so.5.85.0`, which have been neither compiled nor installed. `cmake` calls that out, but this somehow fails to translate into `make` looking in the _*poudriere*_ ports tree for missing deps...

Edit: Further re-reading shows this on line 1204:

```
-- Found KF5: success (found suitable version "5.85.0", minimum required is "5.85.0") found components: Activities Archive Config ConfigWidgets CoreAddons DBusAddons Declarative GlobalAccel GuiAddons I18n IconThemes KIO Service WindowSystem XmlGui Notifications Package Kirigami2 Wayland DocTools
```

Also, on line 1227:

```
-- Performing Test HAVE_EGL - Success
```

Which leads me to think that /usr/local that cmake is looking into - is in fact within the jail...

After this rodeo so far, it looks like I have two options:

Upgrade the kernels, or
force the linker to finish this port by doing what's suggested on line 1915 of transcript.txt: 
	
	



```
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer
```


----------



## astyle (Oct 29, 2022)

Looks like it's CMake not hunting down dependencies correctly.  It looks like getting a handle on compiling KDE period needs to happen for me. And that's between my keyboard and chair.


----------

