Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 418209

Summary: cross-armv7m-none-eabi/gcc-4.5.3 stage1 cross-compiler fails
Product: Gentoo Linux Reporter: Jiri Pittner <jiri.pittner>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: no111u3, peter
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: log files
Patch for /usr/portage/eclass/toolchain.eclass
patch
patch for arm thumb mode
patch for arm thumb mode

Description Jiri Pittner 2012-05-30 07:53:38 UTC
Created attachment 313585 [details]
log files

crossdev -t armv7m-none-eabi --ex-gdb fails:
Emerging cross-gcc-stage1 ...
 * gcc failed :(

Excerpt from the log:

make[2]: Leaving directory `/scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build/gcc'
Checking multilib configuration for libgcc...
mkdir -p -- armv7m-none-eabi/libgcc
Configuring in armv7m-none-eabi/libgcc
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking build system type... x86_64-pc-linux-gnu
checking host system type... armv7m-none-eabi
checking for armv7m-none-eabi-ar... /usr/libexec/gcc/armv7m-none-eabi/ar
checking for armv7m-none-eabi-lipo... armv7m-none-eabi-lipo
checking for armv7m-none-eabi-nm... /scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build/./gcc/nm
checking for armv7m-none-eabi-ranlib... /usr/libexec/gcc/armv7m-none-eabi/ranlib
checking for armv7m-none-eabi-strip... /usr/libexec/gcc/armv7m-none-eabi/strip
checking whether ln -s works... yes
checking for armv7m-none-eabi-gcc... /scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build/./gcc/xgcc -B/scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build/./gcc/ -B/usr/armv7m-none-eabi/bin/ -B/usr/armv7m-none-eabi/lib/ -isystem /usr/armv7m-none-eabi/include -isystem /usr/armv7m-none-eabi/sys-include
checking for suffix of object files... configure: error: in `/scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build/armv7m-none-eabi/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/scratch/tmp/portage/cross-armv7m-none-eabi/gcc-4.5.3-r2/work/build'
make: *** [all] Error 2
emake failed
 * ERROR: cross-armv7m-none-eabi/gcc-4.5.3-r2 failed (compile phase):
 *   emake failed with all
 *
 * Call stack:
 *     ebuild.sh, line   85:  Called src_compile
 *   environment, line 3944:  Called toolchain_src_compile
 *   environment, line 4590:  Called gcc_do_make
 *   environment, line 2301:  Called die
 * The specific snippet of code:
 *       emake LDFLAGS="${LDFLAGS}" STAGE1_CFLAGS="${STAGE1_CFLAGS}" LIBPATH="${LIBPATH}" BOOT_CFLAGS="${BOOT_CFLAGS}" ${GCC_MAKE_TARGET} || die "emake failed with ${GCC_MAKE_TARGET}";
 *

Full log files of crossdev are in attachment.

emerge --info:
dev-util/cmake:           2.8.8-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.20.1-r1, 2.21, 2.21.1-r1, 2.22-r1
sys-devel/gcc:            4.4.4-r2, 4.4.5, 4.5.2, 4.5.3-r1
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.3 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -mtune=native -fno-omit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind /var/lib/hsqldb"
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=native -mtune=native -fno-omit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.supp.name/ http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.mirror.dkm.cz/pub/gentoo/ ftp://gentoo.mirror.dkm.cz/pub/gentoo/ ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://ftp.sh.cvut.cz/MIRRORS/gentoo ftp://mirror.switch.ch/mirror/gentoo/ http://gentoo.supp.name/ rsync://gentoo.mirror.dkm.cz/gentoo/ http://gentoo.mirror.web4u.cz/"
LANG="C"
LC_ALL="czech"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="cs de nl sk"
MAKEOPTS="-j8"
PKGDIR="/usr/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="/scratch/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/opt/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X Xaw3d a52 aac aalib ac3 acl acpi aes alsa amd64 amr berkdb blas bluetooth bonobo branding bzip2 cairo cdda cddb cdparanoia cdr cli consolekit cracklib crypt cxx dbus djvu dri dts dv dvb dvd dvdnav dvdr dvdread emboss encode exif fam ffmpeg firefox flac fortran ftp gcj gd gdbm gdu gif gphoto2 gpm gps graphics gsm gtk hal http hwac3 icc iconv ieee1394 imagemagick imap ipv6 jabber java javascript jpeg jpeg2k kpathsea lapack laptop latex lcms ldap lesstif libnotify libwww lirc lm_sensors lprng mad mbox mime mmap mmx mng modules mozilla mp3 mp4 mpeg mpi mudflap multilib music mysqlnptl nas ncurses nls nptl nptlonly nsplugin obex ogg opengl openmp pango paste64 pcmcia pcre pdf perl plotutils png policykit posix ppds pppd pstricks publishers python qt3support qt4 readline samba scanner science sdl session sharedmem smartcard sndfile sockets socks5 sox spell sse sse2 sse3 sse4 ssl startup-notification static-libs svg tcl tcltk tcpd tetex threads tiff tk truetype udev unicode usb usrp v4l v4l2 vcd vorbis wifi wxwidgets wxwindows x264 xcb xine xml xmms xorg xpm xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 sheets 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="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="cs de nl sk" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau vesa nv fbdev v4l vga" 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, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 SpanKY gentoo-dev 2012-06-01 03:21:25 UTC
seems like using --with-arch=armv7-m doesn't work by default

you can work around it by running crossdev with the flag:
  --genv EXTRA_ECONF=--with-arch=
Comment 2 Jiri Pittner 2012-06-01 07:09:52 UTC
The suggested workaround option has to be enclosed in quotes:

crossdev -t armv7m-none-eabi --ex-gdb --genv EXTRA_ECONF=--with-arch=
...
 * Emerging cross-gcc-stage1 ...

 * gcc failed :(

/var/log/portage/cross-armv7m-none-eabi-gcc-stage1.log.xz:
Calculating dependencies  . ..... done!
ParseError: Invalid token 'CFLAGS_default' (not '='): /etc/portage/env/cross-armv7m-none-eabi/gcc.conf: line 4 in /etc/portage/env/cross-armv7m-none-eabi/gcc.conf

crossdev -t armv7m-none-eabi --ex-gdb --genv "EXTRA_ECONF='--with-arch='"
works fine.

Thanks for the help :-).
Jiri
Comment 3 Pablo Pölcher 2012-11-06 07:22:24 UTC
Created attachment 328526 [details, diff]
Patch for /usr/portage/eclass/toolchain.eclass
Comment 4 Pablo Pölcher 2012-11-06 07:23:57 UTC
I had the same problem. The error occurs because the compiler is asked to generate ARM code for a Thumb CPU. I solved it patching /usr/portage/eclass/toolchain.eclass and adding the --with-mode=thumb switch. Just posted proposed patch.
Comment 5 Boris Vingradov 2013-05-17 10:56:30 UTC
Hello.
Anything new about this issue? it's affect me too.

crossdev -t armv7m-hardfloat-eabi
Emerging cross-gcc-stage1 ...
 * gcc failed :(
Comment 6 Boris Vingradov 2013-05-17 10:57:35 UTC
Gcc version 4.7.2/4.7.3
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2013-05-18 15:07:14 UTC
*** Bug 470232 has been marked as a duplicate of this bug. ***
Comment 8 Boris Vingradov 2013-05-21 08:42:01 UTC
I imposed this patch and it worked to me.

http://nis-embedded.blogspot.ru/2013/04/the-full-compatible-toolchain-for.html
Comment 9 SpanKY gentoo-dev 2013-05-21 20:08:57 UTC
Comment on attachment 328526 [details, diff]
Patch for /usr/portage/eclass/toolchain.eclass

this should be generalized slightly.  if ${arm_arch} matches *-m, then default to thumb mode.
Comment 10 Boris Vingradov 2013-05-22 01:38:48 UTC
(In reply to comment #9)
> Comment on attachment 328526 [details, diff] [details, diff]
> Patch for /usr/portage/eclass/toolchain.eclass
> 
> this should be generalized slightly.  if ${arm_arch} matches *-m, then
> default to thumb mode.

Is not truth.
I'm installing cross armv7-hardfloat-eabi and gcc build failed.

jane ~ # crossdev armv7m-hardfloat-eabi
--------------------------------------------------------------------------------
 * crossdev version:      20120721
 * Host Portage ARCH:     x86
 * Target Portage ARCH:   arm
 * Target System:         armv7m-hardfloat-eabi
 * Stage:                 3 (C compiler & libc)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  newlib-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    
 * Portage flags:         
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  
!!! WARNING - Cannot auto-configure CHOST armv7m-hardfloat-eabi
!!! You should edit /usr/armv7m-hardfloat-eabi/etc/portage/make.conf
!!! by hand to complete your configuration
 * Log: /var/log/portage/cross-armv7m-hardfloat-eabi-binutils.log
 * Emerging cross-binutils ...                                            [ ok ]
 * Log: /var/log/portage/cross-armv7m-hardfloat-eabi-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...

 * gcc failed :(
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-armv7m-hardfloat-eabi-info.log
 * /var/log/portage/cross-armv7m-hardfloat-eabi-gcc-stage1.log.xz
 * /var/tmp/portage/cross-armv7m-hardfloat-eabi/gcc*/temp/gcc-config.logs.tar.xz
Comment 11 SpanKY gentoo-dev 2013-05-22 04:50:51 UTC
(In reply to comment #10)

i don't know what the point of this comment is
Comment 12 Boris Vingradov 2013-05-22 05:31:26 UTC
(In reply to comment #11)
> (In reply to comment #10)
> 
> i don't know what the point of this comment is

Without patch compile gcc failed
Comment 13 SpanKY gentoo-dev 2013-05-22 05:55:14 UTC
(In reply to comment #12)

that is already known, and why this bug is still open.  so i don't know why you posted that comment when it doesn't add anything new.
Comment 14 Boris Vingradov 2013-05-23 13:03:47 UTC
(In reply to comment #13)
> (In reply to comment #12)
> 
> that is already known, and why this bug is still open.  so i don't know why
> you posted that comment when it doesn't add anything new.

Bug is known, but hasn't solution.
Comment 15 Boris Vingradov 2013-05-23 14:00:54 UTC
(In reply to comment #9)
> Comment on attachment 328526 [details, diff] [details, diff]
> Patch for /usr/portage/eclass/toolchain.eclass
> 
> this should be generalized slightly.  if ${arm_arch} matches *-m, then
> default to thumb mode.

http://en.wikipedia.org/wiki/ARM_architecture

-m mode(thumb) is matches for Cortex-m3+ as arch ARMv7m, but and Cortex-m0(1)(+) as arch ARMv6m.

I can rewrite patch.
Comment 16 Boris Vingradov 2013-05-23 14:13:01 UTC
But using gcc for ARMv7-M I can compile for Cortex-m0 because, -mcpu and -mtune has cortex-m0 cpu. Also thumb instructions in -m0 and m3 is equal

jane linux # armv7m-hardfloat-eabi-gcc --help=target
...
  Known ARM CPUs (for use with the -mcpu= and -mtune= options):
    arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s
    arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250
    arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710
    arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d
    arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920
    arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e
    arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0
    cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526
    fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore
    mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale
...
Comment 17 Boris Vingradov 2013-05-23 14:34:48 UTC
Created attachment 348987 [details, diff]
patch

Patch to add a thumb mode in compile tools
Comment 18 SpanKY gentoo-dev 2013-05-23 19:51:09 UTC
Comment on attachment 348987 [details, diff]
patch

please use the unified diff format.  this format is not useful for review or for actually applying as files change over time.

you don't need to use a regex as a simple pattern match will do it.

 [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
Comment 19 Boris Vingradov 2013-05-24 01:53:05 UTC
Created attachment 349038 [details]
patch for arm thumb mode

New version of patch for select thumb mode for cross compiller if selected armv7-m arch
Comment 20 Boris Vingradov 2013-05-24 02:03:29 UTC
Comment on attachment 349038 [details]
patch for arm thumb mode

--- toolchain.eclass.orig	2013-05-24 08:45:23.078823831 +0700
+++ toolchain.eclass	2013-05-24 09:02:37.760326529 +0700
@@ -968,6 +968,7 @@
 				break
 			fi
 		done
+
 		# Convert armv7{a,r,m} to armv7-{a,r,m}
 		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
 		# See if this is a valid --with-arch flag
@@ -977,6 +978,9 @@
 			confgcc+=( --with-arch=${arm_arch} )
 		fi
 
+		# If arch is arm*-m, use thumb mode only.
+		[[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
+		
 		# Enable hardvfp
 		if [[ $(tc-is-softfloat) == "no" ]] && \
 		   [[ ${CTARGET} == armv[67]* ]] && \
Comment 21 Boris Vingradov 2013-05-24 02:04:19 UTC
Comment on attachment 349038 [details]
patch for arm thumb mode

>--- toolchain.eclass.orig	2013-05-24 08:45:23.078823831 +0700
>+++ toolchain.eclass	2013-05-24 08:50:19.295471444 +0700
>@@ -968,6 +968,7 @@
> 				break
> 			fi
> 		done
>+
> 		# Convert armv7{a,r,m} to armv7-{a,r,m}
> 		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
> 		# See if this is a valid --with-arch flag
>@@ -977,6 +978,9 @@
> 			confgcc+=( --with-arch=${arm_arch} )
> 		fi
> 
>+		# If arch is arm*-m, use thumb mode only.
>+		[[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
>+		
> 		# Enable hardvfp
> 		if [[ $(tc-is-softfloat) == "no" ]] && \
> 		   [[ ${CTARGET} == armv[67]* ]] && \
Comment 22 Boris Vingradov 2013-05-24 02:07:02 UTC
Created attachment 349040 [details, diff]
patch for arm thumb mode

New version of patch for select thumb mode for cross compiller if selected armv7-m arch. Previous is wrong by incorrect syntax.
Comment 23 Boris Vingradov 2013-05-24 02:20:05 UTC
Test patch passed:
jane ~ # crossdev armv7m-hardfloat-eabi
--------------------------------------------------------------------------------
 * crossdev version:      20120721
 * Host Portage ARCH:     x86
 * Target Portage ARCH:   arm
 * Target System:         armv7m-hardfloat-eabi
 * Stage:                 3 (C compiler & libc)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  newlib-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    
 * Portage flags:         
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  
 * leaving sys-devel/binutils in /usr/local/portage
 * leaving sys-devel/gcc in /usr/local/portage
 * leaving sys-libs/newlib in /usr/local/portage
 * leaving sys-devel/gdb in /usr/local/portage
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  
 * Log: /var/log/portage/cross-armv7m-hardfloat-eabi-binutils.log
 * Emerging cross-binutils ...                                            [ ok ]
 * Log: /var/log/portage/cross-armv7m-hardfloat-eabi-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...                                          [ ok ]
 * Log: /var/log/portage/cross-armv7m-hardfloat-eabi-newlib.log
 * Emerging cross-newlib ...                                              [ ok ]
Comment 24 SpanKY gentoo-dev 2013-05-24 21:07:21 UTC
thanks for testing

http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.592&r2=1.593