Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 437046 - dev-libs/libffi-3.0.11: ROOT != / installs fail (catalyst fails to build stage1)
Summary: dev-libs/libffi-3.0.11: ROOT != / installs fail (catalyst fails to build stage1)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 437132 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-03 08:23 UTC by Alexander Tsoy
Modified: 2012-10-04 13:46 UTC (History)
7 users (show)

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


Attachments
USE=build? (libffi-3.0.11-build.patch,872 bytes, patch)
2012-10-03 16:22 UTC, Samuli Suominen (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Tsoy 2012-10-03 08:23:48 UTC
catalyst fails to build stage1 using portage-20121002 snapshot. portage-20121001 was OK. I think this is due to this change:

  02 Oct 2012; Fabian Groffen <grobian@gentoo.org> libffi-3.0.11.ebuild:
  Fix non-fatal typo effectively disabling the link-check

Part of the error log:

>>> Failed to emerge dev-libs/libffi-3.0.11 for /tmp/stage1root/, Log file:
>>>  '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/build.log'
 * Package:    dev-libs/libffi-3.0.11
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE:        build elibc_glibc kernel_linux userland_GNU x86
 * FEATURES:   sandbox
 * The linker reported linking against -lffi to be working while it shouldn't have.
 * This is wrong and you should find and delete the old copy of libffi before continuing.
 * ERROR: dev-libs/libffi-3.0.11 failed (setup phase):
 *   The system is in inconsistent state with unknown libffi installed.
 * 
 * Call stack:
 *              ebuild.sh, line  85:  Called pkg_setup
 *   libffi-3.0.11.ebuild, line  36:  Called die
 * The specific snippet of code:
 *                      die "The system is in inconsistent state with unknown libffi installed."
 * 
 * If you need support, post the output of `emerge --info '=dev-libs/libffi-3.0.11'`,
 * the complete build log and the output of `emerge -pqv '=dev-libs/libffi-3.0.11'`.
 * The complete build log is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/die.env'.
 * Working directory: '/var/tmp/portage/dev-libs/libffi-3.0.11'
 * S: '/var/tmp/portage/dev-libs/libffi-3.0.11/work/libffi-3.0.11'

Reproducible: Always
Comment 1 Alexander Tsoy 2012-10-03 08:32:54 UTC
I've tried different seed stages with the same result: official stage3 and stage3 which I build from 20121001 snapshot. Archs: x86 and amd64.
Comment 2 Robert Piasek (RETIRED) gentoo-dev 2012-10-03 09:11:52 UTC
Same on arm.

I believe it's down to yesterday's change:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libffi/libffi-3.0.11.ebuild?r1=1.12&r2=1.13
Comment 3 Alexander Tsoy 2012-10-03 10:20:00 UTC
The simplest solution is to add "build" USE flag to libffi ebuild that disables this link-check.
Comment 4 Alexander Tsoy 2012-10-03 10:23:44 UTC
(In reply to comment #3)
> The simplest solution is to add "build" USE flag to libffi ebuild that
> disables this link-check.

But there is a chance that other stages will fail. =/
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2012-10-03 10:41:01 UTC
Question is, why in stage building the sys-devel/gcc package installs libffi to the filesystem? It shouldn't be required to be installed
Therefore "the link sanity check" should pass also during stage building...
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2012-10-03 10:42:54 UTC
(In reply to comment #5)
> Question is, why in stage building the sys-devel/gcc package installs libffi
> to the filesystem? It shouldn't be required to be installed
> Therefore "the link sanity check" should pass also during stage building...

This code is in eclass/toolchain.eclass:

<quote>
# Prevent libffi from being installed
sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
</quote>
Comment 7 Alexander Tsoy 2012-10-03 13:57:04 UTC
(In reply to comment #5)
> Question is, why in stage building the sys-devel/gcc package installs libffi
> to the filesystem? It shouldn't be required to be installed
> Therefore "the link sanity check" should pass also during stage building...

gcc doesn't install libffi. Furthermore in stage1 building libffi is installed before gcc.

While building stage1 catalyst installs all packages in /tmp/stage1root inside chroot by setting ROOT variable. So has_version() fails but linking with libffi does not (because it is available in stage3).
Comment 8 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2012-10-03 14:28:52 UTC
@grobian / @toolchain:

The change to libffi is breaking stage building.
Can we get a revert or an update to ensure stages are able to build?
Comment 9 Fabian Groffen gentoo-dev 2012-10-03 15:07:25 UTC
I just fixed a syntax error that prevented the check being run.
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2012-10-03 16:22:13 UTC
Created attachment 325602 [details, diff]
USE=build?

I'm not sure why libffi is installed from sys-devel/gcc during stage building, why isn't the code from toolchain.eclass executed to prevent it?

So this is ugly workaround and propably not suitable for tree inclusion
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2012-10-03 16:23:33 UTC
(In reply to comment #10)
> So this is ugly workaround and propably not suitable for tree inclusion

or is it? after reading Comment #7 this seems reasonable :o
Comment 12 Alexander Tsoy 2012-10-03 16:32:40 UTC
(In reply to comment #10)
> Created attachment 325602 [details, diff] [details, diff]
> USE=build?
> 

I've already started to test the same patch one hour ago =P.
Comment 13 SpanKY gentoo-dev 2012-10-03 19:12:20 UTC
(In reply to comment #10)

how about checking ROOT==/

also, that link test should use CFLAGS/LDFLAGS too ...
Comment 14 Alexander Tsoy 2012-10-03 21:13:18 UTC
(In reply to comment #13)
> (In reply to comment #10)
> 
> how about checking ROOT==/
> 

This would be better. Not only catalyst will be able to do this:

gentoo ~ # mkdir /tmp/testroot
gentoo ~ # ROOT=/tmp/testroot emerge -1q libffi

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-libs/libffi-3.0.11 for /tmp/testroot/
>>> Failed to emerge dev-libs/libffi-3.0.11 for /tmp/testroot/, Log file:
>>>  '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/build.log'
 * Package:    dev-libs/libffi-3.0.11
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE:        amd64 elibc_glibc kernel_linux multilib userland_GNU
 * FEATURES:   sandbox userpriv usersandbox
 * The linker reported linking against -lffi to be working while it shouldn't have.
 * This is wrong and you should find and delete the old copy of libffi before continuing.
 * ERROR: dev-libs/libffi-3.0.11 failed (setup phase):
 *   The system is in inconsistent state with unknown libffi installed.
 * 
 * Call stack:
 *              ebuild.sh, line  85:  Called pkg_setup
 *   libffi-3.0.11.ebuild, line  36:  Called die
 * The specific snippet of code:
 *                      die "The system is in inconsistent state with unknown libffi installed."
 * 
 * If you need support, post the output of `emerge --info '=dev-libs/libffi-3.0.11'`,
 * the complete build log and the output of `emerge -pqv '=dev-libs/libffi-3.0.11'`.
 * The complete build log is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/die.env'.
 * Working directory: '/var/tmp/portage/dev-libs/libffi-3.0.11'
 * S: '/var/tmp/portage/dev-libs/libffi-3.0.11/work/libffi-3.0.11'
Comment 15 SpanKY gentoo-dev 2012-10-04 03:52:45 UTC
*** Bug 437132 has been marked as a duplicate of this bug. ***
Comment 16 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 06:48:36 UTC
(In reply to comment #13)
> (In reply to comment #10)
> how about checking ROOT==/

Good idea

+  04 Oct 2012; Samuli Suominen <ssuominen@gentoo.org> libffi-3.0.11.ebuild:
+  Check if ${ROOT} is / or not before executing the -lffi sanity link check wrt
+  #437046

http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libffi/ChangeLog?r1=1.154&r2=1.155

> 
> also, that link test should use CFLAGS/LDFLAGS too ...

I left them out in purpose, what possible cause could they serve when all we want to know is if -lffi is linkable or not... 
(and write it in the build.log so us, maintainers, will save a lot of time figuring out lib vs. headers conflicts)
Comment 17 Alexander Tsoy 2012-10-04 08:58:07 UTC
(In reply to comment #16)
> (In reply to comment #13)
> > (In reply to comment #10)
> > how about checking ROOT==/
> 
> Good idea
> 
> +  04 Oct 2012; Samuli Suominen <ssuominen@gentoo.org> libffi-3.0.11.ebuild:
> +  Check if ${ROOT} is / or not before executing the -lffi sanity link check
> wrt
> +  #437046
> 

This expression is invalid:

if [[ ${ROOT} != / ]] || ! has_version ${CATEGORY}/${PN}; then

should be:

if [[ ${ROOT} == / ]] && ! has_version ${CATEGORY}/${PN}; then
Comment 18 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 10:12:31 UTC
(In reply to comment #17)
> (In reply to comment #16)
> > (In reply to comment #13)
> > > (In reply to comment #10)
> > > how about checking ROOT==/
> > 
> > Good idea
> > 
> > +  04 Oct 2012; Samuli Suominen <ssuominen@gentoo.org> libffi-3.0.11.ebuild:
> > +  Check if ${ROOT} is / or not before executing the -lffi sanity link check
> > wrt
> > +  #437046
> > 
> 
> This expression is invalid:
> 
> if [[ ${ROOT} != / ]] || ! has_version ${CATEGORY}/${PN}; then
> 
> should be:
> 
> if [[ ${ROOT} == / ]] && ! has_version ${CATEGORY}/${PN}; then

why? looks proper to me. the exit code for [[ ${ROOT} != / ]] is either 0 with success, or 1 with failure
then || will enter the next piece of code depending on anything else than 0

closing again...
Comment 19 Alexander Tsoy 2012-10-04 10:24:02 UTC
> why? looks proper to me. the exit code for [[ ${ROOT} != / ]] is either 0
> with success, or 1 with failure
> then || will enter the next piece of code depending on anything else than 0
> 
> closing again...

This link check should run _ONLY_ if ROOT == / _AND_ if there is no libffi installed. You can also test the change your are made as described in comment 14. It still fails.
Comment 20 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 10:32:00 UTC
(In reply to comment #19)
> > why? looks proper to me. the exit code for [[ ${ROOT} != / ]] is either 0
> > with success, or 1 with failure
> > then || will enter the next piece of code depending on anything else than 0
> > 
> > closing again...
> 
> This link check should run _ONLY_ if ROOT == / _AND_ if there is no libffi
> installed. You can also test the change your are made as described in
> comment 14. It still fails.

that's what it does now. return 0 from first check only if / is not ${ROOT} and then || won't pass it along as 0 equals true...
could test it all day and it still keeps working...
Comment 21 Alexander Tsoy 2012-10-04 10:50:36 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > > why? looks proper to me. the exit code for [[ ${ROOT} != / ]] is either 0
> > > with success, or 1 with failure
> > > then || will enter the next piece of code depending on anything else than 0
> > > 
> > > closing again...
> > 
> > This link check should run _ONLY_ if ROOT == / _AND_ if there is no libffi
> > installed. You can also test the change your are made as described in
> > comment 14. It still fails.
> 
> that's what it does now. return 0 from first check only if / is not ${ROOT}
> and then || won't pass it along as 0 equals true...
> could test it all day and it still keeps working...

# if true || true; then echo 1; fi
1
# if true || false; then echo 1; fi
1
# if false || true; then echo 1; fi
1
# if false || false; then echo 1; fi
#
Comment 22 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 11:05:19 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > (In reply to comment #19)
> > > > why? looks proper to me. the exit code for [[ ${ROOT} != / ]] is either 0
> > > > with success, or 1 with failure
> > > > then || will enter the next piece of code depending on anything else than 0
> > > > 
> > > > closing again...
> > > 
> > > This link check should run _ONLY_ if ROOT == / _AND_ if there is no libffi
> > > installed. You can also test the change your are made as described in
> > > comment 14. It still fails.
> > 
> > that's what it does now. return 0 from first check only if / is not ${ROOT}
> > and then || won't pass it along as 0 equals true...
> > could test it all day and it still keeps working...
> 
> # if true || true; then echo 1; fi
> 1
> # if true || false; then echo 1; fi
> 1
> # if false || true; then echo 1; fi
> 1
> # if false || false; then echo 1; fi
> #

$ export ROOT=/
$ [[ ${ROOT} != / ]] || echo "Entering has_version check..."
Entering has_version check...

$ export ROOT=/test
$ [[ ${ROOT} != / ]] || echo "Entering has_version check..."

ssuominen@null ~ $ export ROOT=/
ssuominen@null ~ $ [[ ${ROOT} != / ]] || false
ssuominen@null ~ $ echo $?

1
ssuominen@null ~ $ [[ ${ROOT} != / ]] || true
ssuominen@null ~ $ echo $?
0

The logic still looks solid to me.
Comment 23 Fabian Groffen gentoo-dev 2012-10-04 11:09:40 UTC
The current check runs the has_version test for ROOT != /, which means that one can return true, and hence the entire expression return true, which is not what you wanted.  Hence Alexander turned it around, so you a) benefit from the shortcut operator &&, and b) ensure you never run the check when ROOT != /.
Comment 24 Oleh 2012-10-04 11:11:42 UTC
the check added started to break stages!
Comment 25 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 11:12:43 UTC
(In reply to comment #23)
> The current check runs the has_version test for ROOT != /, which means that
> one can return true, and hence the entire expression return true, which is
> not what you wanted.  Hence Alexander turned it around, so you a) benefit
> from the shortcut operator &&, and b) ensure you never run the check when
> ROOT != /.

right.  i'm in need of more coffee I suppose ;)

changed it in tree...
Comment 26 Oleh 2012-10-04 11:14:19 UTC
 * Package:    dev-libs/libffi-3.0.11
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE:        bindist build elibc_glibc kernel_linux userland_GNU x86
 * FEATURES:   preserve-libs
 * The linker reported linking against -lffi to be working while it shouldn't have.
 * This is wrong and you should find and delete the old copy of libffi before continuing.
 * ERROR: dev-libs/libffi-3.0.11 failed (setup phase):
 *   The system is in inconsistent state with unknown libffi installed.
 *
 * Call stack:
 *              ebuild.sh, line  85:  Called pkg_setup
 *   libffi-3.0.11.ebuild, line  36:  Called die
 * The specific snippet of code:
 *                      die "The system is in inconsistent state with unknown libffi installed."
 *
 * If you need support, post the output of `emerge --info '=dev-libs/libffi-3.0.11'`,
 * the complete build log and the output of `emerge -pqv '=dev-libs/libffi-3.0.11'`.
 * The complete build log is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/libffi-3.0.11/temp/die.env'.
 * Working directory: '/var/tmp/portage/dev-libs/libffi-3.0.11'
 * S: '/var/tmp/portage/dev-libs/libffi-3.0.11/work/libffi-3.0.11'

this doesn't happen without check in ebuild
Comment 27 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 11:19:32 UTC
(In reply to comment #26)

Read the bug. You just duplicated Comment #0, that's all.
Comment 28 Oleh 2012-10-04 11:21:17 UTC
i don't know what i duplicated, your changes to libffi with ROOT check just started to break stage1 builds. Reverting it back fixed.
Comment 29 Samuli Suominen (RETIRED) gentoo-dev 2012-10-04 11:22:53 UTC
(In reply to comment #28)
> i don't know what i duplicated, your changes to libffi with ROOT check just
> started to break stage1 builds. Reverting it back fixed.

$ grep Header libffi-3.0.11.ebuild 
# $Header: /var/cvsroot/gentoo-x86/dev-libs/libffi/libffi-3.0.11.ebuild,v 1.16 2012/10/04 11:17:21

working with out of date tree?
Comment 30 Oleh 2012-10-04 13:15:18 UTC
there should be "/" in check?
Anyway such things supposed to be controlled by gentoo-releng, libffi known to make problems with updates. So before stabilization, stages should be successfully built.
Comment 31 Alexander Tsoy 2012-10-04 13:46:14 UTC
(In reply to comment #30)
> there should be "/" in check?
> Anyway such things supposed to be controlled by gentoo-releng, libffi known
> to make problems with updates. So before stabilization, stages should be
> successfully built.

This was neither update nor stabilization. Read this discussion, please.