Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] package.env does not apply?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
setan
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2024
Posts: 77

PostPosted: Tue May 14, 2024 11:07 am    Post subject: [SOLVED] package.env does not apply? Reply with quote

I have LTO enabled by default:
Code:
$ grep FLAGS /etc/portage/make.conf
WARNING_FLAGS="${WARN_LTO}"
GRAPHITE_FLAGS="-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
COMMON_FLAGS="-march=native -O2 -pipe -flto=8 ${WARNING_FLAGS}"
CFLAGS="  ${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS=" ${COMMON_FLAGS}"
FFLAGS="  ${COMMON_FLAGS}"
LDFLAGS=" ${COMMON_FLAGS}" # added from http://yuguangzhang.com/blog/enabling-gcc-graphite-and-lto-on-gentoo/

and an env to disable it:
Code:
$ cat /etc/portage/env/no-lto.conf
CFLAGS="${CFLAGS}     -fno-lto -fno-use-linker-plugin"
CXXFLAGS="${CXXFLAGS} -fno-lto -fno-use-linker-plugin"
LDFLAGS="${LDFLAGS}   -fno-lto -fno-use-linker-plugin"

However, when I try to apply it to webkit-gtk:
Code:
$ cat /etc/portage/package.env/webkit-gtk.conf
net-libs/webkit-gtk no-lto.conf

it does not seem to have an effect:
Code:
 $ emerge --info net-libs/webkit-gtk | grep FLAGS | head -n 5
CFLAGS="  -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
CXXFLAGS="-march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FCFLAGS=" -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FFLAGS="  -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
LDFLAGS=" -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"


Does anyone know why this happens?


Last edited by setan on Wed May 15, 2024 3:19 pm; edited 3 times in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21794

PostPosted: Tue May 14, 2024 12:24 pm    Post subject: Re: package.env does not apply? Reply with quote

setan wrote:
Code:
$ grep FLAGS /etc/portage/make.conf
WARNING_FLAGS="${WARN_LTO}"
GRAPHITE_FLAGS="-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
COMMON_FLAGS="-march=native -O2 -pipe -flto=8 ${WARNING_FLAGS}"
Setting custom names like this is discouraged, due to environmental pollution. Additionally, it looks like you never use GRAPHITE_FLAGS. I suggest you expand WARNING_FLAGS inline in the one place it is used, then remove the named definition.
setan wrote:
Code:
$ cat /etc/portage/env/no-lto.conf
LDFLAGS="${LDFLAGS}cat /etc/portage/env/no-lto-plugin"
Is this a copying error? It looks like you have a shell command embedded in your environment variable, which will not work.
setan wrote:
However, when I try to apply it to webkit-gtk:
it does not seem to have an effect:
Code:
 $ emerge --info net-libs/webkit-gtk | grep FLAGS | head -n 5
CFLAGS="  -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
CXXFLAGS="-march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FCFLAGS=" -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FFLAGS="  -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
LDFLAGS=" -march=native -O2 -pipe -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
Does anyone know why this happens?
You appear to be testing this incorrectly. Remove that head and try again. For me, when I use emerge --info on a package which has a local override, I get two LDFLAGS lines: the first recaps my make.conf settings, and the second shows the actual flags used when building the package. Removing the grep reveals a header which explains that distinction.
Back to top
View user's profile Send private message
setan
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2024
Posts: 77

PostPosted: Wed May 15, 2024 9:31 am    Post subject: Re: package.env does not apply? Reply with quote

> Setting custom names like this is discouraged, due to environmental pollution. ...

I have cleaned it up, thanks. Can one split the CFLAGS to multiple lines, like with \ in bash?

> Is this a copying error?

Yes it is and I have fixed it now. The files have no newlines at the end and that produced my error.


Here is the full emerge info. I do not seem to notice the things you have pointed out.
Code:
 $ emerge --info webkit-gtk
Portage 3.0.63 (python 3.12.3-final-0, default/linux/amd64/23.0/split-usr/desktop, gcc-13, glibc-2.38-r13, 6.9.0-gentoo-my x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.9.0-gentoo-my-x86_64-11th_Gen_Intel-R-_Core-TM-_i5-1135G7_@_2.40GHz-with-glibc2.38
KiB Mem:    16063128 total,  12787224 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 15 May 2024 08:00:00 +0000
Head commit of repository gentoo: 3c825e5b5bc9be731645b33fedf9c061eecc05aa
Timestamp of repository guru: Wed, 15 May 2024 01:18:37 +0000
Head commit of repository guru: 32bc7069bba608c152421f0d74180061df4f465a

Timestamp of repository thegreatmcpain: Mon, 13 May 2024 13:33:49 +0000
Head commit of repository thegreatmcpain: 91ce86f9347c52885b54d4964db919cbc6aa3698

Timestamp of repository torbrowser: Tue, 14 May 2024 18:49:09 +0000
Head commit of repository torbrowser: 9eebda1768a50713f31bb12c881d4c12ecd9fd52

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.5::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.4.0-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r3::gentoo
dev-lang/python:           3.11.9::gentoo, 3.12.3::gentoo
dev-lang/rust-bin:         1.77.1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             17.0.6::gentoo
sys-devel/llvm:            17.0.6::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r13::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-metamanifest: yes

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

thegreatmcpain
    location: /var/db/repos/thegreatmcpain
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/thegreatmcpain.git
    masters: gentoo
    volatile: False

torbrowser
    location: /var/db/repos/torbrowser
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/torbrowser.git
    masters: gentoo
    volatile: False

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64-v3

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="  -march=native -O2 -pipe   -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.9/conf /var/lib/i2pd/certificates"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe   -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build --with-bdeps=y --complete-graph=y --jobs=7 --load-average=7.5"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS=" -march=native -O2 -pipe   -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="  -march=native -O2 -pipe   -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
GENTOO_MIRRORS="rsync://ftp.vectranet.pl/gentoo/ http://ftp.vectranet.pl/gentoo/ ftp://ftp.vectranet.pl/gentoo/"
LANG="C.utf8"
LDFLAGS=" -march=native -O2 -pipe   -flto=8 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
LEX="flex"
MAKEOPTS="--jobs=8 --load-average=12"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="a52 aac acl acpi alsa amd64 bash-completion branding bzip2 cairo cdda cdr cet crypt dbus dist-kernel dri dts dvdr elogind emacs encode exif ffmpeg flac gdbm gif gles2 gnutls gpm gui iconv icu ipv6 jpeg lcms libnotify libtirpc lto mad mng modules-sign mp3 mp4 mpeg multilib ncurses nls ogg opengl openmp pam pango pcre pdf pgo pipewire png policykit ppds profile pulseaudio qt5 qt6 readline sdl seccomp sndio sound spell split-usr ssl startup-notification svg test-rust truetype udev udisks unicode upower usb vaapi verify-sig vorbis vulkan wayland wifi wxwidgets x264 xattr xcb xft xml xv xvid xwayland zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vp2intersect avx512_vpopcntdq avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 ssse3 vpclmulqdq" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_11 python3_12" RUBY_TARGETS="ruby31" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21794

PostPosted: Wed May 15, 2024 12:17 pm    Post subject: Re: package.env does not apply? Reply with quote

setan wrote:
I have cleaned it up, thanks. Can one split the CFLAGS to multiple lines, like with \ in bash?
I don't think you should put a \ in it, but I think I have seen people write it as:
Code:
CFLAGS="-O2"
CFLAGS="${CFLAGS} -march=native"
This would allow you to split it across multiple lines, by defining each new iteration based on the prior one.
setan wrote:
Here is the full emerge info. I do not seem to notice the things you have pointed out.
That does not seem quite full. It looks to me like you do not have webkit-gtk installed at the moment, so Portage can only show you its planned flags, not the actual flags used. I don't know if emerge --info customizes the planned flags to reflect package-specific flags. If not, your output may not be useful for determining whether Portage will behave as you intend. Do you have specific evidence, such as a build log, showing that Portage did not do what you want? Alternately, can you confirm that Portage adjusts the planned flags shown here for a not-yet-installed package that uses an override?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9548
Location: beyond the rim

PostPosted: Wed May 15, 2024 1:48 pm    Post subject: Reply with quote

package.env is only applied when portage is actually processing the ebuild using bash, and IIRC that isn't done when using emerge --info.
Back to top
View user's profile Send private message
setan
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2024
Posts: 77

PostPosted: Wed May 15, 2024 3:19 pm    Post subject: Reply with quote

Genone,

You are right. I have tested that on cmatrix and this seems to be the case.

Topic solved then!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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