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

Bug 435350

Summary: cross-msp430/gcc target missing libcrt0
Product: Gentoo Linux Reporter: Petre Rodan <pr.gentoo-acct>
Component: [OLD] DevelopmentAssignee: Tim Harder <radhermit>
Status: RESOLVED OBSOLETE    
Severity: normal CC: andy
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: http://packages.debian.org/sid/i386/gcc-msp430/download
Whiteboard:
Package list:
Runtime testing required: ---

Description Petre Rodan 2012-09-17 18:04:09 UTC
I compiled a msp430 toolchain using
`crossdev -S -t msp430`
and all went smooth.

however when I try to link msp430 code I get

msp430-gcc -mmcu=msp430g2553 -O2 -Wall -g -c main.c
msp430-gcc -mmcu=msp430g2553 -O2 -Wall -g -o main.elf main.o
/usr/libexec/gcc/msp430/ld: cannot find crt0ivtbl16.o: No such file or directory
/usr/libexec/gcc/msp430/ld: cannot find -lcrt0
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

those missing files have not been installed by crossdev's merge:

pandora ~ # epm -qa | grep 430
msp430-libc-20120716
msp430-binutils-2.22_p20120911
msp430mcu-20120716
msp430-gcc-4.7.0_p20120911
pandora ~ # for pkg in msp430-libc msp430-binutils msp430mcu msp430-gcc; do epm -ql "${pkg}" | grep '\.so'; done
/usr/lib64/binutils/msp430/2.22/libbfd-2.22.so
/usr/lib64/binutils/msp430/2.22/libbfd.so
/usr/lib64/binutils/msp430/2.22/libopcodes-2.22.so
/usr/lib64/binutils/msp430/2.22/libopcodes.so
/usr/libexec/gcc/msp430/4.7.0/liblto_plugin.so.0.0.0
/usr/libexec/gcc/msp430/4.7.0/liblto_plugin.so.0
/usr/libexec/gcc/msp430/4.7.0/liblto_plugin.so
pandora ~ # for pkg in msp430-libc msp430-binutils msp430mcu msp430-gcc; do epm -ql $pkg | grep 'crt'; done
/usr/msp430/include/sys/crtld.h
pandora ~ #

this happens on both a x86 and an amd64 gentoo system.

I looked elsewhere and sure enough debian provides those libs as part of the gcc package:
http://packages.debian.org/sid/i386/gcc-msp430/download

what am I missing here?
am I supposed to run the linker with -nostdlib ? none of the msp430 sample code Makefiles I've seen do that.

Reproducible: Always

Steps to Reproduce:
1. crossdev -S -t msp430
2. git clone https://github.com/Hack-a-Day/had_launchpad-blink
3. try to compile the blinky code
Comment 1 SpanKY gentoo-dev 2012-09-18 20:09:22 UTC
you might have to update your crossdev to the latest and rebuild
Comment 2 Tim Harder gentoo-dev 2012-09-18 22:42:16 UTC
This is the reason msp430-gcc-4.7* doesn't have any keywords yet so you must be allowing it in package.keywords or package.accept_keywords explicitly. For some reason which I haven't figured out yet, the crossdev build process doesn't build those libs using the newer patches against gcc-4.7*.

Note that the msp430 toolchain doesn't have any stable keywords so if you just use `crossdev -t msp430` everything should work properly since it will build the latest working msp430-gcc-4.6* instead.
Comment 3 Petre Rodan 2012-09-19 08:26:15 UTC
thanks Tim,

indeed skipping '-S' emerges a working compiler. somewhat counter-intuitive :)

but you might want to upload gcc-4.6.3.tar.bz2 to the mirrors or include the upstream SRC_URI in the toolchain eclass.
Comment 4 Tim Harder gentoo-dev 2012-09-19 08:37:14 UTC
(In reply to comment #3)
> indeed skipping '-S' emerges a working compiler. somewhat counter-intuitive
> :)

This should probably be fixed in crossdev so when -S is used without any stable versions it doesn't select ebuilds without KEYWORDS. I'll try to find time to produce a patch.

> but you might want to upload gcc-4.6.3.tar.bz2 to the mirrors or include the
> upstream SRC_URI in the toolchain eclass.

I don't know what you mean since gcc-4.6.3.tar.bz2 is on the distfiles mirrors and the upstream url is in SRC_URI for the toolchain eclass.
Comment 5 Petre Rodan 2012-09-19 08:59:37 UTC
my crossdev compilation of gcc-stage1 stopped at first due to not being able to find gcc-4.6.3.tar.bz2 (sorry I lost the logs). I copied that file from the gnu.org ftp and all went well from that point on.

thanks for the help.
Comment 6 Andrew Karpow 2013-05-28 17:38:51 UTC
I can confirm this bug. I need the msp430-gcc 4.7 toolchain for development with large memory model (-mmemory-model=huge).

manual compilation builds the startup code fine (libcrt0.a, crt0ivtbl16.o, etc), but inside the emerge enviroment it's just doesn't build:

--snip buildlog--
...
# Early copyback; see "all" above for the rationale.  The
# early copy is necessary so that the gcc -B options find
# the right startup files when linking shared libgcc.
/bin/sh /tmp/portage/cross-msp430/msp430-gcc-4.7.0_p20120911/work/gcc-4.7.0/libgcc/../mkinstalldirs ../.././gcc
parts="libcrt0.a libcrt0dwdt.a crt0ivtbl16.o crt0ivtbl32.o crt0ivtbl64.o";					\
for file in $parts; do					\
  rm -f ../.././gcc/$file;		\
  /usr/bin/install -c -m 644 $file ../.././gcc/;	\
  case $file in 					\
    *.a)						\
      /usr/libexec/gcc/msp430/ranlib ../.././gcc/$file ;;	\
  esac;							\
done
/usr/bin/install: cannot stat ‘libcrt0.a’: No such file or directory
/usr/libexec/gcc/msp430/ranlib: '../.././gcc/libcrt0.a': No such file
/usr/bin/install: cannot stat ‘libcrt0dwdt.a’: No such file or directory
/usr/libexec/gcc/msp430/ranlib: '../.././gcc/libcrt0dwdt.a': No such file
/usr/bin/install: cannot stat ‘crt0ivtbl16.o’: No such file or directory
/usr/bin/install: cannot stat ‘crt0ivtbl32.o’: No such file or directory
/usr/bin/install: cannot stat ‘crt0ivtbl64.o’: No such file or directory
...
--snip--

strange thing about this: the makefile for libgcc requires EXTRA_PARTS (libcrt0.a libcrt0dwdt.a crt0ivtbl16.o crt0ivtbl32.o crt0ivtbl64.o) to be build as a dependency for the copyback part o_O

-- /tmp/portage/cross-msp430/msp430-gcc-4.7.0_p20120911/work/build/msp430/libgcc/Makefile --

# Build extra startfiles in the libgcc directory.
.PHONY: libgcc-extra-parts
libgcc-extra-parts: $(EXTRA_PARTS)

    # Early copyback; see "all" above for the rationale.  The
    # early copy is necessary so that the gcc -B options find
    # the right startup files when linking shared libgcc.
    $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
    parts="$(EXTRA_PARTS)";                 \
....
-- snip --
Comment 7 Tim Harder gentoo-dev 2014-10-31 02:46:57 UTC
Closing as obsolete since all dev-embedded/msp430* packages are now masked. Use >=sys-devel/crossdev-20141030 to build an msp430 toolchain using the standard binutils/gcc/newlib/gdb packages.