eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Build GTK 4 binaries

Open laeubi opened this issue 1 year ago • 21 comments

Currently the GTK4 binaries are not build as part of the build, this has several drawbacks:

  1. If anything is adjusted for GTK4 part it might break without notice 2) We have no GTK4 binaries by default

This enables compilation of the gtk4 parts to see at least everything can be compiled.

The following has to be checked:

  • [ ] do we have everything to compile for Jenkins Pod
  • [ ] do we have everything to compile for Github
  • [ ] ...

laeubi avatar Aug 27 '24 08:08 laeubi

Test Results

   483 files  ±0     483 suites  ±0   7m 46s ⏱️ -51s  4 095 tests ±0   4 085 ✅ ±0   7 💤 ±0  3 ❌ ±0  16 173 runs  ±0  16 080 ✅ ±0  90 💤 ±0  3 ❌ ±0 

For more details on these failures, see this check.

Results for commit 9da5b341. ± Comparison against base commit ca1bb199.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Aug 27 '24 09:08 github-actions[bot]

Linux already builds sucessufll on GH, but Mac complains about

/Applications/Xcode_15.2.app/Contents/Developer/usr/bin/make: invalid option -- g
/Applications/Xcode_15.2.app/Contents/Developer/usr/bin/make: invalid option -- a
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from commands.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any commands; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no commands; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo commands.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.
  -N OPTION, --NeXT-option=OPTION
                              Turn on value of NeXT OPTION.

This program built for i386-apple-darwin11.3.0
Report bugs to <[email protected]>

laeubi avatar Aug 27 '24 09:08 laeubi

Now Github succeed and Jenkins fails as expected:

11:31:19  gcc -shared -fPIC  -s -o libswt-cairo-gtk-4966r6.so swt.o cairo.o cairo_structs.o cairo_stats.o `pkg-config --libs-only-L cairo` -lcairo

11:31:19  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror   -c -o swt_awt.o swt_awt.c

11:31:19  gcc -shared   -s -o libswt-awt-gtk-4966r6.so swt_awt.o -L/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/lib -ljawt

11:31:19  cp libswt-gtk-4966r6.so libswt-awt-gtk-4966r6.so libswt-pi3-gtk-4966r6.so libswt-cairo-gtk-4966r6.so libswt-atk-gtk-4966r6.so libswt-glx-gtk-4966r6.so libswt-webkit-gtk-4966r6.so /home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/libs

11:31:19  
GTK3 Build succeeded

11:31:19  
Note: When building multiple GTK versions, a cleanup is required (and automatically performed) between them.

11:31:19  
Cleaning up...

11:31:19  rm -f *.o *.so

11:31:19  
Building GTK4 bindings:

11:31:19  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror -c swt.c

11:31:19  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror   -c -o c.o c.c

11:31:19  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror   -c -o c_stats.o c_stats.c

11:31:19  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror `pkg-config --cflags gtk4 gtk4-x11 gtk4-unix-print` -DUSE_ASSEMBLER -c callback.c

11:31:19  Package gtk4 was not found in the pkg-config search path.

11:31:19  Perhaps you should add the directory containing `gtk4.pc'

11:31:19  to the PKG_CONFIG_PATH environment variable

11:31:19  Package 'gtk4', required by 'virtual:world', not found

11:31:19  Package 'gtk4-x11', required by 'virtual:world', not found

11:31:19  Package 'gtk4-unix-print', required by 'virtual:world', not found

11:31:23  gcc -shared -fPIC  -s -o libswt-gtk-4966r6.so swt.o c.o c_stats.o callback.o

11:31:23  gcc -O -Wall -fPIC -DSWT_VERSION=4966r6   -DLINUX -DGTK -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include -I/home/jenkins/agent/workspace/eclipse.platform.swt_PR-1422/jdk.resources/include/linux -DJNI64 -Werror `pkg-config --cflags gtk4 gtk4-x11 gtk4-unix-print` -c os.c

11:31:23  Package gtk4 was not found in the pkg-config search path.

11:31:23  Perhaps you should add the directory containing `gtk4.pc'

11:31:23  to the PKG_CONFIG_PATH environment variable

11:31:23  Package 'gtk4', required by 'virtual:world', not found

11:31:23  Package 'gtk4-x11', required by 'virtual:world', not found

11:31:23  Package 'gtk4-unix-print', required by 'virtual:world', not found

11:31:23  In file included from os_structs.h:19,

11:31:23                   from os.c:20:

11:31:23  os.h:30:10: fatal error: gtk/gtk.h: No such file or directory

11:31:23   #include <gtk/gtk.h>

11:31:23            ^~~~~~~~~~~

11:31:23  compilation terminated.

11:31:23  make: *** [make_linux.mak:144: os.o] Error 1

11:31:23  
*** GTK4 Build failed, aborting further actions..

laeubi avatar Aug 27 '24 09:08 laeubi

Given that I wanted to have a look at some of those deprecation errors in the near future, what version of GTK4 do you plan on compiling against?

With https://github.com/eclipse-platform/eclipse.platform.swt/pull/1421, SWT would require at least require 4.10 but then the build would have to continue despite the deprecations. With older versions, the build would succeed but then the PR no longer builds as the new methods don't exist yet.

ptziegler avatar Aug 27 '24 19:08 ptziegler

As GTK4 is WIP it should be fine to require as new version as needed . By the time this is ready for prime time that version would have made it to mainstream distros.

akurtakov avatar Aug 28 '24 05:08 akurtakov

Main goal is to build it with "what is available right now", if we have this working one can go step further to support a specific version. But still then one need to take care as using "the latest" might simply make it impossible for some linux distributions (e.g LTE) that not always have latest and greatest of libraries, but "latest stable" version.

laeubi avatar Aug 28 '24 06:08 laeubi

Even though GTK4 was added here:

  • https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/2259/files

and container build seem to have completed

https://ci.eclipse.org/releng/view/Miscellaneous/job/Build-Docker-images/732/

the build still complains:

Package gtk4 was not found in the pkg-config search path.

@fredg02 anything else that needs to be done so the new container is visible? Can we do anything to verify the change is actually used? I didn't find anything in the log that indicates the actual used container has/version/date/....

laeubi avatar Aug 28 '24 07:08 laeubi

Main goal is to build it with "what is available right now", if we have this working one can go step further to support a specific version.

We should have target Linux versions specified in the project plan, similar to Java versions.

  • RHEL 9
  • SUSE 15 SP4
  • Ubuntu 24.04 The minimal GTK4 version could be derived from there.

iloveeclipse avatar Aug 28 '24 07:08 iloveeclipse

Main goal is to build it with "what is available right now", if we have this working one can go step further to support a specific version.

We should have target Linux versions specified in the project plan, similar to Java versions.

* RHEL 9

* SUSE 15 SP4

* Ubuntu 24.04
  The minimal GTK4 version could be derived from there.

I would agree with such version targeting when we discuss making GTK 4 default one. Unfortunately we are very far from it so by the time this discussion comes we will most likely have RHEL 10(most likely 11) and Ubuntu 26.04. Speaking from history - when port to GTK 3 was done we had to give feedback to gtk developers, report bugs, test patches and several times target even development versions in order to manage to complete SWT on GTK3 port. Setting targets based on what current LTS distros ships will most likely make the port far more harder than it should be (and some SWT features even impossible).

akurtakov avatar Aug 28 '24 08:08 akurtakov

One such impossible feature on RHEL 9 would be Browser support as even though there is gtk4 there is no webkitgtk4.

akurtakov avatar Aug 28 '24 08:08 akurtakov

That's why I said lets first get something compiled, then its easier to iterate, I tried to add some commands to find out actual installed versions for the github runners it is this versions:

libgtk-3-0/jammy-updates,jammy-security,now 3.24.33-1ubuntu2.2 amd64 [installed]
libgtk-3-common/jammy-updates,jammy-security,now 3.24.33-1ubuntu2.2 all [installed,automatic]
libgtk-3-dev/jammy-updates,jammy-security,now 3.24.33-1ubuntu2.2 amd64 [installed]
libgtk-4-1/jammy-updates,jammy-security,now 4.6.9+ds-0ubuntu0.22.04.2 amd64 [installed,automatic]
libgtk-4-bin/jammy-updates,jammy-security,now 4.6.9+ds-0ubuntu0.22.04.2 amd64 [installed,automatic]
libgtk-4-common/jammy-updates,jammy-security,now 4.6.9+ds-0ubuntu0.22.04.2 all [installed,automatic]
libgtk-4-dev/jammy-updates,jammy-security,now 4.6.9+ds-0ubuntu0.22.04.2 amd64 [installed]

laeubi avatar Aug 28 '24 08:08 laeubi

Jenkins CentOS currently using

gtk3-devel-3.22.30-11.el8.aarch64
webkit2gtk3-jsc-2.38.5-1.el8.aarch64
webkit2gtk3-2.38.5-1.el8.aarch64
gtk-update-icon-cache-3.22.30-11.el8.aarch64
webkit2gtk3-jsc-devel-2.38.5-1.el8.aarch64
gtk2-2.24.32-5.el8.aarch64
gtk2-devel-2.24.32-5.el8.aarch64
gtk3-3.22.30-11.el8.aarch64
libcanberra-gtk3-0.30-18.el8.aarch64
webkit2gtk3-devel-2.38.5-1.el8.aarch64

so it seems docker file change has had no effect...

laeubi avatar Aug 28 '24 09:08 laeubi

so it seems docker file change has had no effect...

https://ci.eclipse.org/releng/view/Miscellaneous/job/Build-Docker-images builds docker images from https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/tree/master/cje-production/dockerfiles. I don't know if there is a Jenkins job that actually builds https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/container.

I'd recommend to talk to project members that know more about the platform/swt docker builds. This should be more effective than you or me trying to decipher the inner workings of platform releng builds.

I would also recommend to not use a matrix build while trying to get this running. It makes debugging harder than it should be.

fredg02 avatar Aug 28 '24 09:08 fredg02

When you have found the right job to build the right docker image, I'd verify that it includes everything that is needed by running it locally. Once that is done, you can specify the sha256 of the image in your Jenkinsfile to make sure that the exact image is pulled.

fredg02 avatar Aug 28 '24 09:08 fredg02

@fredg02 So according to https://ci.eclipse.org/releng/job/Build-Docker-images/732/artifact/eclipse.platform.releng.aggregator/cje-production/dockerfiles/swt_9_build.log and https://ci.eclipse.org/releng/job/Build-Docker-images/732/artifact/eclipse.platform.releng.aggregator/cje-production/dockerfiles/push-swt_9_build.log image should be built and pushed but looking at https://hub.docker.com/layers/eclipse/platformreleng-centos-swt-build/9/images/sha256-31294c0be3473791b82c8f6cbb9e9e1bf5ff42701553eed6a5e17f5f427c59e4?context=explore image was last updated 2 months ago. I have no idea how to help more here.

akurtakov avatar Aug 28 '24 09:08 akurtakov

As noted above, https://ci.eclipse.org/releng/job/Build-Docker-images/ is not building the Dockerfile that @laeubi modified.

fredg02 avatar Aug 28 '24 09:08 fredg02

@fredg02

I changed the file here:

  • https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/2259

And Jenkins config says it runs build-centos_9_swt_build.sh what includes:

set -e

pushd centos-gtk4-mutter/9-swtBuild
echo "Building Centos 9 swt build image"
docker build --pull -t eclipse/platformreleng-centos-swt-build:9 .
popd

do I miss something obvious?

laeubi avatar Aug 28 '24 09:08 laeubi

@sravanlakkimsetti can you maybe shade some light here, the Jenkins file config and collection of shellscripts seems not easy to understand :-\

I even wonder if it would not be easier to have one Jeankinsfile (in git) that includes the shell calls directly instead of many different shell scripts with only a few line in it.

laeubi avatar Aug 28 '24 09:08 laeubi

@fredg02 I changed the file here: https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/2259

Ok. That was not obvious to me, based on the comments here.

fredg02 avatar Aug 28 '24 10:08 fredg02

Finally the docker images was updated and now we have GTK4 at the build node, this is the used GTK version and it shows a lot of deprecation warnings:

19:52:21  Name        : gtk4-devel
19:52:21  Version     : 4.12.3
19:52:21  Release     : 2.el9
19:52:21  Architecture: x86_64
19:52:21  Install Date: Wed 28 Aug 2024 05:27:02 PM UTC
19:52:21  Group       : Unspecified
19:52:21  Size        : 13102429
19:52:21  License     : LGPL-2.0-or-later
19:52:21  Signature   : RSA/SHA256, Mon 18 Dec 2023 09:49:21 PM UTC, Key ID 05b555b38483c65d
19:52:21  Source RPM  : gtk4-4.12.3-2.el9.src.rpm
19:52:21  Build Date  : Fri 08 Dec 2023 12:37:08 PM UTC
19:52:21  Build Host  : x86-04.stream.rdu2.redhat.com
19:52:21  Packager    : [email protected]
19:52:21  Vendor      : CentOS
19:52:21  URL         : https://www.gtk.org
19:52:21  Summary     : Development files for GTK

See https://ci.eclipse.org/releng/job/eclipse.platform.swt/job/PR-1422/14/pipeline-console/?selected-node=195 https://ci.eclipse.org/releng/job/eclipse.platform.swt/job/PR-1422/14/pipeline-console/log?nodeId=501

laeubi avatar Aug 28 '24 17:08 laeubi

@sravanlakkimsetti can you maybe shade some light here, the Jenkins file config and collection of shellscripts seems not easy to understand :-\

I even wonder if it would not be easier to have one Jeankinsfile (in git) that includes the shell calls directly instead of many different shell scripts with only a few line in it.

That were exaclty my toughts as well when I came along the docker images in the releng-aggregator repo the last time, but I never had the time to do that. But I think there is no reason that speaks against doing the latter if the Job is maintained in the releng.aggregator repo. In order to not lose it again:

  • https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/2271

Lets have further discussion about improvements of that process there.

HannesWell avatar Aug 28 '24 21:08 HannesWell

GTK3+4 Builds with the new docker image succeed! But the arm and alike fail due to missing gtk4 :-\

laeubi avatar Oct 09 '24 13:10 laeubi

@fredg02 can I somehow run my docker image on the native (e.g. aarch64 machine) e.g. something like

podTemplate(inheritFrom: 'centos-latest' /* inhert general configuration */, containers: [
	containerTemplate(name: 'swtbuild', image: 'eclipse/platformreleng-debian-swtnativebuild:12',
		resourceRequestCpu:'1000m', resourceRequestMemory:'512Mi',
		resourceLimitCpu:'2000m', resourceLimitMemory:'4096Mi',
		alwaysPullImage: true, command: 'cat', ttyEnabled: true)
]) {
	node('native.builder-'gtk.linux.aarch64) { stage(nativeBuildStageName) { container('swtbuild') { body() } } }
}

laeubi avatar Oct 09 '24 13:10 laeubi

If the native build agent's have docker installed, we could maybe launch another docker node from that agent?

And we could maybe even build a docker-image for SWT on the fly using: https://www.jenkins.io/doc/book/pipeline/docker/#building-containers

If that works as desired/hoped, we could even maintain the docker-image in this repo without the need to push it to docker-hub.

HannesWell avatar Oct 09 '24 19:10 HannesWell

If that works as desired/hoped, we could even maintain the docker-image in this repo without the need to push it to docker-hub.

One drawback is that building a docker image can take some time and requires download of a lot of stuff, so I think using a prebuild image from a registry can still be good. On the other hand on a "real" machine one can probably benefit from caching (in both cases).

Anyways as ther is no easy "out of the box" way I first will head on to make the lib available on the machines:

  • https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/5110

laeubi avatar Oct 10 '24 06:10 laeubi

This is now ready to be merged once master is open for the next stream.

laeubi avatar Nov 12 '24 09:11 laeubi

If we can audit that this change doesn't modify any of the already built artifacts (only adds new ones) and that the behavior seems backward compatible; then could we consider a merge ASAP, before next stream starts even? @laeubi are those assumptions supposed to hold true? @akurtakov What do you think?

mickaelistria avatar Nov 12 '24 10:11 mickaelistria

This will at least raise the GLIBC version requirements and therefore might not be good in current release phase.

laeubi avatar Nov 12 '24 10:11 laeubi

@mickaelistria This has been already tested and building on newer distros leads to using newer glibc symbols (versioned dlsym/dlopen IIRC) that render old systems no longer loading. So it's best to delay till start of next cycle.

akurtakov avatar Nov 12 '24 10:11 akurtakov

Now the native build succeeds but for some reason the text execution failed in the initialize shell.

laeubi avatar Nov 27 '24 08:11 laeubi