Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 444238 - sys-kernel/linux-headers: setting out-of-tree vars breaks the build
Summary: sys-kernel/linux-headers: setting out-of-tree vars breaks the build
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Miscellaneous
Depends on:
Reported: 2012-11-21 21:43 UTC by Markus Rathgeb
Modified: 2015-08-14 08:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

Console output (console-output.txt,21.59 KB, text/plain)
2012-11-21 21:43 UTC, Markus Rathgeb
Build log file (build.log,5.79 KB, text/plain)
2012-11-21 21:44 UTC, Markus Rathgeb
Verbose emerge info (emerge-info-verbose.txt,17.53 KB, text/plain)
2012-11-22 07:09 UTC, Markus Rathgeb

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Rathgeb 2012-11-21 21:43:40 UTC
Created attachment 330176 [details]
Console output

Is it possible, that I cannot merge the "linux-headers" package, if I build my kernel in a separate build directory with a unprivileged user?

Have I to add the build directory to a special list of directories portage could write to?
Why must portage write to that directory?

The console output (and logs) will be attached.

The latest kernel was build with using this build directory:
Comment 1 Markus Rathgeb 2012-11-21 21:44:31 UTC
Created attachment 330178 [details]
Build log file
Comment 2 Markus Rathgeb 2012-11-21 21:45:40 UTC
emerge --info '=sys-kernel/linux-headers-3.6'

Portage 2.2.0_alpha142 (default/linux/x86/10.0, gcc-4.6.3, glibc-2.16.0, 3.5.0-gentoo i686)
                         System Settings
System uname: Linux-3.5.0-gentoo-i686-AMD_Athlon-tm-_7750_Dual-Core_Processor-with-gentoo-2.2
Timestamp of tree: Mon, 19 Nov 2012 16:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.5
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo roslin maggu2810-overlay rion systemd vdr-devel raiagent local_overlay
Installed sets: @embedded, @mjr_av, @mjr_dev, @mjr_dev-c, @mjr_dev-java, @mjr_dev-mono, @mjr_encoding, @mjr_fs-utils, @mjr_gaming_emu, @mjr_gnome-individual, @mjr_gstreamer, @mjr_images, @mjr_kde, @mjr_net-utils, @mjr_network-share, @mjr_portage-utils, @mjr_pulseaudio, @mjr_qtcurve, @mjr_vcs, @mjr_vdr, @mjr_web, @mjr_xutils, @system
CFLAGS="-O2 -march=i686 -pipe -O2 -march=native -pipe -ggdb"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
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="-O2 -march=i686 -pipe -O2 -march=native -pipe -ggdb"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -march=i686 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en de"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/roslin /var/lib/layman/maggu2810-overlay /var/lib/layman/rion /var/lib/layman/systemd /var/lib/layman/vdr-devel /var/lib/layman/raiagent /usr/local/portage/overlay"
USE="3dnow 3dnowext 3dnowprefetch 7zip X a52 aac aacplus aalib accessibility acl acpi aften aiglx aim alsa amarok amr amrnb amrwb apache2 apng asf ass audiofile avahi bash-completion berkdb bitmap-fonts blas bluetooth bluray bonjour bzip2 cairo cdaudio cdda cddax cddb cdio cdparanoia cdr cgi chm chroot cjk cli consolekit cracklib crypt css cups curl curlwrappers cvs cxx daap dbus device-mapper dhcp dirac divx djvu dri dts dv dvb dvd dvdnav dvdr dvdread dvi encode exif faac faad fam fame farstream festival ffmpeg flac flash fmod fontconfig fortran freetype freetype2 frei0r ftp fuse g3dvl gd gdbm gif gimp git glitz gmedia gnokii gnome gnome-keyring gphoto2 gpm graphviz gs gsm gstreamer gtk gtk2 gtk3 howl-compat httpnet iconv icq icu id3tag idn ieee1394 imagemagick imlib inkjar ipod ipv6 irda irmc jabber java javamail javascript jingle joystick jpeg jpeg2k kde kipi konqueror kpathsea kvm l7filter ladspa lame lapack lastfm latex lcms libass libgcrypt libkms libnotify libsamplerate libshout libv4l libv4l2 lirc live logitech-mouse logrotate loop-aes lvm lzma lzo mad matroska mbrola mdnsresponder-compat mercurial midi mikmod mime mjpeg mmx mmxext mng mod modules mono mp2 mp3 mp4 mp4live mpeg mpegts mplayer msn mudflap musepack musicbrainz ncurses network networking networkmanager nfs nls nptl nptlonly nsplugin ntfs nut obex ocr ofr ogg ogm openal opencl opencore-amr openexr opengl openmp openssl openvg opus osc oscar otr pae pam pcm pcmcia pcre pdf phonon php plasma plotutils png pnm policykit postscript ppds pppd pulseaudio pvr python python3 qemu qt qt-dbus qt-webkit qt3support qt4 quicktime rar readline realmedia rtmp rtsp samba scanner schroedinger sdl session shorten sms sndfile sound soundtouch sox speex spell spice sql sqlite sqlite3 srt sse sse2 sse4a ssl stream streamripper subversion svg svm sysfs systemd taglib tagwriting tcl tcltk tcpd telepathy theora threads threadsafe tidy tiff timidity tk truetype truetype-fonts twolame type1-fonts udev udisks unicode upnp upower usb userlocales v4l v4l2 vaapi vcd vcdinfo vcdx vdpau vhook video videos vorbis vpx wavpack wayland webdav webgl webkit webm webp wifi wiimote win32codecs wma wmf wmp x264 x86 xattr xcb xcomposite xinerama xml xorg xosd xpm xrandr xscreensaver xv xvid xvmc yahoo zeroconf zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias authn_alias authn_core authz_core cgi cgid socache_shmcb unixd" APACHE2_MPMS="worker" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="pvrusb2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" LIRC_DEVICES="devinput" PHP_TARGETS="php5-3" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 3 Markus Rathgeb 2012-11-21 21:46:11 UTC
emerge -pqv '=sys-kernel/linux-headers-3.6'

[ebuild     U ] sys-kernel/linux-headers-3.6 [3.5]
Comment 4 SpanKY gentoo-dev 2012-11-22 06:33:32 UTC
post `emerge --info --verbose` as an attachment

i'm guessing you're setting $O or $KBUILD_OUTPUT or something ?
Comment 5 Markus Rathgeb 2012-11-22 07:09:36 UTC
Created attachment 330208 [details]
Verbose emerge info
Comment 6 Markus Rathgeb 2012-11-22 07:13:08 UTC
Yes, ATM I set the KBUILD_OUTPUT environment variable to the directory that contains my build directory through the portage bashrc stuff.

/etc/portage/bashrc:export KBUILD_OUTPUT="/home/maggu2810/workspace/build/$(readlink /usr/src/linux)"

This is necessary to build modules.
Is this forbidden for the linux-headers?
Comment 7 SpanKY gentoo-dev 2012-11-22 16:48:36 UTC
(In reply to comment #6)

bashrc gets re-sourced multiple times.  the eclass already unsets it, but that works if you set KBUILD_OUTPUT via make.conf (which is the expectation).  i don't think setting it vai bashrc is supported.
Comment 8 Markus Rathgeb 2012-11-22 20:07:52 UTC
export KBUILD_OUTPUT="/home/maggu2810/workspace/build/$(readlink /usr/src/linux)"

I am using the bashrc because I could use the 'readlink /usr/src/linux' stuff, so I could update the kernel and build it to the correspondent build directory (for the version) without editing make.conf again etc.

I am right, that there is no way to execute commands while make.conf is sourced?

Could you give me a hint how I could easily manage that?
Comment 9 Markus Rathgeb 2012-11-22 21:19:07 UTC
Okay, I will set the following line in my make.conf and do not use /usr/src/linux anymore. Instead of that linux in my build directory will be a symbolic link to the current build directory.


Thanks for your help!
Comment 10 Markus Rathgeb 2012-11-22 21:50:21 UTC
So, could we close this bug with the following notes?

Setting KBUILD_OUTPUT via /etc/portage/bashrc breaks sys-kernel/linux-headers.

Setting KBUILD_OUTPUT via /etc/portage/bashrc is not supported.
Comment 11 SpanKY gentoo-dev 2012-11-23 04:59:46 UTC
(In reply to comment #10)

well, this isn't specific to linux-headers.  there are a lot of ebuilds that assume the environment between phases won't be messed with.  bashrc violates that assumption which means it's up to users to make sure they are careful in what they do.  if something breaks, then generally it's up to the user to pick up the pieces.

you might still be able to use bashrc, but instead put it in a func like:
pre_src_unpack() { export KBUILD_OUTPUT=...; }
Comment 12 SpanKY gentoo-dev 2014-04-07 21:59:57 UTC
does my suggestion in comment #11 help ?
Comment 13 Markus Rathgeb 2014-04-08 09:13:25 UTC
I stopped using KBUILD_OUTPUT at all.
Should I test the comment #11?
Comment 14 SpanKY gentoo-dev 2015-08-14 06:11:34 UTC
(In reply to Markus Rathgeb from comment #13)

up to you.  i don't think there's anything that needs to be changed in the eclasses or ebuilds as the use of bashrc violates guarantees provided by the spec.
Comment 15 Markus Rathgeb 2015-08-14 08:35:30 UTC
So, let's close this issue.
What is the resolution? Invalid?