Gnome-3-38 sets build-environment in resulting a failed build

My snap aris (https://snapcraft.io/aris) uses a modified variant of the gnome-3-38 extension. The original setting,

   build-environment:
   - PATH: /snap/gnome-3-38-2004-sdk/current/usr/bin:$PATH
   - XDG_DATA_DIRS: $SNAPCRAFT_STAGE/usr/share:/snap/gnome-3-38-2004-sdk/current/usr/share:/usr/share:$XDG_DATA_DIRS
   - LD_LIBRARY_PATH: /snap/gnome-3-38-2004-sdk/current/lib/$SNAPCRAFT_ARCH_TRIPLET:/snap/gnome-3-38-2004-sdk/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:/snap/gnome-3-38-2004-sdk/current/usr/lib:/snap/gnome-3-38-2004-sdk/current/usr/lib/vala-current:/snap/gnome-3-38-2004-sdk/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
   - PKG_CONFIG_PATH: /snap/gnome-3-38-2004-sdk/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgconfig:/snap/gnome-3-38-2004-sdk/current/usr/lib/pkgconfig:/snap/gnome-3-38-2004-sdk/current/usr/share/pkgconfig:$PKG_CONFIG_PATH
   - GETTEXTDATADIRS: /snap/gnome-3-38-2004-sdk/current/usr/share/gettext-current:$GETTEXTDATADIRS
   - GDK_PIXBUF_MODULE_FILE: /snap/gnome-3-38-2004-sdk/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-current/loaders.cache
   - ACLOCAL_PATH: /snap/gnome-3-38-2004-sdk/current/usr/share/aclocal${ACLOCAL_PATH:+:$ACLOCAL_PATH}
   - PYTHONPATH: /snap/gnome-3-38-2004-sdk/current/usr/lib/python3.8:/snap/gnome-3-38-2004-sdk/current/usr/lib/python3/dist-packages${PYTHONPATH:+:$PYTHONPATH}

results in a failed build of the C source code (performed via cmake) in the last step during linking the executable:

/usr/bin/ld: /snap/gnome-3-38-2004-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_font_family_get_face'
/usr/bin/ld: /snap/gnome-3-38-2004-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_font_map_get_family'

I learned that cmake sets -Wl,-rpath,/snap/gnome-3-38-2004-sdk/current/usr/lib/x86_64-linux-gnu: that causes the error.

Finally I copied the output of snapcraft expand-extensions and removed the part that sets build-environment.

Just for the record – now my snap can be built properly, but maybe the gnome-3-38 extension should be fixed. Also, maybe you want to compare a previous version of snapcraft.yaml at https://github.com/kovzol/aris/commit/71f7e1c95828f3d4c53b5589ab5ac12012390381 (this was based on the kde-neon extension, but it had a different problem).

Thanks, Zoltán