PintaProject / Pinta

Simple GTK# Paint Program
http://www.pinta-project.com/
MIT License
1.75k stars 267 forks source link

Unable to build Pinta 2.1.1 on Ubuntu 24.04 #771

Closed jhonny-oliveira closed 2 months ago

jhonny-oliveira commented 2 months ago

Description I usually package Pinta for my xtradeb.net initiative. However, Ubuntu 24.04 doesn't provide dotnet-sdk-7.0. It only has dotnet-sdk-8.0. Would it be possible to patch Pinta 2.1.1 to support building with dotnet-sdk-8.0?

Thank you!

cameronwhite commented 2 months ago

Yes, this was recently done on the release-2.1 branch in #763 I'm planning to do a 2.1.2 release shortly after backporting a couple fixes for other macOS issues

jhonny-oliveira commented 2 months ago

I did a patch out of ba8021ae362aff0cd3247af6b2afc44094195691 and I'm able to build at home. Unfortunately, something changed and it no longer works in launchpad.net (offline).

These are the steps I took to make it work offline and it worked with release 2.1.1 and .NET 6, but it doesn't work with .NET 8.

Make offline #### change home location ``` mkdir .fakeHome export HOME=$(pwd)/.fakeHome env TargetFramework=net8.0 dotnet restore ``` #### prevent outgoing connections ``` tee .fakeHome/.nuget/NuGet/NuGet.Config < EOF ``` #### save the nuget cache and other depends ``` mkdir -p debian/depends tar cJf debian/depends/dotnet-cache.tar.xz .fakeHome ```

These are the build rules

debian/rules ``` #!/usr/bin/make -f #export DH_VERBOSE=1 # workaround https://github.com/dotnet/source-build/issues/2767 export HOME=$(CURDIR)/.fakeHome export DOTNET_CLI_TELEMETRY_OPTOUT=1 export MSBUILDDISABLENODEREUSE=1 export DOTNET_NOLOGO=1 export NUGET_CERT_REVOCATION_MODE=offline export NUGET_ENABLE_ENHANCED_HTTP_RETRY=false TDIR=$(CURDIR)/debian/pinta %: dh $@ override_dh_clean: dh_clean rm -Rf bin/ **/bin/ **/*/bin/ **/obj/ **/*/obj/ publish/ .fakeHome/ override_dh_auto_configure: tar xJf debian/depends/dotnet-cache.tar.xz dh_auto_configure -- --libdir=/usr/lib/ override_dh_auto_install: dh_auto_install chmod -x $(TDIR)/usr/lib/pinta/*.dll rm -Rf $(TDIR)/usr/lib/pkgconfig ```

This is the build log in launchpad.net: https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+build/28123569

For completeness, these are the entire package details: https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+sourcepub/15980285/+listing-archive-extra

Any ideas on how to make this successfully build offline?

Thank you!

Fr-Dae commented 2 months ago

maybe link to https://github.com/PintaProject/Pinta/issues/738

cameronwhite commented 2 months ago

I'm not aware of any changes in .NET 8 that would affect this, so probably more likely something to do with launchpad or the packaging process. I'd maybe add some additional logging to verify that HOME is being set to your new value when the build step is running, and that the extracted contents are where you expect them to be?

Oh, and also maybe check that the nuget cache folder is generated with exactly the same dotnet version as the version on launchpad. I think different minor versions could cause nuget to ignore the cached version and try downloading them (e.g. https://bugs.launchpad.net/ubuntu/+source/dotnet6/+bug/1997169/comments/6)

JGCarroll commented 2 months ago

2.1.2 is out now with .NET 8 support, so you can hopefully build it :).

jhonny-oliveira commented 2 months ago

Hi!

I have been testing this exhaustively (both, 2.1.1 and 2.1.2). Sadly, without any success. There are two issues I'm facing:

  1. dotnet always tries to fetch data after the restore (you can check this with "sudo tcpdump port '(80 or 443)'" while the build is running. Something must have changed in the code and I'm unable force dotnet offline.
  2. I have excluded the build target from dh_auto_test and dh_auto_install. Still, it gets executed during dh_auto_install, which is not allowed at this stage and breaks the recipe.

Additional thoughts

  1. I managed to build OpenRA with dotnet8 (openra package), so, the issue must be code/configuration related.
  2. In openra I managed to stop "dotnet build" in dh_auto_install by completely overriding it with the reverse engineered steps that "dotnet install" performs.

I'm attaching the build log and pausing this for the time being. Ubuntu Noble is almost here and I still have roughly 40% of the packages to publish and many new issues to fix. 20240422-pinta_build_log.txt

These are the new build rules

debian/rules ``` #!/usr/bin/make -f #export DH_VERBOSE=1 # workaround https://github.com/dotnet/source-build/issues/2767 export HOME=$(CURDIR)/.fakeHome export DOTNET_CLI_TELEMETRY_OPTOUT=1 export MSBUILDDISABLENODEREUSE=1 export DOTNET_NOLOGO=1 export NUGET_CERT_REVOCATION_MODE=offline export NUGET_ENABLE_ENHANCED_HTTP_RETRY=false TDIR=$(CURDIR)/debian/pinta %: dh $@ override_dh_clean: dh_clean rm -Rf bin/ **/bin/ **/*/bin/ **/obj/ **/*/obj/ publish/ .fakeHome/ override_dh_auto_configure: tar xJf debian/depends/dotnet-cache.tar.xz dh_auto_configure -- --libdir=/usr/lib/ override_dh_auto_test: # do not re-run target build dh_auto_test -- -o build override_dh_auto_install: # do not re-run target build dh_auto_install -- -o build chmod -x $(TDIR)/usr/lib/pinta/*.dll rm -Rf $(TDIR)/usr/lib/pkgconfig ```
cameronwhite commented 2 months ago

Yeah it's weird that the second dotnet build doesn't work.

I think the reason it runs twice is because the build rule in the Makefile is always considered out of date. This was fixed in the master branch at some point , e.g. compare https://github.com/PintaProject/Pinta/blob/79f2799cba3a1a78c20ecbabfb6575204036f6c8/Makefile.am#L41 vs https://github.com/PintaProject/Pinta/blob/b8d394374d54b4da6430ff8d29deb61255793383/Makefile.am#L45

so you could try patching it to

build/bin/Pinta.dll: Pinta.sln
    cd $(srcdir) && $(DOTNET_CMD) build Pinta.sln $(PINTA_BUILD_OPTS)

# target: build - Build Pinta.
build: build/bin/Pinta.dll
jhonny-oliveira commented 2 months ago

https://github.com/PintaProject/Pinta/issues/771#issuecomment-2071301066 looked promising... Still, the environment variables and configuration file seem to be ignored if dotnet is executed from within the Makefile.

My solution was to bring the relevant steps of the makefile to the debian recipe. Pinta runs, but I might have missed something... Let me know if I did.

Package details

https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+sourcepub/15993338/+listing-archive-extra

Packaged files

Pinta_2.1.2_ListPackagedFiles.txt

Build log

https://launchpadlibrarian.net/726334860/buildlog_ubuntu-noble-amd64.pinta_2.1.2-1xtradeb2.2404.1_BUILDING.txt.gz

Fr-Dae commented 2 months ago

how i can use it ? i need wait ?

jhonny-oliveira commented 2 months ago

It's only available for Ubuntu 24.04 (noble), which is supposed to be releases tomorrow. Follow the instruction here https://xtradeb.net/apps/pinta/#lp-package-details.

cameronwhite commented 2 months ago

#771 (comment) looked promising... Still, the environment variables and configuration file seem to be ignored if dotnet is executed from within the Makefile.

My solution was to bring the relevant steps of the makefile to the debian recipe. Pinta runs, but I might have missed something... Let me know if I did.

Package details

https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+sourcepub/15993338/+listing-archive-extra

Packaged files

Pinta_2.1.2_ListPackagedFiles.txt

Build log

https://launchpadlibrarian.net/726334860/buildlog_ubuntu-noble-amd64.pinta_2.1.2-1xtradeb2.2404.1_BUILDING.txt.gz

The list of installed files looks reasonable to me, so if Pinta runs successfully I think the changes should be fine