Re: [gentoo-dev] debug/release builds extensions/clarification proposal

2008-12-01 Thread Peter Volkov
В Пнд, 01/12/2008 в 06:16 +0100, Maciej Mrozowski пишет:
 Currently handling debug/release builds is incoherent and misleading to say 
 the least. We have got in Gentoo:

All that parts do their separate and quite a different work so I can't
say that it's incoherent (by idea at least).

 The drawbacks are as follows:
 - USE=debug is useless  when CFLAGS/LDFLAGS or FEATURES are not appropriate

USE=debug enables additional debug output or more assertions in the
code. It's hard to tell in advance in details what USE=debug does since
different packages enable different things. But generally it adds
additional code with -DDEBUG and this is independent of CFLAGS/LDFLAGS.
If you know packages where this is not true, fill bugs on them.

 - CFLAGS/LDFLAGS must be set globally when they are about to be supported
 - those who don't want to set them globally, they are forced to use (very 
 flexible and great indeed) /etc/portage/env hack - which is undocumented and 
 unsupported, because everything user set there, is not shown by emerge 
 --info, 
 thus bug reports from such machines  are not taken into consideration, as 
 virtually everything that breaks can be there

This leads me to different conclusion. I was thinking about new portage
feature: emerge --info pkg . So to make portage show not only global
information but per-package either. In many cases this will simplify
analyzing of the problem.

 - too much choice leads to confusion

That's always true. But we use Gentoo because we enjoy our freedom to
choose... Rigth? :)

 Implementation is trivial - eclass would be responsible for handling 
 USE=debug 
 flag, when debug is set:
 - replace CFLAGS with CFLAGS_DEBUG, LDFLAGS with LDFLAGS_DEBUG and possibly 
 others
 - replace FEATURES with FEATURES_DEBUG

USE flags should never change {C,LD}FLAGS or FEATURES as they are
different things and such relation between USE flags, {C,LD}FLAGS and/or
FEATURES will lead to even more confusion. (also there is complexity
Duncan told you about...)

Personally to get build with symbols I use a trivial wrapper around
emerge:

demerge() {
  env USE=debug CFLAGS=-O2 -pipe -g -ggdb PKGDIR=/vt/binpkg-debug \
  FEATURES=buildpkg splitdebug collision-protect ccache noclean 
installsources \
emerge $@
}

and I use demerge whenever I need to debug package. I'm sure this is
just a quick hack which could be greatly improved to track which
packages are installed with or without symbols. But you got an idea:
such thing are better to do with separate, but very tiny and simple
wrappers.

P.S. I remember most of this was already discussed in this mailing list.
Try to search it and you'll find much more ideas and motivations.

-- 
Peter.




Re: [gentoo-dev] debug/release builds extensions/clarification proposal

2008-12-01 Thread Marius Mauch
On Mon, 01 Dec 2008 11:39:35 +0300
Peter Volkov [EMAIL PROTECTED] wrote:

 This leads me to different conclusion. I was thinking about new
 portage feature: emerge --info pkg . So to make portage show not
 only global information but per-package either. In many cases this
 will simplify analyzing of the problem.

That feature already exists (for installed packages at least).

Marius



[gentoo-dev] debug/release builds extensions/clarification proposal

2008-11-30 Thread Maciej Mrozowski
Hi

I would like to give some idea into consideration.

Abstract
In short, adding following new variables to make.conf and implement handling 
of them in eclasses:
- CFLAGS_DEBUG (and friends like CXXFLAGS_DEBUG) - use defined debug compiler 
flags - by default set to -O0 -ggdb (and maybe -Wall as well)
- LDFLAGS_DEBUG - user defined debug linker flags - default to ${LDFLAGS}
- FEATURES_DEBUG - default to ${FEATURES} nostrip (or splidebug, according 
to preference)

Background
Currently handling debug/release builds is incoherent and misleading to say 
the least. We have got in Gentoo:
- CFLAGS/LDFLAGS - user needs to take care of adding -O0 and/or -ggdb
- user needs to take care of FEATURES=nostrip or FEATURES=splitdebug (not 
both)
- user may set debug USE flag

The drawbacks are as follows:
- USE=debug is useless  when CFLAGS/LDFLAGS or FEATURES are not appropriate
- CFLAGS/LDFLAGS must be set globally when they are about to be supported
- those who don't want to set them globally, they are forced to use (very 
flexible and great indeed) /etc/portage/env hack - which is undocumented and 
unsupported, because everything user set there, is not shown by emerge --info, 
thus bug reports from such machines  are not taken into consideration, as 
virtually everything that breaks can be there
- too much choice leads to confusion, and many users who enabled some of those 
(but not all), still don't get useful backtraces and only fool themselves when 
reporting something upstream.

Motivation:
The idea is modeled after handling such situations in CMake build system. I'm 
one of contributors to official Gentoo KDE team experimental overlay (kde-
crazy) and we provide live ebuilds and betas/snapshots for KDE4 and related 
applications. It's quite probable that many of our users participate in KDE 
testing, it's vital to provide for them an easy way of setting up testing box 
(though it's not the motive here).
KDE4 uses CMake as build system and CMake out-of-the-box provides build 
configurations: Release, Debug, RelWithDebInfo, MinSizeRel (one can easily 
figure out what they mean). For typical use, user doesn't want nor needs more 
than two configurations - let's call them Release and Debug - it fits in 
existing USE=debug handling scheme, where there are two build types with 
release as default. Overlay team and Gentoo KDE developers already make use 
of this feature and we provide debug USE flag for all KDE4 packages. The 
motive is to make handling build type in more coherent, predictable and less 
confusing way and I guess this proposal addresses it quite well.

Implementation:
Implementation would be provided by build system eclasses - for far cmake 
eclasses could benefit from this extension, though new USE=debug capable 
eclass could be introduced for other build systems (including autotools). 
Implementation is trivial - eclass would be responsible for handling USE=debug 
flag, when debug is set:
- replace CFLAGS with CFLAGS_DEBUG, LDFLAGS with LDFLAGS_DEBUG and possibly 
others
- replace FEATURES with FEATURES_DEBUG
Implementation could as well automatically add debug to IUSE as well - 
specific packages that are not interested in such flag - would just override 
IUSE in its ebuilds.
For cmake-utils - handling debug IUSE is already done, only replacing 
CFLAGS/LDFLAGS/FEATURES would be requited.
For autoconf based packages - some of them already provide 'support' for debug 
builds ('a'ka --enable-debug), but making use of debug USE would need special 
support here or separate eclass that could be introduced for packages that can 
benefit. If could be as well enforced globally (by adding either --enable-
debug or --disable-debug apart from switching CFLAGS - as confgiure scipt 
ignores unknown arguments) but that's just a matter or implementation.

Backward compatibility
As extension operates on newly introduced variables - backward compatibility 
is preserved. Backward compatibility may be broken for those who utilize 
/etc/portage/env hack as strange compiler/iinker flag/FEATURE combinations may 
appear.

In similar scheme more build profiles could be implemented, (like libs/apps 
ready for profiling) but let's leave it alone for now.

Discussion and constructive criticism is welcome :)

-- 
regards
MM



signature.asc
Description: This is a digitally signed message part.