Gentoo Archives: gentoo-dev

From: Peter Volkov <pva@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] debug/release builds extensions/clarification proposal
Date: Mon, 01 Dec 2008 08:40:15
Message-Id: 1228120775.25651.320.camel@localhost
In Reply to: [gentoo-dev] debug/release builds extensions/clarification proposal by Maciej Mrozowski
1 В Пнд, 01/12/2008 в 06:16 +0100, Maciej Mrozowski пишет:
2 > Currently handling debug/release builds is incoherent and misleading to say
3 > the least. We have got in Gentoo:
4
5 All that parts do their separate and quite a different work so I can't
6 say that it's incoherent (by idea at least).
7
8 > The drawbacks are as follows:
9 > - USE=debug is useless when CFLAGS/LDFLAGS or FEATURES are not appropriate
10
11 USE=debug enables additional debug output or more assertions in the
12 code. It's hard to tell in advance in details what USE=debug does since
13 different packages enable different things. But generally it adds
14 additional code with -DDEBUG and this is independent of CFLAGS/LDFLAGS.
15 If you know packages where this is not true, fill bugs on them.
16
17 > - CFLAGS/LDFLAGS must be set globally when they are about to be "supported"
18 > - those who don't want to set them globally, they are forced to use (very
19 > flexible and great indeed) /etc/portage/env hack - which is undocumented and
20 > unsupported, because everything user set there, is not shown by emerge --info,
21 > thus bug reports from such machines are not taken into consideration, as
22 > virtually everything that breaks can be there
23
24 This leads me to different conclusion. I was thinking about new portage
25 feature: emerge --info <pkg> . So to make portage show not only global
26 information but per-package either. In many cases this will simplify
27 analyzing of the problem.
28
29 > - too much choice leads to confusion
30
31 That's always true. But we use Gentoo because we enjoy our freedom to
32 choose... Rigth? :)
33
34 > Implementation is trivial - eclass would be responsible for handling USE=debug
35 > flag, when debug is set:
36 > - replace CFLAGS with CFLAGS_DEBUG, LDFLAGS with LDFLAGS_DEBUG and possibly
37 > others
38 > - replace FEATURES with FEATURES_DEBUG
39
40 USE flags should never change {C,LD}FLAGS or FEATURES as they are
41 different things and such relation between USE flags, {C,LD}FLAGS and/or
42 FEATURES will lead to even more confusion. (also there is complexity
43 Duncan told you about...)
44
45 Personally to get build with symbols I use a trivial wrapper around
46 emerge:
47
48 demerge() {
49 env USE="debug" CFLAGS="-O2 -pipe -g -ggdb" PKGDIR="/vt/binpkg-debug" \
50 FEATURES="buildpkg splitdebug collision-protect ccache noclean installsources" \
51 emerge "$@"
52 }
53
54 and I use demerge whenever I need to debug package. I'm sure this is
55 just a quick hack which could be greatly improved to track which
56 packages are installed with or without symbols. But you got an idea:
57 such thing are better to do with separate, but very tiny and simple
58 wrappers.
59
60 P.S. I remember most of this was already discussed in this mailing list.
61 Try to search it and you'll find much more ideas and motivations.
62
63 --
64 Peter.

Replies