sh4-unknown-linux-gnu failures

Paolo Pisati
Mon Sep 14 08:42:00 GMT 2015

I spent part of the weekend trying to build a toolchain for the sh4 with
different results: the only release that successfully built a toolchain was
rev 1.20.0 (but then i had problems compiling a kernel with it, see below),
while the process failed in all the other releases.

After every checkout i did a 'git clean -fdx; ./bootstrap; ./configure
--enable-local; make; ./ct-ng sh4-unknown-linux-gnu; ./ct-ng build;"

< 1.19.0:
weird errors here...

[DEBUG]    Entering '/home/flag/canonical/crosstool-ng/.build/src/mpfr-2.4.2'
[DEBUG]    Running autoreconf
[DEBUG]    ==> Executing: 'autoreconf'
[ALL  ]    aclocal: warning: autoconf input should be named '', not ''
[ERROR] error: automatic de-ANSI-fication support has been removed
[ALL  ]    /usr/share/aclocal-1.14/obsolete.m4:26: AM_C_PROTOTYPES is expanded from...
[ALL  ] the top level
[ALL  ]    autom4te: /usr/bin/m4 failed with exit status: 1
[ERROR]    aclocal: error: echo failed with exit status: 1
[ALL  ]    autoreconf: aclocal failed with exit status: 1
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Extracting and patching toolchain components'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_mpfr_extract[scripts/build/companion_libs/]
[ERROR]  >>        called from: do_companion_libs_extract[scripts/build/]
[ERROR]  >>        called from: main[scripts/]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'docs/B - Known issues.txt'
[ERROR]  (elapsed: 0:08.01)


[ALL  ]    a - elf/unwind-pe.os
[ALL  ]    sh4-unknown-linux-gnu-gcc       -nostdlib -nostartfiles -r -o
ld/build-libc-final/libc_pic.os  -Wl,-d -Wl,--whole-archive
-final/libc_pic.a -o
[ALL  ]    sh4-unknown-linux-gnu-gcc       -nostdlib -nostartfiles -r -o
ld/build-libc-final/elf/ '-Wl,-('
-lgcc '-Wl,-)' -Wl,-Map,/home/
[ALL  ]
In function `_dl_a
[ALL  ]    dl-addr.c:(.text+0x224): multiple definition of
[ALL  ]
first d
efined here
[ALL  ]
tiple definition of `__libc_multiple_libcs'
[ALL  ]
first defin
ed here
[ALL  ]
In function `_itoa':
[ALL  ]    _itoa.c:(.text+0xe0): multiple definition of `_itoa'
[ALL  ]
first d
efined here
[ERROR]    collect2: error: ld returned 1 exit status
[ALL  ]    Makefile:307: recipe for target
'/home/flag/canonical/crosstool-ng/.build/sh4-unknown-linux-gnu/build/build-libc-final/elf/librt' failed
[ERROR]    make[3]: ***
Error 1
[ALL  ]    make[3]: *** Waiting for unfinished jobs....
[ALL  ]    make[3]: Leaving directory
[ALL  ]    Makefile:213: recipe for target 'elf/subdir_lib' failed
[ERROR]    make[2]: *** [elf/subdir_lib] Error 2
[ALL  ]    make[2]: Leaving directory
[ALL  ]    Makefile:9: recipe for target 'all' failed
[ERROR]    make[1]: *** [all] Error 2


got a toolchain, but i couldn't build a linux kernel with it:

[flag@southcross linux]$ export PATH=$HOME/x-tools/sh4-unknown-linux-gnu/bin/:$PATH
[flag@southcross linux]$ export ARCH=sh
[flag@southcross linux]$ git checkout v4.1
[flag@southcross linux]$ make rts7751r2dplus_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/
  HOSTLD  scripts/kconfig/conf
# configuration written to .config
[flag@southcross linux]$ make
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/machtypes.h' is up to date.
  CC      kernel/bounds.s
gcc: error: unrecognized command line option -m4-nofpu
gcc: error: unrecognized command line option -ml
gcc: error: unrecognized command line option -m4-nofpu
gcc: error: unrecognized command line option -ml
Kbuild:43: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:989: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
[flag@southcross linux]$

[flag@southcross linux]$ git grep -- -m4-nofpu
arch/sh/Makefile: $(callcc-option,-m4-nofpu,)
arch/sh/Makefile:       $(call cc-option,-mno-implicit-fp,-m4-nofpu)

cflags-$(CONFIG_CPU_SH4)                $(call cc-option,-m4,) \
        $(call cc-option,-mno-implicit-fp,-m4-nofpu)
cflags-$(CONFIG_CPU_LITTLE_ENDIAN)      +=-ml

linux enforces these two switches (-m4-nofpu and -ml) in case of an SH4

Please cc me as i'm offlist.

For unsubscribe information see

More information about the crossgcc mailing list