Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LTO/Graphite
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
freke
Guru
Guru


Joined: 23 Jan 2003
Posts: 402
Location: Somewhere in Denmark

PostPosted: Sun Mar 03, 2019 5:58 pm    Post subject: LTO/Graphite Reply with quote

Installing a new small headless server I was wondering - is this sane/correct for enabling LTO/Graphite?

Code:
GRAPHITE="-fgraphite-identity -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block"
LTO="-flto=5 -fuse-linker-plugin -fno-fat-lto-objects"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer ${LTO} ${GRAPHITE} -ftree-vectorize"
CXXFLAGS="${CFLAGS} -fno-delete-null-pointer-checks -flifetime-dse=1"
LDFLAGS="-Wl,-O1 -Wl,--as-needed ${CXXFLAGS}"
AR="gcc-ar"
NM="gcc-nm"
RANLIB="gcc-ranlib"


I have graphite and lto in useflags - and using package.env for the few packages not building with lto/graphite.

Am I doing it correct - or missing something?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13498

PostPosted: Sun Mar 03, 2019 6:56 pm    Post subject: Reply with quote

Assuming that is make.conf, you are doing it incorrectly. You should not create variables named GRAPHITE, LTO, or any other non-standard names. Variables you define here are placed in the build environment. Some custom variable names collide with sloppy build systems, which leads to weird errors. (The most memorable to me is SYSTEM causing bizarre messages.) Stick to the well known variable names. If you want to split out special purpose flags, do it like this:
Code:
# Regular flags
CFLAGS="-O2"
# Graphite-specific CFLAGS
CFLAGS="${CFLAGS} -fgraphite-identity"
Then comment out the latter line if you want to turn off graphite. This lets you keep graphite flags on a separate line, but avoids using custom names.
Back to top
View user's profile Send private message
freke
Guru
Guru


Joined: 23 Jan 2003
Posts: 402
Location: Somewhere in Denmark

PostPosted: Sun Mar 03, 2019 7:28 pm    Post subject: Reply with quote

Thanks for the input - isn't the new(est/ish) minimal doing the same though?

It now define COMMON_FLAGS in make.conf and use that in CFLAGS and CXXFLAGS - previosuly I'm qui9te sure it was normally CXXFLAGS used ${CFGLAGS}?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13498

PostPosted: Sun Mar 03, 2019 8:14 pm    Post subject: Reply with quote

I haven't looked at the latest reference image. If it is as you say, then I would say that it too is wrong. The problem can be mitigated by choosing names unlikely to collide with upstream build systems, but for best results, I would avoid using any non-standard names.
Back to top
View user's profile Send private message
freke
Guru
Guru


Joined: 23 Jan 2003
Posts: 402
Location: Somewhere in Denmark

PostPosted: Sun Mar 03, 2019 8:33 pm    Post subject: Reply with quote

This is from my latest install with minimal image (install-amd64-minimal-20190226T214503Z.iso);

make.conf
Code:

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

# EMERGE_DEFAULT_OPTS is set automatically by livecd-tools autoconfig during first live boot.
# This should be equal to number of processors, see "man emerge" for details.
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=4 --load-average=4"


FCFLAGS and FFLAGS is also new to me...
Back to top
View user's profile Send private message
NTU
Apprentice
Apprentice


Joined: 17 Jul 2015
Posts: 163

PostPosted: Thu Mar 28, 2019 5:50 am    Post subject: Reply with quote

Hu wrote:
Assuming that is make.conf, you are doing it incorrectly. You should not create variables named GRAPHITE, LTO, or any other non-standard names. Variables you define here are placed in the build environment. Some custom variable names collide with sloppy build systems, which leads to weird errors. (The most memorable to me is SYSTEM causing bizarre messages.) Stick to the well known variable names. If you want to split out special purpose flags, do it like this:
Code:
# Regular flags
CFLAGS="-O2"
# Graphite-specific CFLAGS
CFLAGS="${CFLAGS} -fgraphite-identity"
Then comment out the latter line if you want to turn off graphite. This lets you keep graphite flags on a separate line, but avoids using custom names.

As long as you're using quotes and brackets properly, using custom variables shouldn't be an issue. Are you sure this is a problem? Now if you do something along the lines of:
Code:
A="'-"
B="f"
C="s"
D="t"
E="a"
F="c"
G="k"
H='-'
I="p"
J="r"
K="o"
L="t"
M="e"
N="c"
O="t"
P="o"
Q="r"
S='-'
T="s"
U="t"
V="r"
W="o"
X="n"
Y="g"
Z="'"
CFLAGS="${A}${B}${C}${D}${E}${F}${G}${H}${I}${J}${K}${L}${M}${N}${O}${P}${Q}${R}${S}${T}${U}${V}${W}${X}${Y}${Z}"
Then you're asking for trouble.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13498

PostPosted: Fri Mar 29, 2019 1:35 am    Post subject: Reply with quote

NTU wrote:
As long as you're using quotes and brackets properly, using custom variables shouldn't be an issue. Are you sure this is a problem?
Yes, I am sure. It is not an issue for the Portage parser. It is an issue because Portage exports all these variables into the environment, where upstream build systems can see them and choke on them. I have seen more than one person post weird failures that were ultimately traced to environmental pollution due to custom names in /etc/portage/make.conf. The most popular misuse is, as I wrote above, SYSTEM. If I recall correctly, that one confuses OpenSSL due to this silliness in its config script:
Code:
config:[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
It assumes that if $SYSTEM is defined, you want to use that in preference to the output of uname -s. If $SYSTEM is not something that uname -s would print, the script gets confused.
Back to top
View user's profile Send private message
NTU
Apprentice
Apprentice


Joined: 17 Jul 2015
Posts: 163

PostPosted: Fri Mar 29, 2019 10:33 pm    Post subject: Reply with quote

Hu wrote:
NTU wrote:
As long as you're using quotes and brackets properly, using custom variables shouldn't be an issue. Are you sure this is a problem?
Yes, I am sure. It is not an issue for the Portage parser. It is an issue because Portage exports all these variables into the environment, where upstream build systems can see them and choke on them. I have seen more than one person post weird failures that were ultimately traced to environmental pollution due to custom names in /etc/portage/make.conf. The most popular misuse is, as I wrote above, SYSTEM. If I recall correctly, that one confuses OpenSSL due to this silliness in its config script:
Code:
config:[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
It assumes that if $SYSTEM is defined, you want to use that in preference to the output of uname -s. If $SYSTEM is not something that uname -s would print, the script gets confused.

Oh that makes sense! Hey, good to know though that packages can accept input from make.conf as variables. That means that you can modify the "PATH" variable on a per-package basis using package.env -- the amount of damage you could do with cross compiling!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum