Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 558506 - x11-libs/gtk+-2.24.28-r1 - Update immodules cache failed when $ROOT!='/'
Summary: x11-libs/gtk+-2.24.28-r1 - Update immodules cache failed when $ROOT!='/'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-23 19:36 UTC by Risimi
Modified: 2015-08-23 22:10 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
./emerge.sh --info gtk+ (file_558506.txt,6.25 KB, text/plain)
2015-08-23 20:31 UTC, Risimi
Details
sudo strace root/usr/bin/gtk-query-immodules-2.0 --update-cache (file_558506.txt,82.89 KB, text/plain)
2015-08-23 20:31 UTC, Risimi
Details
sudo GTK_EXE_PREFIX=/home/portage/bin-xlalx/root/usr strace root/usr/bin/gtk-query-immodules-2.0 --update-cache (file_558506.txt,83.61 KB, text/plain)
2015-08-23 20:32 UTC, Risimi
Details
gnome2-utils.eclass patch (gnome2-utils.eclass.patch,1.05 KB, patch)
2015-08-23 20:46 UTC, Alexandre Rostovtsev (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Risimi 2015-08-23 19:36:56 UTC
Merging x11-libs/gtk+-2.24.28-r1 as non root user and when $ROOT is not '/' installs but produces the following error:

ERROR: postinst
ERROR: x11-libs/gtk+-2.24.28-r1::gentoo failed (postinst phase):
  Update immodules cache failed (for amd64)

Call stack:
    ebuild.sh, line   93:  Called pkg_postinst
  environment, line 3957:  Called multilib_parallel_foreach_abi 'multilib_pkg_postinst'
  environment, line 3684:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib_pkg_postinst'
  environment, line 3271:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib_pkg_postinst'
  environment, line 3269:  Called _multilib_multibuild_wrapper 'multilib_pkg_postinst'
  environment, line  759:  Called multilib_pkg_postinst
  environment, line 3955:  Called die
The specific snippet of code:
          gnome2_query_immodules_gtk2 || die "Update immodules cache failed (for ${ABI})"

If you need support, post the output of `emerge --info '=x11-libs/gtk+-2.24.28-r1::gentoo'`,
the complete build log and the output of `emerge -pqv '=x11-libs/gtk+-2.24.28-r1::gentoo'`.
The complete build log is located at '/home/portage/bin-xlalx/logs/x11-libs:gtk+-2.24.28-r1:20150823-154451.log'.
The ebuild environment file is located at '/var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/temp/environment'.
Working directory: '/usr/lib64/python3.4/site-packages'
S: '/var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/work/gtk+-2.24.28'


The relevant part of the build.log:

 * Updating desktop mime database ...
 * Updating shared mime info database ...

Note that '/home/portage/bin-xlalx/root/usr/share' is not in the search path
set by the XDG_DATA_HOME and XDG_DATA_DIRS
environment variables, so applications may not
be able to find it until you set them. The
directories currently searched are:

- /var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/temp/.local/share
- /usr/local/share
- /usr/share

 * abi_x86_64.amd64: running multilib_pkg_postinst
Failed to create file '/usr/lib64/gtk-2.0/2.10.0/immodules.cache.ZQBU3X': Permission denied
 * ERROR: x11-libs/gtk+-2.24.28-r1::gentoo failed (postinst phase):
 *   Update immodules cache failed (for amd64)
 *
 * Call stack:
 *     ebuild.sh, line   93:  Called pkg_postinst
 *   environment, line 3957:  Called multilib_parallel_foreach_abi 'multilib_pkg_postinst'
 *   environment, line 3684:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib_pkg_postinst'
 *   environment, line 3271:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib_pkg_postinst'
 *   environment, line 3269:  Called _multilib_multibuild_wrapper 'multilib_pkg_postinst'
 *   environment, line  759:  Called multilib_pkg_postinst
 *   environment, line 3955:  Called die
 * The specific snippet of code:
 *           gnome2_query_immodules_gtk2 || die "Update immodules cache failed (for ${ABI})"
 *
 * If you need support, post the output of `emerge --info '=x11-libs/gtk+-2.24.28-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=x11-libs/gtk+-2.24.28-r1::gentoo'`.
 * The complete build log is located at '/home/portage/bin-xlalx/logs/x11-libs:gtk+-2.24.28-r1:20150823-154451.log'.
 * The ebuild environment file is located at '/var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/temp/environment'.
 * Working directory: '/usr/lib64/python3.4/site-packages'
 * S: '/var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/work/gtk+-2.24.28'
 * FAILED postinst: 1
>>> Regenerating /home/portage/bin-xlalx/root/etc/ld.so.cache...
/sbin/ldconfig: need absolute file name for configuration file when using -r


Possible fix:

Portage should point gtk-query-immodules to the $ROOT instead of '/' (maybe by setting correct GTK_EXE_PREFIX) or skip running it when installing to non standard location.
(I didn't checked gtk3, but the gnome2_query_immodules code looks exactly the same and will probably produce the same error.)

--- gnome2-utils.eclass.orig    2015-08-23 20:02:57.160700201 +0300
+++ gnome2-utils.eclass 2015-08-23 20:12:13.067484966 +0300
@@ -447,7 +447,12 @@
        local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0
        [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0

-       "${updater}" --update-cache
+       if [[ "$ROOT" = "/" ]]; then
+               "${updater}" --update-cache
+       else
+               ewarn "We cannot run gtk-query-immodules-2.0 (most likely ROOT!=/)"
+               ewarn "Please run '${updater} --update-cache' manually"
+       fi
 }

 # @FUNCTION: gnome2_query_immodules_gtk3
@@ -458,7 +463,12 @@
        local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0
        [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0

-       "${updater}" --update-cache
+       if [[ "$ROOT" = "/" ]]; then
+               "${updater}" --update-cache
+       else
+               ewarn "We cannot run gtk-query-immodules-3.0 (most likely ROOT!=/)"
+               ewarn "Please run '${updater} --update-cache' manually"
+       fi
 }

 # @FUNCTION: gnome2_disable_deprecation_warning
Comment 1 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-23 19:44:38 UTC
Interesting. The best solution IMHO would be to patch gtk-query-immodules-2.0 so it writes to $ROOT/usr/lib64/gtk-2.0/2.10.0/immodules.cache instead of /usr/lib64/gtk-2.0/2.10.0/immodules.cache

In fact, I am very surprised that it doesn't write to the right directory already (I thought we are passing the complete list of prefix directories to gtk's configure?)

Please emerge strace (if you haven't already) and attach the output of "strace gtk-query-immodules-2.0 --update-cache"

Also, please attach output of "emerge --info gtk+" for reference.
Comment 2 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-23 19:54:14 UTC
(In reply to Alexandre Rostovtsev from comment #1)
> Interesting. The best solution IMHO would be to patch
> gtk-query-immodules-2.0 so it writes to
> $ROOT/usr/lib64/gtk-2.0/2.10.0/immodules.cache instead of
> /usr/lib64/gtk-2.0/2.10.0/immodules.cache
> 
> In fact, I am very surprised that it doesn't write to the right directory
> already (I thought we are passing the complete list of prefix directories to
> gtk's configure?)

I am sorry, I misunderstood: you are talking about $ROOT for cross-compiling, not about prefix on another os.

Then this is a bit of a problem because with cross-compiling there is no guarantee that we can execute gtk-query-immodules-2.0 at all. And we do want to generate the cache file somehow :/
Comment 3 Risimi 2015-08-23 20:31:43 UTC
Created attachment 409974 [details]
./emerge.sh --info gtk+

./emerge.sh is copy pasted from sys-devel/crossdev package to setup crossbuild environment:

#!/bin/sh
# Copyright 2008-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

CHOST='x86_64-pc-linux-gnu'
SYSROOT='/home/portage/bin-xlalx/root'
PORTAGE_CONFIGROOT='/home/portage/bin-xlalx'
export CHOST SYSROOT PORTAGE_CONFIGROOT

# Portage defaults CBUILD to CHOST, so we have to remove CHOST
# from the env to get a "good" value for CBUILD
query_vars="CBUILD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS"
clean_vars="${query_vars} CHOST SYSROOT PORTAGE_CONFIGROOT"
eval $(env $(printf -- '-u %s ' ${clean_vars}) \
    portageq envvar -v ${query_vars} | sed s:^:_E_:)
CBUILD="${_E_CBUILD}"
BUILD_CFLAGS="${_E_CFLAGS}"
BUILD_CXXFLAGS="${_E_CXXFLAGS}"
BUILD_CPPFLAGS="${_E_CPPFLAGS}"
BUILD_LDFLAGS="${_E_LDFLAGS}"
export CBUILD BUILD_CFLAGS BUILD_CXXFLAGS BUILD_CPPFLAGS BUILD_LDFLAGS

exec emerge --root-deps=rdeps $@
Comment 4 Risimi 2015-08-23 20:31:57 UTC
Created attachment 409976 [details]
sudo strace root/usr/bin/gtk-query-immodules-2.0 --update-cache
Comment 5 Risimi 2015-08-23 20:32:11 UTC
Created attachment 409978 [details]
sudo GTK_EXE_PREFIX=/home/portage/bin-xlalx/root/usr strace root/usr/bin/gtk-query-immodules-2.0 --update-cache
Comment 6 Risimi 2015-08-23 20:34:11 UTC
(In reply to Alexandre Rostovtsev from comment #2)
It may be possible to use host's (native) gtk-query-immodules-2.0 for that.
Comment 7 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-23 20:46:17 UTC
Created attachment 409980 [details, diff]
gnome2-utils.eclass patch

Please check if this patch works for you.
Comment 8 Risimi 2015-08-23 22:00:22 UTC
(In reply to Alexandre Rostovtsev from comment #7)
The patch works great.
The immodules.cache was installed in
${ROOT}/usr/lib64/gtk-2.0/2.10.0/immodules.cache (for ABI_X86=64)
and 
${ROOT}/usr/lib32/gtk-2.0/2.10.0/immodules.cache (for ABI_X86=32)
without any (visible) issues.


Relevant part of the build.log:

 * Updating desktop mime database ...
 * Updating shared mime info database ...

Note that '/home/portage/bin-xlalx/root/usr/share' is not in the search path
set by the XDG_DATA_HOME and XDG_DATA_DIRS
environment variables, so applications may not
be able to find it until you set them. The
directories currently searched are:

- /var/tmp/portage/tmpfs/xlalx/portage/x11-libs/gtk+-2.24.28-r1/temp/.local/share
- /usr/local/share
- /usr/share

 * abi_x86_32.x86: running multilib_pkg_postinst
 * Updating gtk2 input method module cache ...
 [ ok ]
 * abi_x86_64.amd64: running multilib_pkg_postinst
 * Updating gtk2 input method module cache ...
 [ ok ]
 * Please install app-text/evince for print preview functionality.
 * Alternatively, check "gtk-print-preview-command" documentation and
 * add it to your gtkrc.
>>> x11-libs/gtk+-2.24.28-r1 merged.
>>> Regenerating /home/portage/bin-xlalx/root/etc/ld.so.cache...
Comment 9 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-23 22:10:38 UTC
Thanks a lot for reporting and testing this, committed!

https://cgit.gentoo.org/repo/gentoo.git/commit/?id=9d3858da72879dbb8550bc09f99787e6d33f4815