Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 465722 - net-libs/ptlib-2.10.10 fails to build since $TARGET variable was added to /etc/env.d/binutils/${CHOST} by latest toolchain-binutils.eclass
Summary: net-libs/ptlib-2.10.10 fails to build since $TARGET variable was added to /et...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: voip herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-13 00:24 UTC by Max Hacking
Modified: 2013-04-16 13:28 UTC (History)
2 users (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 Max Hacking 2013-04-13 00:24:07 UTC
Pretty much as the summary says....

The latest version of toolchain-binutils.eclass adds an entry to the /etc/env.d/biutils/${CHOST} file setting the $TARGET variable.

The net-libs/ptlib makefile (located at ./make/common.mak in the work dir) uses the $TARGET variable.  

This causes the build to fail with messages similar to:

make -j4 
make DEBUG= P_SHAREDLIB=1 default_target
make[1]: Entering directory `/var/tmp/portage/net-libs/ptlib-2.10.10/work/ptlib-2.10.10'
make[1]: *** No rule to make target `x86_64-pc-linux-gnu', needed by `default_target'.  Stop.


Reproducible: Always

Steps to Reproduce:
1. [Re]install binutils using the latest toolchain-binutils.eclass
2. env-update && source /etc/profile
3. emerge -1 net-libs/ptlib
Actual Results:  
make -j4 
make DEBUG= P_SHAREDLIB=1 default_target
make[1]: Entering directory `/var/tmp/portage/net-libs/ptlib-2.10.10/work/ptlib-2.10.10'
make[1]: *** No rule to make target `avr', needed by `default_target'.  Stop.

Expected Results:  
Successful merge.

# emerge --info

Portage 2.1.11.55 (default/linux/amd64/13.0/desktop/gnome, gcc-4.6.3, glibc-2.15-r3, 3.6.11-gentoo x86_64)
=================================================================
System uname: Linux-3.6.11-gentoo-x86_64-AMD_Opteron-tm-_Processor_6320-with-gentoo-2.1
KiB Mem:     8153192 total,   2869228 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Fri, 12 Apr 2013 10:00:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.1-r1::hacking-patched-gentoo
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5::hacking-patched-gentoo
sys-devel/autoconf:       2.13::hacking-patched-gentoo, 2.69
sys-devel/automake:       1.9.6-r3::hacking-patched-gentoo, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r2::hacking-gentoo
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1::hacking-patched-gentoo
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo x-crossdev-overlay hacking-gentoo sunrise
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf /usr/share/openvpn/easy-rsa /var/lib/hsqldb"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /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 -pipe"
DISTDIR="/mnt/portage/distfiles"
EMERGE_DEFAULT_OPTS=""
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.tiscali.nl/ http://gentoo.mneisen.org/ http://de-mirror.org/distro/gentoo/"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/mnt/portage/packages"
PORTAGE_CONFIGROOT="/"
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"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/mnt/portage/portage"
PORTDIR_OVERLAY="/mnt/portage/overlays/generated/crossdev-overlay /mnt/portage/overlays/hacking-gentoo /mnt/portage/overlays/sunrise"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X X509 a52 aac acl acpi alsa amd64 apache2 audiofile bash-completion blueray bluetooth bzip2 cairo caps cdda cddb cdio cdr cleartype cli colord consolekit cracklib crypt css cups cxx dbus dell device-mapper dirac dri dtfm dts dv dvb dvd dvdr eds emboss emerald encode evo exif expat fam fbsplash ffmpeg firefox flac fortran ftdi g3dvl gconf gdbm gdu gif gimp glitz glut gnome gnome-keyring gnome-online-accounts gnutls gphoto2 gpm gs gsm gstreamer gtk h224 h281 h323 hal hddtemp iconv id3tag idn imagemagick imap ios iphone iplayer ipod ipv6 irda java java6 jpeg ladspa lcms ldap libnotify libsecret libv4l2 lm_sensors logrotate mad mjpeg mmap mmx mmxext mng modules mozdevelop mp3 mp4 mpeg mplayer mtp mudflap multilib musicbrainz nat nautilus ncurses nfs nls nptl nptlonly nsplugin nspluginwrapper nss nvidia offensive ogg openal opengl openmp openvg pam pango pcre pdf plasma png policykit pop postgres ppds pulseaudio qt3support qt4 quicktime readline reports restrict-javascript rtsp scanner sdl semantic-desktop sendto sensord session sip sipim sms sndfile snmp socialweb sox speex spell srtp sse sse2 ssl startup-notification subtitles svg tcpd tga theora threads tiff transcode truetype udev udisks unicode upower usb userlocales v4l v4l2 vaapi vcd vdpau vhosts vorbis wav webkit wifi wma wxwidgets x264 xa xcap xcb xine xinerama xml xscreensaver xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="intel8x0" 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="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http reqtimeout" 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" DRACUT_MODULES="biosdevname caps iscsi lvm mdraid nbd nfs syslog" 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19" 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"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 SpanKY gentoo-dev 2013-04-13 06:10:45 UTC
if the var isn't meant to be set in the build env for this package, then `unset` it in the ebuild
Comment 2 Max Hacking 2013-04-13 11:17:51 UTC
(In reply to comment #1)
> if the var isn't meant to be set in the build env for this package, then
> `unset` it in the ebuild

That is a valid suggestion (and what I have been doing as a workaround) however net-libs/ptlib is not the only package which will suffer from this problem as $TARGET is extremely common in makefiles, etc.

Perhaps a better idea would be to rename the $TARGET and $FAKE_TARGETS variables to $BINUTILS_TARGET and $BINUTLS_FAKE_TARGETS as these would be far less likely to conflict with anything?

Also, there is another problem if you have multiple versions of binutls installed.  Try adding a toolchain for cross-compiling (say AVR or ARM) and then examine the $TARGET and $FAKE_TARGETS variables - they'll be wrong!

If it were me I would say this was a toolchain problem, not an issue for the voip team.
Comment 3 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-04-13 11:20:26 UTC
Indeed, unless there is a technical reason to call this variable "TARGET", it would be preferable to not pollute namespace.
Comment 4 SpanKY gentoo-dev 2013-04-13 19:13:18 UTC
(In reply to comment #3)

users export random vars all the time.  that ebuild should not fall over dead.

but let's review some facts here ...
 - the vars in /etc/env.d/binutils/* do *not* get wholesale exported
 - binutils-config sources the file directly and uses it to generate 05binutils
 - 05binutils *only* contains INFOPATH/MANPATH

so the supposition that TARGET existing in /etc/env.d/binutils/* is being exported to the general environment is wrong.  if that's happening, it's most likely something custom you've done to your system.
Comment 5 Max Hacking 2013-04-13 22:41:14 UTC
> but let's review some facts here ...
>  - the vars in /etc/env.d/binutils/* do *not* get wholesale exported
>  - binutils-config sources the file directly and uses it to generate
> 05binutils
>  - 05binutils *only* contains INFOPATH/MANPATH
> 
> so the supposition that TARGET existing in /etc/env.d/binutils/* is being
> exported to the general environment is wrong.  if that's happening, it's
> most likely something custom you've done to your system.

I have checked on three different systems (two x86_64, one x86) and they *all* have $TARGET and $FAKE_TARGETS exported in the general environment.  The only common factor is they all have toolchains for AVR and ARM installed using crossdev.

It would seem that at some point in history the crossdev utility incorrectly produced files like /etc/env.d/99avr-binutils containing the $TARGET and $FAKE_TARGETS variables, they are present on all three machines tested.  Using equery to establish the owner reveals they are orphans.  Deleting these files resolves this issue as expexted.  

If there is anything I can do to help resolve how these files came to exist just ask - it has caused problems for quite a few of our clients so if you need more info we've got plenty of machines to examine!

Thanks.
Comment 6 SpanKY gentoo-dev 2013-04-13 23:28:37 UTC
(In reply to comment #5)

i don't recall crossdev ever creating files in /etc/env.d/

sys-devel/binutils has only ever created files in /etc/env.d/binutils/

sys-devel/binutils-config might have created stuff in /etc/env.d/ other than 05binutils, but it hasn't done it in 8 years (i checked binutils-config-1.8 and it doesn't, and that was released 30 Jan 2005.

i don't see any value in trying to diagnose this any further.  fix ptlib to unset vars that it can't handle being set in the env (`unset`), and if your system is messed up, just delete the files and run `env-update`.
Comment 7 Max Hacking 2013-04-14 00:19:19 UTC
(In reply to comment #6)
> (In reply to comment #5)
> 
> i don't recall crossdev ever creating files in /etc/env.d/
> 
> sys-devel/binutils has only ever created files in /etc/env.d/binutils/
> 
> sys-devel/binutils-config might have created stuff in /etc/env.d/ other than
> 05binutils, but it hasn't done it in 8 years (i checked binutils-config-1.8
> and it doesn't, and that was released 30 Jan 2005.
> 
> i don't see any value in trying to diagnose this any further. 

Thanks for your assistance SpanKY - I'm only persuing it at all as it has hit several of our [Hacking Networked Solutions] customers in the last two weeks or so, which is weird.  

If I ever find out what created those files / is creating those files I'll let you know.
Comment 8 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-04-16 13:28:44 UTC
ptlib now unsets TARGET if it is set, and prints a warning.

If you find the reason why TARGET creeps into your environment, you can file a separate bug.