Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 393081 - cross-dev will not build a working avr-gcc for multiple reasons
Summary: cross-dev will not build a working avr-gcc for multiple reasons
Status: RESOLVED DUPLICATE of bug 377039
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-04 06:05 UTC by J.C. Wren
Modified: 2011-12-04 06:54 UTC (History)
0 users

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


Attachments
binutils-2.21 patch to correct location of ldscripts (binutils-2.21-scriptsdir.patch,955 bytes, text/plain)
2011-12-04 06:05 UTC, J.C. Wren
Details

Note You need to log in before you can comment on or make changes to this bug.
Description J.C. Wren 2011-12-04 06:05:21 UTC
Created attachment 294665 [details]
binutils-2.21 patch to correct location of ldscripts

With crossdev-20111018 currently in portage (as of 2011/12/03), it appears to be impossible to build a working avr-gcc for several reasons.

The desired targets are:
  avr-gcc-4.5.2
  binutils-2.22
  avr-libc-1.7.0

'crossdev -t avr' should install everything we need. 'crossdev -C avr' was issued prior to each build, and using 'updatedb' and 'locate avr' to verify no remnants from previous installs were present.

The first blocker is the USE flag change from nocxx to cxx.

 * Configuring gcc ...
 * We are migrating USE=nocxx to USE=cxx, but your USE settings do not make
 * sense.  Please make sure these two flags line up logically in your setup.
 * ERROR: cross-avr/gcc-4.5.2 failed (compile phase):
 *   USE='cxx nocxx' and USE='-cxx -nocxx' make no sense

The accepted work-around seems to be editing line 456:

-GUSE_DISABLE_STAGE_1="${GUSE_DISABLE} -fortran nocxx -openmp"
+GUSE_DISABLE_STAGE_1="${GUSE_DISABLE} -fortran nocxx -cxx -openmp"

This allows avr-gcc, binutils and avr-libc to be built. but attempting to compile a program with avr-gcc produces the following error:

$ avr-gcc  -Os -W -Wall -mmcu=atmega1284p main.c
/usr/libexec/gcc/avr/ld: cannot open linker script file ldscripts/avr51.x: No such file or directory
collect2: ld returned 1 exit status
$

This is due to the ldscripts being placed in the wrong area. At some point I had run across a patch for binutils-2.20.1 (see attachment), but I don't know the validity of it. A commonly accepted work-around is to create the following symlink:

$ ln -s /usr/lib/binutils/avr/2.22/ldscripts /usr/i686-pc-linux-gnu/avr/binutils-bin/2.22/ldscripts

This now finds the ldscripts, but results in the following error:

$ avr-gcc  -Os -W -Wall -mmcu=atmega1284p main.c
/usr/libexec/gcc/avr/ld: cannot find crtm1284p.o: No such file or directory
/usr/libexec/gcc/avr/ld: skipping incompatible /usr/lib/gcc/avr/4.5.2/libgcc.a when searching for -lgcc
/usr/libexec/gcc/avr/ld: cannot find -lgcc
/usr/libexec/gcc/avr/ld: skipping incompatible /usr/lib/gcc/avr/4.5.2/../../../../avr/lib/libc.a when searching for -lc
/usr/libexec/gcc/avr/ld: cannot find -lc
/usr/libexec/gcc/avr/ld: skipping incompatible /usr/lib/gcc/avr/4.5.2/libgcc.a when searching for -lgcc
/usr/libexec/gcc/avr/ld: cannot find -lgcc
collect2: ld returned 1 exit status
$

This is a result of avr-gcc being built with --disable-multilib, a known issue.

$ avr-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/avr/gcc-bin/4.5.2/avr-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/avr/4.5.2/lto-wrapper
Target: avr
Configured with: /var/tmp/portage/cross-avr/gcc-4.5.2/work/gcc-4.5.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/avr/gcc-bin/4.5.2 --includedir=/usr/lib/gcc/avr/4.5.2/include --datadir=/usr/share/gcc-data/avr/4.5.2 --mandir=/usr/share/gcc-data/avr/4.5.2/man --infodir=/usr/share/gcc-data/avr/4.5.2/info --with-gxx-include-dir=/usr/lib/gcc/avr/4.5.2/include/g++-v4 --host=i686-pc-linux-gnu --target=avr --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --disable-libgomp --with-python-dir=/share/gcc-data/avr/4.5.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++ --enable-shared --disable-threads --disable-bootstrap --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.2 p1.1, pie-0.4.5'
Thread model: single
gcc version 4.5.2 (Gentoo 4.5.2 p1.1, pie-0.4.5) 
$

We also see that in /etc/portage/package.use/cross-avr that -multilib is set:

cross-avr/gcc -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc -multilib

There have been a couple patches submitted, none which have made it into portage yet. The brute-force method in the past has been to edit line 766:

-        set_use_force ${pkg} -multilib
+        set_use_force ${pkg} multilib

After 'crossdev -t avr' again, same error. -multilib is still set. Try changing line 443 in crossdev:

-MULTILIB_USE=""
+MULTILIB_USE="yes"

'crossdev -C avr' and 'cross -t avr' again, and it still doesn't work. /etc/portage/package.use/cross-avr shows that multilib is now enabled:

cross-avr/gcc -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc multilib

but 'avr-gcc -v' still shows --disable-multilib. 

At this point, I have don't know how to get crossdev to leave the logs and such, and why multilib is being disabled in spite of it being overridden. Comparing a copy of the gcc-4.5.2.ebuild I saved when I had this working before shows only a dependency change on the version of binutils (from 2.17 to 2.22).

For the record, for other people trying to get crossdev to install a working avr-gcc, you'll still need to apply the gcc-005-constructor.patch.  See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45263 for details.
Comment 1 J.C. Wren 2011-12-04 06:06:50 UTC
# emerge --info
Portage 2.1.10.39 (default/linux/x86/10.0, gcc-4.5.3, glibc-2.14.1-r1, 3.1.4-gentoo-quad i686)
=================================================================
System uname: Linux-3.1.4-gentoo-quad-i686-Intel-R-_Core-TM-2_Quad_CPU_Q9300_@_2.50GHz-with-gentoo-2.1
Timestamp of tree: Sat, 03 Dec 2011 05:45:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.22
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r1
Repositories: gentoo msp430 local-repo ardunio
ACCEPT_KEYWORDS="x86 ~arm ~x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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=core2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/msp430 /usr/local/portage /usr/local/overlays/arduino"
SYNC="rsync://portage.private.com/gentoo-portage"
USE="3dnow 3dnowext X a52 accessibility acl acpi alsa apache2 apng arts berkdb bzip2 cairo cdr cli client consolekit cracklib cups cupsddk curl cxx dbus declarative device-mapper dri dvd dvdr dvdread enca encode esd extras fam ffmpeg firefox flac fortran ftpd fuse gd gdbm gnutls gphoto2 gpm gstreamer gtk hpcups httpd iconv icu imagemagick jpeg kde kdepim kpathsea lcms libwww lua mad messenger mikmod minizip mmx mmxext mng modules mozdevelop mozdom mozilla moznocompose mp3 mpeg mplayer mudflap mysql mysqli ncurses nfsv3 nls nptl nptlonly nvidia offensive ogg opengl openmp pam pcre pda pdf perl plasma png policykit pppd python qt3support qt4 quicktime readline samba sdl secure-delete semantic-desktop server session smp snmp spell sql sqlite sse ssl static-libs subversion svg sysfs tagwriting tcpd threads tiff tk truetype udev unicode usb vorbis webkit win32codecs x86 xinerama xml xorg xv 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 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" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap 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="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="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"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
#
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2011-12-04 06:54:41 UTC

*** This bug has been marked as a duplicate of bug 377039 ***