You are not logged in.
A recent thread made me aware that setting the GCC_COLORS variable causes gcc to colorize output during compilation which is nice. If I build with makechrootpkg from devtools, how can I have this variable exported so that the build script sees it when building?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Good question.
EDIT: off-topic
Last edited by parchedas (2014-11-08 22:31:28)
Offline
I don't use makechrootpkg, but doesn't makepkg still parse makepkg.conf?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
@Trilby - Yes, that's the ticket I think.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Nope, the export within the makepkg.conf works outside of the chroot, but not within the chroot.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Don't export the variable, put the command line option into the FLAGS.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I could but why does it work outside of the chroot exporting it?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
I think it is because it uses some sudo in there which discards env variables.
As a test I added
Defaults env_keep += "PKGDEST"
to /etc/sudoers and that made it all the way through extra-x86_64-build->makechootpkg ...
so try adding GCC_COLORS, it's a bit hacky though IMO
Last edited by parchedas (2014-11-09 01:12:16)
Offline
The easiest thing to do is just modify the CFLAGS in the chroot... I leave this it marked unsolved since my original question remains open. Thanks to all who replied.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Another option is, because makechrootpkg recalls itself with sudo anyway, to call it with sudo to start with while passing in env variable.
i.e., this works for setting the packager
sudo PACKAGER="My Name" makechrootpkg
so I assume it would work for any env variable.
Offline
Even if you do get GCC_COLORS=anything into the environment, this is only the equivalent of adding -fdiagnostics-color=auto to your CFLAGS. I suspect the test implied by "auto" fails when we involve nspawn and so you still have no color. The correct thing to do in this specific case is to add -fdiagnostics-color=always to your chroot image's CFLAGS in /etc/makepkg.conf.
In the general case, you can pass environment through to makepkg from makechrootpkg by just appending it after the end of options delimiter, i.e.
$ makechrootpkg -r /build/extra-x86_64 -- GCC_COLORS=1
And this Just Works™ because of handling in makepkg
Last edited by falconindy (2014-11-10 04:18:55)
Offline
In the general case, you can pass environment through to makepkg from makechrootpkg by just appending it after the end of options delimiter, i.e.
$ makechrootpkg -r /build/extra-x86_64 -- GCC_COLORS=1
And this Just Works™ because of handling in makepkg
That would be great but that doesn't seem to be in pacman from [core], unless I'm doing something stupid?
EDIT: Nope, I'm not, that patch was added after the last release of pacman 17 months ago.
Last edited by parchedas (2014-11-12 01:01:39)
Offline
hmmm... i have the same question/problem.
I made my root with the following..
mkarchroot -C /etc/pacman.conf -M /etc/makepkg.conf $CHROOT/root base-devel
which presumably means that makepkg will read the vars in the copy of /etc/makepkg.conf it makes... and I can confirm that the vars are correct. But when it compiles is uses the default "march=x86_64" rather that the "march=sandybridge" that is in the choot makepkg. I tried passing "--config /mymakepkg.conf" but that did't work either. I then tried (after reading this) to pass the args on the command...
makechrootpkg -r $CHROOT -- CFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe" CXXFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe"
and that did nothing either.
I have no idea where the chrooted makepkg is getting these defauls values from.
in addition, the output shows
g++ -c -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 .....
which is odd as is has "-pipe -O2" in there twice.
The same makepkg.conf works fine outside of chroot. Unfortuantely some apps absolutely will not compile unless in chroot (like Firefox)
Am I missing something obvious here? Or is there another way to make the chooted makepkg use the vars I want?
Thanks
p.s. I stand corrected. Even outside the chroot the flags get changed back to teh defaults
heres the section I edited
#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="x86_64"
CHOST="x86_64-unknown-linux-gnu"
CFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe"
CXXFLAGS="-march=sandybridge -mtune=sandybridge -O3 -pipe"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
MAKEFLAGS="-j5"
The Makefile lines that is generated is ...
CFLAGS = -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
CXXFLAGS = -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
Sooo... where is it getting these values from ?
FYI, other packages work just fine
gcc -march=sandybridge -mtune=sandybridge -O3 -pipe -Wl,-O1,--sort-common,--as-needed,-z,relro -o termidx termidx.o -lncurses -lutil
Is it the case that SOME packages disregard the makepkg.conf?
Last edited by ntisithoj (2015-03-09 08:17:29)
Offline