Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 681676 - Possible improvement to Portage's example configuration /usr/share/portage/config/make.conf.example
Summary: Possible improvement to Portage's example configuration /usr/share/portage/co...
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Documentation (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-24 18:15 UTC by OzTiram
Modified: 2020-02-02 01:51 UTC (History)
1 user (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 OzTiram 2019-03-24 18:15:33 UTC
I believe the configuration is misleading users to override profiles.
I have installed gentoo a couple of times and every time I have consulted the above mentioned file.

As a result my make.conf, contained CFLAGS like this:

CFLAGS="-O2 -pipe -march=native"


The first two options are by coincidence also set by 

/usr/portage/profiles/arch/amd64/make.defaults:CFLAGS="-O2 -pipe"

So I never noticed it's a problem. But switching to another profile means my hard coded CFLAGS ignore those from the profile. Here is a demo:

$ grep -r CFLAGS /etc/portage/make.conf 
#CFLAGS="${CFLAGS} -march=native"
CFLAGS="-march=native"
CXXFLAGS=${CFLAGS}
oznt@yeni2 ~/Software/tiny-cms $ sudo emerge figlet
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) app-misc/figlet-2.2.5::gentoo
 * figlet-2.2.5.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                       [ ok ]
>>> Unpacking source...
>>> Unpacking figlet-2.2.5.tar.gz to /var/tmp/portage/app-misc/figlet-2.2.5/work
>>> Source unpacked in /var/tmp/portage/app-misc/figlet-2.2.5/work
>>> Preparing source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
make -j3 clean 
rm -f *.o *~ core figlet chkfont
make -j3 CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-gcc CFLAGS=-march=native 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' prefix=/usr all 
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o figlet.o figlet.c
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o zipio.o zipio.c
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o crc.o crc.c
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o inflate.o inflate.c
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o utf8.o utf8.c
x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o chkfont.o chkfont.c
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o figlet figlet.o zipio.o crc.o inflate.o utf8.o
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o chkfont chkfont.o
>>> Source compiled.
>>> Test phase [not enabled]: app-misc/figlet-2.2.5

>>> Install figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ category app-misc
make -j3 DESTDIR=/var/tmp/portage/app-misc/figlet-2.2.5/image/ BINDIR=/usr/bin MANDIR=/usr/share/man prefix=/usr install 
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
cp figlet chkfont figlist showfigfonts /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin
cp figlet.6 chkfont.6 figlist.6 showfigfonts.6 /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6
cp fonts/*.flf /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
cp fonts/*.flc /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
>>> Completed installing figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/


Figlet is compiled just with "-march=native" no options from my profile.
Changing CFLAGS:

$ grep -r CFLAGS /etc/portage/make.conf 
CFLAGS="${CFLAGS} -march=native"
#CFLAGS="-march=native"
CXXFLAGS=${CFLAGS}
$ sudo emerge figlet
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) app-misc/figlet-2.2.5::gentoo
 * figlet-2.2.5.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                       [ ok ]
>>> Unpacking source...
>>> Unpacking figlet-2.2.5.tar.gz to /var/tmp/portage/app-misc/figlet-2.2.5/work
>>> Source unpacked in /var/tmp/portage/app-misc/figlet-2.2.5/work
>>> Preparing source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ...
make -j3 clean 
rm -f *.o *~ core figlet chkfont
make -j3 CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-gcc 'CFLAGS=-O2 -pipe -march=native' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' prefix=/usr all 
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o figlet.o figlet.c
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o zipio.o zipio.c
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o crc.o crc.c
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o inflate.o inflate.c
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o utf8.o utf8.c
x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \
	-DDEFAULTFONTFILE=\"standard\" -o chkfont.o chkfont.c
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o chkfont chkfont.o
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o figlet figlet.o zipio.o crc.o inflate.o utf8.o
>>> Source compiled.
>>> Test phase [not enabled]: app-misc/figlet-2.2.5

>>> Install figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ category app-misc
make -j3 DESTDIR=/var/tmp/portage/app-misc/figlet-2.2.5/image/ BINDIR=/usr/bin MANDIR=/usr/share/man prefix=/usr install 
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6
mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
cp figlet chkfont figlist showfigfonts /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin
cp figlet.6 chkfont.6 figlist.6 showfigfonts.6 /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6
cp fonts/*.flf /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
cp fonts/*.flc /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet
>>> Completed installing figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/


Now figlet is compiled with CFLAGS from __both__ my /etc/portage/make.conf and from /usr/portage/profiles/arch/amd64/make.defaults.

Hence, I believe the  CFLAGS shown after "Decent Examples:" in the file /usr/share/portage/config/make.conf.example should be changed to:

 #CFLAGS="${CFLAGS} -mtune=k8 -O2 -pipe"                                                                                                                                                               
 #CFLAGS="${CFLAGS} -march=athlon64 -O2 -pipe

or even better, explain that setting CFLAGS without a refernece to ${CFLAGS} would override everything set by the select gentoo profile.
Comment 1 Zac Medico gentoo-dev 2019-04-01 07:24:47 UTC
It's misleading if you assume that CFLAGS is an "incremental" variable like FEATURES or USE. Most variables are not incremental variables.

I'm not sure that it's a good idea to reference the profile CFLAGS setting in your CFLAGS setting. Having your CFLAGS be sensitive to profile changes could potentially have both positive and negative consequences.
Comment 2 OzTiram 2019-09-02 10:30:13 UTC
Hi, 

Thanks for the reply.

So, can you explain when are the profile flags used? My example shows that they are not used. Therefore, I don't understand if I don't set $CFLAGS before my own why do I need to set a profile if it is ignored?
Comment 3 Michael 'veremitz' Everitt 2020-02-02 01:51:37 UTC
Hang on a minute. Handbook says we should set CFLAGS (or more recently COMMON_FLAGS) and yet we shouldn't be overriding profile defaults in our make.conf? And is there reasonable consistency between the default make.conf created by catalyst here for the installation stages?!
A bit of clarification would be good here, as the OP's example config further confuses the issue.