Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
crossdev avr: Problem with linker
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Jogie214
Apprentice
Apprentice


Joined: 15 Aug 2004
Posts: 159
Location: Cologne / Germany

PostPosted: Sun Jul 10, 2011 2:56 pm    Post subject: crossdev avr: Problem with linker Reply with quote

Hi,

I tried to build a toolchain to play around with my arduino mega board a little.
Everthing worked fine so far, but there is a problem when it comes to linking.
Here is the relevant output:
Quote:

/usr/bin/avr-gcc -mmcu=atmega2560 -lm -Wl,--gc-sections -Os -o build-cli/Blink.elf build-cli/Blink.o build-cli/wiring.o build-cli/WInterrupts.o build-cli/wiring_digital.o build-cli/pins_arduino.o build-cli/wiring_pulse.o build-cli/wiring_analog.o build-cli/wiring_shift.o build-cli/Tone.o build-cli/WString.o build-cli/WMath.o build-cli/Print.o build-cli/main.o build-cli/HardwareSerial.o -lc
/usr/libexec/gcc/avr/ld: cannot find crtm2561.o: No such file or directory
/usr/libexec/gcc/avr/ld: skipping incompatible /usr/lib/gcc/avr/4.5.2/../../../../avr/lib/libm.a when searching for -lm
/usr/libexec/gcc/avr/ld: cannot find -lm
/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
/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


To build the toolchain I used:
Quote:

crossdev -t avr -v --withoutheaders

I also build it without the --without-headers option, same result :(.
At the moment following versions are installed:
avr-libc: 1.7.0
avr-gcc: 4.5.2
avr-binutils: 2.21.1
I also tried the stable option (-s), but again the same result.

Here is my emerge --info output:
Quote:

Portage 2.1.10.3 (default/linux/x86/10.0, gcc-4.4.5, glibc-2.12.2-r0, 2.6.36-gentoo-r5 i686)
=================================================================
System uname: Linux-2.6.36-gentoo-r5-i686-Intel-R-_Atom-TM-_CPU_330_@_1.60GHz-with-gentoo-2.0.2
Timestamp of tree: Mon, 04 Jul 2011 06:00:01 +0000
app-shells/bash: 4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python: 2.6.6-r2, 2.7.1-r1, 3.1.3-r1
dev-util/cmake: 2.8.4-r1
dev-util/pkgconfig: 0.25-r2
sys-apps/baselayout: 2.0.2
sys-apps/openrc: 0.8.3-r1
sys-apps/sandbox: 2.4
sys-devel/autoconf: 2.13, 2.68
sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils: 2.20.1-r1
sys-devel/gcc: 4.4.5, 4.5.1-r1
sys-devel/gcc-config: 1.4.1-r1
sys-devel/libtool: 2.2.10
sys-devel/make: 3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc: 2.12.2
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /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/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/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 -march=native -pipe -fomit-frame-pointer"
DISTDIR="/usr/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa apache2 berkdb bzip2 cdrom cdrw cli cpufreq cracklib crypt cxx dbus doc dri dvd dvdr flac fontconfig fortran gdbm gpm iconv ipv4 ipv6 jpeg mad modules mudflap mysql ncurses nls nptl nptlonly opengl openmp pam pcre perl php png policykit pppd python readline session ssl sysfs tcpd truetype unicode vdpau vim vim-syntax vorbis wifi x86 xinerama xml xorg zlib" ALSA_CARDS="intel-hda" 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="braindump flow karbon kexi kpresenter krita tables words" 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" 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, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


Do you need anything else?

Thanks in advance,
Sebastian

EDIT1:
I nearly forgot the relevant part from package.us:
Quote:

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

_________________
Desktop: Ryzen7 1700x / x370 / Radeon RX 550 / Gentoo amd64
Back to top
View user's profile Send private message
Flurp
n00b
n00b


Joined: 15 Apr 2004
Posts: 20
Location: Crewe, UK

PostPosted: Mon Oct 10, 2011 8:48 pm    Post subject: Reply with quote

Hi

I'm guessing that you've come up against a problem with crossdev and avr that by default crossdev disables multilib support. the avr toolchain uses multilib to work with the architectures of the different avr devices, so if it's disabled the linker can't find the appropriate subdirectories. Just to make life more interesting some profiles also disable multilib support.

I hit this problem at the weekend and found this patch: https://bugs.gentoo.org/attachment.cgi?id=285901 from this bug: https://bugs.gentoo.org/show_bug.cgi?id=378387#c6 fixed the problem for me.

There's a good guide to applying a patch to the git repository version of crossdev here: https://bugs.gentoo.org/show_bug.cgi?id=147155#c72

By the way, you have added the symlink from your avr compiler to the avr ldscripts haven't you... e.g.
Code:
ln -s /usr/lib/binutils/avr/2.21.1/ldscripts /usr/i686-pc-linux-gnu/avr/binutils-bin/2.21.1/ldscripts

where i686-pc-linux-gnu should be substituted for your compiler and 2.21.2 is the version of your binutils
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum