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

build: workarounds for gitlab instability and librsvg search path bug #300

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

frenchwr
Copy link

@frenchwr frenchwr commented Dec 3, 2024

The current build is failing for a few different reasons outlined below. I spent quite a bit of time fighting these issues so wanted to share as it may help unblock others. Since these are workarounds, I leave it to @jnsgruk and others to decide whether to actually merge this into preview, to simply leave this PR open for reference, or something else. :)

Issues and their workarounds

  • Intermittent instability of the GNOME gitlab instance, causing frequent failures in the pull stage for each part. It looks like these are known issues with the GNOME gitlab infrastructure and there is scheduled maintenance on Dec 4 to migrate their infra to AWS. To overcome this issue I updated the source URL to the mirrors for each repo hosted at github.com/GNOME.
  • Recent versions (e.g. 2.59.1) of librsvg introduced a variable ${pcfiledir} in librsvg-2.0.pc it distributes for pkgconfig. The gnome-46-2404-sdk snap now ships version 2.59.1 of librsvg and snapcraft is unable to correctly process ${pcfiledir} as reported recently in Snapcraft doesn't honor ${pcfiledir} in pkgconfig files canonical/snapcraft#5158. This results in the following error during the gimp build:
2024-12-02 21:58:23.329 :: 2024-12-02 21:58:22.753 :: ../src/operations/external/svg-load.c:44:10: fatal error: librsvg/rsvg.h: No such file or directory

The build logs also show the failing command with the incorrect path to the librsvg headers:

cc ... -I/snap/gnome-46-2404-sdk/current/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/librsvg-2.0 ... -o operations/external/svg-load.so.p/svg-load.c.o -c ../src/operations/external/svg-load.c

To workaround this second issue I hard-coded the correct path to the librsvg headers in the build-environment section in the parts where it is required.

source-tag: GEGL_0_4_50
plugin: meson
meson-parameters:
- --prefix=/usr
- --buildtype=release
- -Ddocs=false
- -Dworkshop=true
build-environment:
- C_INCLUDE_PATH: /snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/librsvg-2.0:${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- C_INCLUDE_PATH: /snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/librsvg-2.0:${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}
- C_INCLUDE_PATH: /snap/gnome-46-2404-sdk/current/usr/include/librsvg-2.0:${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}

Is this not equivalent?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, I was just preserving the form of the path used in librsvg's pkgconfig file, but not a big deal for me. I just committed your suggested change.

@@ -147,6 +149,7 @@ parts:
- GEGL_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gegl-0.4
- GI_TYPELIB_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/girepository-1.0:$GI_TYPELIB_PATH
- LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
- C_INCLUDE_PATH: /snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/librsvg-2.0:${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}
Copy link
Member

Choose a reason for hiding this comment

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

As above, would be good to remove the ../../../ as it seems unnecessary in this case?

Copy link
Author

Choose a reason for hiding this comment

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

Done (see comment above).

@jnsgruk jnsgruk merged commit e139ea8 into snapcrafters:preview Dec 3, 2024
1 check passed
@jnsgruk
Copy link
Member

jnsgruk commented Dec 4, 2024

Hmm, seems we still need some work on this - the submodules are still fetched from Gitlab, and fail when the infra is down! https://github.com/snapcrafters/gimp/actions/runs/12144600942/job/33869024313

@frenchwr
Copy link
Author

frenchwr commented Dec 4, 2024

Hmm, seems we still need some work on this - the submodules are still fetched from Gitlab, and fail when the infra is down! https://github.com/snapcrafters/gimp/actions/runs/12144600942/job/33869024313

Oof - I missed that. I think I can just run a sed on gimp/.gitmodules in that part's override-pull to update the URL. I'm testing now and I'll submit a PR if everything builds and I can see the gitmodules are being pulled from github.

@frenchwr
Copy link
Author

frenchwr commented Dec 4, 2024

Fixed in #301 @jnsgruk

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.

2 participants