Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235742 - eclass support for FEATURES="distcc" for packages with known issues
Summary: eclass support for FEATURES="distcc" for packages with known issues
Status: RESOLVED DUPLICATE of bug 28300
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Package Manager Specification
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-26 05:11 UTC by Boian Berberov
Modified: 2009-02-20 23:25 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boian Berberov 2008-08-26 05:11:22 UTC
This enhancement suggestion was inspired after reviewing the check-reqs.eclass

I propose that an eclass is created, or an existing eclass is expanded, to include a check for FEATURES="distcc" during pkg_setup.  This check would preemptively cause an ebuild to "die" with an informative error message during pkg_setup instead of having the ebuild "die" normally during src_compile.  This check should be used in ebuilds that are known to fail when compiling with distcc.  An ebuild inheriting this functionality should already have a bug opened about problems with distcc and those problems should be verified before the check is added.

The main motivation for creating this functionality is that an ebuild does not need to fail during src_compile for an already known issue.  With portage's --keep-going option, many of these errors can be ignored, but the ebuilds still proceed through src_unpack and src_compile.

I have already tested a very simple, separate eclass, but I understand that this needs to be reviewed and refined before any possible inclusion.  I welcome everyone's comments and additional suggestions.

Reproducible: Always

Steps to Reproduce:
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2008-08-26 05:56:01 UTC
Wouldn't it be easier to create a RESTRICT=distcc?
See bug #28300 and bug #80894.

Also, consider using /etc/portage/env/<cat>/<pkg> for this purpose, with each <cat>/<pkg> being a (shell script) file with an entry like FEATURES=-distcc.

Anyway, there's no time like the present to discuss this feature again. :)
Comment 2 Boian Berberov 2008-08-26 18:26:33 UTC
I do not believe you can use /etc/portage/env/<cat>/<pkg> to alter FEATURES.

I am not looking for the ability to RESTRICT or automatically detect-and-correct. Those bugs were clearly closed.

I guess my first question is should this be implemented in a new eclass or existing eclass.  What additional functionality, if any, is needed?
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2008-08-26 18:36:31 UTC
(In reply to comment #2)
> I do not believe you can use /etc/portage/env/<cat>/<pkg> to alter FEATURES.

You haven't tried it, then?
Comment 4 Zac Medico gentoo-dev 2008-08-26 19:22:09 UTC
Similar to ccache, there's no legitimate reason for a given ebuild not to work with distcc. Since it's only a compiler frontend, it's behavior should be 100% compatible with a normal compiler. Any incompatibility would either be a bug in the package's build system or else a bug in distcc itself. As such, disabling distcc only serves to hide the real problem.

(In reply to comment #2)
> I do not believe you can use /etc/portage/env/<cat>/<pkg> to alter FEATURES.

In some cases you can if you define a pre_pkg_setup function and to it there. Unfortunately, it won't work in this case because of the way that distcc is setup in /usr/lib/portage/bin/ebuild.sh. However, something like this in /etc/portage/env/<cat>/<pkg> should work:

CC=${CC#distcc }
CXX=${CXX#distcc }
Comment 5 Boian Berberov 2008-08-26 20:05:57 UTC
/etc/portage/env/<cat>/<pkg> did not work with portage-2.2_rc8 for FEATURES

I am not disputing the legitimacy of ebuilds not working with distcc.  The problems should not be hidden or ignored either.  It is just that if an ebuild is known to fail (bug opened and verified on Gentoo Bugzilla) it should fail early and with a better error message/info block.  At the very least, if the new workaround for /etc/portage/env/<cat>/<pkg> works, the ebuild should QA warn the user about the workaround.
Comment 6 Zac Medico gentoo-dev 2008-08-26 20:29:32 UTC
I'd say the ebuild should either be fixed or else some workaround should be integrated directly into the ebuild.
Comment 7 Boian Berberov 2008-08-26 21:04:13 UTC
OK, what should happen if the ebuild cannot be fixed, with or without an integrated workaround, in a reasonable amount of time, or ever?  I do not expect maintainers to fix everything, especially if it is an upstream problem like a build system problem or a bug with distcc itself.
Comment 8 Zac Medico gentoo-dev 2008-08-26 21:22:02 UTC
Well, something like this in the ebuild's src_compile should serve as a simple workaround:

CC=${CC#distcc }
CXX=${CXX#distcc }

Just file a bug and the maintainer should be able to take care of it pretty quickly. You can do it yourself in /etc/portage/env/<cat>/<pkg> as a workaround until the ebuild is fixed.
Comment 9 Boian Berberov 2008-08-27 04:13:44 UTC
The suggested workaround fails for the ebuild I test on: app-admin/keepassx-0.3.3, bug 214327
I tried:

CC=${CC#distcc }
CXX=${CXX#distcc }
emake || die "emake failed"

and:

emake CC=${CC#distcc } CXX=${CXX#distcc } || die "emake failed"

and:

CC=${CC#distcc }
CXX=${CXX#distcc }

in /etc/portage/env/app-admin/keepassx.
Comment 10 Andrew Gaffney (RETIRED) gentoo-dev 2008-08-27 12:58:45 UTC
And why exactly are you blaming distcc? Are you sure it's not just a general parallelization problem? Most problems that people blame on distcc are simply builds that break when done in parallel.
Comment 11 Boian Berberov 2008-08-27 21:53:07 UTC
I am not blaming distcc.  It is just that the flag in FEATURES is named distcc and it causes the build environment to be set up a certain way, from what I understand.

I just ran this particular ebuild with FEATURES="distcc" MAKEOPTS="-j1" and it still failed.  I do not know what else I can test for parallelism.
Comment 12 Andrew Gaffney (RETIRED) gentoo-dev 2008-08-28 00:12:17 UTC
Can you attach a build log with the failure?
Comment 13 Boian Berberov 2008-08-28 02:58:54 UTC
Sure. I am assuming you want temp/build.log for when I ran it with FEATURES="distcc" MAKEOPTS="-j1".  I will post it in bug 214327 since it is specific to that package.  If you want any additional logs for any combination of options, request it there and I will post it.

Apparently, bug 222063 already requests something very similar to what I proposed above.
Comment 14 Boian Berberov 2008-08-28 08:03:47 UTC
Build log is now posted in bug 214327.
Comment 15 Zac Medico gentoo-dev 2008-08-29 20:14:40 UTC
(In reply to comment #9)
> The suggested workaround fails for the ebuild I test on:

Okay, now I've got a workaround which I've tested on app-admin/keepassx and it really works:

PATH=${PATH#/usr/lib/distcc/bin:}

I'll go ahead and put this workaround in the ebuild for bug #214327.
Comment 16 Jeroen Roovers (RETIRED) gentoo-dev 2008-09-01 20:07:02 UTC
(In reply to comment #5)
> /etc/portage/env/<cat>/<pkg> did not work with portage-2.2_rc8 for FEATURES

Sorry. I forgot to check how exactly I use /etc/portage/env. The way I use it is like this:

jeroen@elmer ~ $ cat /etc/portage/env/media-gfx/imagemagick
FEATURES="${FEATURES/distcc/-distcc}"

That seems to do it for me. :)
Comment 17 Boian Berberov 2008-09-04 09:33:32 UTC
Great.  Now that this workaround is known to work, and it is used in at least two ebuilds, shouldn't it be documented somewhere other than bugzilla?  You could make an emake_nodistcc function, but a mention in the devmanual would be just as good I guess.

Also, I believe there should be a QA message if the workaround is used in an ebuild.  At the very least, it will bring more attention to the problem and capable users might get involved, fix the corresponding packages, and submit patches here or upstream.
Comment 18 Gordon Malm (RETIRED) gentoo-dev 2008-11-01 14:51:06 UTC
Please add RESTRICT="distcc" support to portage.  True most distcc problems are really parallel building problems.  However, there is a perfectly valid scenario for wanting to RESTRICT="distcc" in the case of kernel modules.
Comment 19 Jimmy.Jazz 2009-01-16 19:12:00 UTC
(In reply to comment #18)
> Please add RESTRICT="distcc" support to portage.  True most distcc problems are
> really parallel building problems.  However, there is a perfectly valid
> scenario for wanting to RESTRICT="distcc" in the case of kernel modules.
> 

I'm not sure the issue has something to do with parallel building. Afterall , the -j1 flag is forced in every ebuild that doesn't support parallelism.

It could be a distcc loop error during the compilation that is causing the issue. The gentoo distcc implementation isn't working for me for a while. I encountered divers problems like sandbox violations and the boring distcc error 111.

I found a way that works pretty well with -j16 for instance.

I forced the FEATURES="-distcc ccache" and  configured ccache to handle distcc. I have set the variable CCACHE_PREFIX="distcc" in /etc/env.d/02ccache

As Portage tmp directory can be set in memory (/dev/shm) it isn't permanent and distcc doesn't rebuild its directories. That's why I prefer /var/lib/cache for ccache and distcc trees.  PORTAGE_TMPDIR/.distcc is no way the best environment.

For example:
CCACHE_DIR="/var/lib/cache/ccache"
DISTCC_DIR="/var/lib/cache/distcc"

Also I initialized the distcc client with,

chown -R portage.portage /var/lib/cache/distcc
chmod g+rws /var/lib/cache/distcc
mkdir -p /var/lib/cache/distcc/state
chmod g+w /var/lib/cache/distcc/state/

otherwise it complains about wrong right settings or a state directory missing.

When using /var/lib/cache tree, it is still necessary to change your profile shell Add in your profile.bashrc,

# cat /etc/portage/profile/profile.bashrc
SANDBOX_WRITE="/var/log/ccache.log:/var/lib/cache/distcc:/var/log/distcc.log:${SANDBOX_WRITE}"

Simply writing in /var/log/distcc.log could lead to a sandbox violation :)

Also, distccd doesn't need to be configured if you use the --zeroconf option and declare some client subnets allowed to access the daemon. On the client side you have just to declare a +zeroconf host and activate avahi.

Hope that helps
Comment 20 SpanKY gentoo-dev 2009-02-20 23:25:12 UTC

*** This bug has been marked as a duplicate of bug 28300 ***