Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with creating toolchain for avr (crossdev)
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
Chris.B.
n00b
n00b


Joined: 17 Aug 2010
Posts: 7

PostPosted: Tue Aug 17, 2010 11:39 am    Post subject: Problems with creating toolchain for avr (crossdev) Reply with quote

Hi,

I was trying to create toolchain to compile programs for my avr kit like this:
Code:

crossdev -t avr


And it was successful for stage1 and for libc, but it fails for stage2:

Code:
vetar ~ # crossdev -t avr
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 * crossdev version:      20100620
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   *
 * Target System:         avr
 * Stage:                 4 (C/C++ compiler)

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

 * PORTDIR_OVERLAY:       /usr/local/portage/layman/enlightenment
 * PORT_LOGDIR:           /var/log/portage
 * PKGDIR:                /usr/portage/packages/cross/avr
 * PORTAGE_TMPDIR:        /var/tmp/cross/avr
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~ 
 * Forcing the latest versions of {binutils,gcc}-config/gnuconfig ...                                                                                                                    [ ok ]
 * Log: /var/log/portage/cross-avr-binutils.log
 * Emerging cross-binutils ...                                                                                                                                                           [ ok ]
 * Log: /var/log/portage/cross-avr-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...                                                                                                                                                         [ ok ]
 * Log: /var/log/portage/cross-avr-avr-libc.log
 * Emerging cross-avr-libc ...                                                                                                                                                           [ ok ]
 * Log: /var/log/portage/cross-avr-gcc-stage2.log
 * Emerging cross-gcc-stage2 ...

 * gcc failed :(
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-avr-info.log
 * /var/log/portage/cross-avr-gcc-stage2.log


It seems to fail on "libgomp":

Code:
# Now that we have built all the objects, we need to copy
# them back to the GCC directory.  Too many things (other
# in-tree libraries, and DejaGNU) know about the layout
# of the build tree, for now.
make install-leaf DESTDIR=../.././gcc \
          slibdir= libsubdir= MULTIOSDIR=.
make[3]: Wejście do katalogu `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgcc'
/bin/sh /var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/gcc-4.4.4/libgcc/../mkinstalldirs ../.././gcc
/usr/bin/install -c -m 644 libgcc.a ../.././gcc/
chmod 644 ../.././gcc/libgcc.a
/usr/libexec/gcc/avr/ranlib ../.././gcc/libgcc.a
/usr/bin/install -c -m 644 libgcov.a ../.././gcc/
chmod 644 ../.././gcc/libgcov.a
/usr/libexec/gcc/avr/ranlib ../.././gcc/libgcov.a
parts="";                               \
        for file in $parts; do                                  \
          rm -f ../.././gcc/$file;              \
          /usr/bin/install -c -m 644 $file ../.././gcc/;        \
        done
make[3]: Opuszczenie katalogu `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgcc'
make[2]: Opuszczenie katalogu `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgcc'
Checking multilib configuration for libgomp...
mkdir -p -- avr/libgomp
Configuring in avr/libgomp
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... x86_64-pc-linux-gnu
checking host system type... avr-unknown-none
checking target system type... avr-unknown-none
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for avr-strip... /usr/libexec/gcc/avr/strip
checking for avr-gcc... /var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -isystem /usr/avr/include -isystem /usr/avr/sys-include
checking for C compiler default output file name... configure: error: in `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details.


The config.log part goes like this:
Code:
Thread model: single
gcc version 4.4.4 (Gentoo 4.4.4-r1 p1.1, pie-0.4.5)
configure:2541: $? = 0
configure:2543: /var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -
isystem /usr/avr/include -isystem /usr/avr/sys-include -V </dev/null >&5
xgcc: '-V' must come at the start of the command line
configure:2546: $? = 1
configure:2569: checking for C compiler default output file name
configure:2572: /var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -
isystem /usr/avr/include -isystem /usr/avr/sys-include -g -O2 -pipe     conftest.c  >&5
ld: unrecognised emulation mode: avr2
Supported emulations: elf_x86_64 elf_i386 i386linux elf_l1om
configure:2575: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "GNU OpenMP Runtime Library"
| #define PACKAGE_TARNAME "libgomp"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU OpenMP Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "libgomp"
| #define VERSION "1.0"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2613: error: in `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgomp':
configure:2616: error: C compiler cannot create executables
See `config.log' for more details.



Do you have any thoughts on how to fix this? What am I doing wrong?
Back to top
View user's profile Send private message
Chris.B.
n00b
n00b


Joined: 17 Aug 2010
Posts: 7

PostPosted: Tue Aug 17, 2010 1:31 pm    Post subject: Reply with quote

Ok, it seems I've found the problem - completely by accident. While updating system I've spotted, that emerge tries to pull gcc from 'cross-avr/gcc' from 'enlightenment' overlay. I've masked that out and crossdev finished without complaining.
Back to top
View user's profile Send private message
amightywind
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jun 2004
Posts: 137
Location: Andover, MN USA

PostPosted: Mon Sep 06, 2010 10:38 pm    Post subject: Reply with quote

What did you do to clear out the problem? I am having the same issue.
_________________
amightywind
Back to top
View user's profile Send private message
Chris.B.
n00b
n00b


Joined: 17 Aug 2010
Posts: 7

PostPosted: Tue Sep 07, 2010 7:05 am    Post subject: Reply with quote

I have masked out the cross-avr version of gcc by adding:
cross-avr/gcc

to /etc/portage/package.mask
Back to top
View user's profile Send private message
krotuss
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2008
Posts: 92

PostPosted: Tue Sep 07, 2010 9:30 am    Post subject: Reply with quote

I think so this just make crossdev to "silently" fail when you run it after first unsuccessful try, and leave you with stage1 compiler. When you run "crossdev -C avr" first (beware, it will remove your entry from package.mask, so readd) and then crossdev -t avr you will get "gcc failed :(" and following in /var/log/portage/cross-avr-gcc-stage1.log.
Code:
!!! All ebuilds that could satisfy "cross-avr/gcc" have been masked.
!!! One of the following masked packages is required to complete your request:
- cross-avr/gcc-4.5.1 (masked by: package.mask, missing keyword)
Back to top
View user's profile Send private message
Chris.B.
n00b
n00b


Joined: 17 Aug 2010
Posts: 7

PostPosted: Thu Sep 09, 2010 8:57 am    Post subject: Reply with quote

Hmm.. well yes, it seems you're right. As I think of it, it was a really stupid solution... but stage 1 compiler was enough for me so I never noticed :D

So that makes the problem unresolved... any ideas why it fails with libgomp?
Back to top
View user's profile Send private message
jsvoboda
n00b
n00b


Joined: 10 Sep 2010
Posts: 1

PostPosted: Fri Sep 10, 2010 8:52 am    Post subject: Reply with quote

I'm having exactly the same problem with libgomp config.log also stating 'unrecognized emulation mode: avr2'.

However, this worked for me:
Code:
crossdev --gcc 3.4.6-r2 --binutils 2.18-r4 avr


So the problem might be specific to gcc 4.x.
Back to top
View user's profile Send private message
sedorox
Apprentice
Apprentice


Joined: 13 Feb 2004
Posts: 202

PostPosted: Tue Sep 14, 2010 1:05 am    Post subject: Reply with quote

jsvoboda wrote:
I'm having exactly the same problem with libgomp config.log also stating 'unrecognized emulation mode: avr2'.

However, this worked for me:
Code:
crossdev --gcc 3.4.6-r2 --binutils 2.18-r4 avr


So the problem might be specific to gcc 4.x.


I just ran into the same issue (Just got a NerdKit! :) ).. And this was the solution for me. Maybe it is something with GCC4.
_________________
Home Desktop: Intel i5-2400 3.10ghz | 16G Ram | 1x 60G SSD, 1x 1TB HDD
Home Server: Intel E6750 2.66Ghz| 8G Ram | 1x 500G, 2x 750G (RAID1), 1x 1T, 1x 640G
Back to top
View user's profile Send private message
dch24
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2007
Posts: 99

PostPosted: Tue Sep 14, 2010 9:49 pm    Post subject: Reply with quote

I think the problem is finding the right ld:
Code:
$ which ld
/usr/bin/ld
$ /var/tmp/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -isystem /usr/avr/include -isystem /usr/avr/sys-include -g -O2 -pipe ~/test.c
ld: unrecognised emulation mode: avr2
Supported emulations: elf_i386 i386linux elf_x86_64 elf_l1om
$ export PATH=/usr/libexec/gcc/avr:$PATH
$ /var/tmp/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -isystem /usr/avr/include -isystem /usr/avr/sys-include -g -O2 -pipe ~/test.c
ld: cannot open linker script file ldscripts/avr5.x: No such file or directory
It looks like it finds the system ld (host builds only, not a cross-compiler). I'm trying adding the path in the ebuild to see what it does...
Back to top
View user's profile Send private message
krotuss
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2008
Posts: 92

PostPosted: Tue Sep 14, 2010 9:57 pm    Post subject: Reply with quote

Everything with <=gcc-4.1.2 should work, problem is caused by libgomp (openmp USE flag), not gcc4. No openmp, no problem. Alternatively you can patch crossdev script by adding:
Code:
-openmp
into:
Code:
GUSE="-fortran" # doesn't work
in avr section of case statement. So result should look like this:
Code:
case ${CTARGET} in
                # this is a linux+ target, not microcontroller (below)
                avr32*) :;;

                avr*) KPKG="[none]";
                      LCAT="dev-embedded"; LPKG="avr-libc";
                      GUSE="-fortran -openmp" # doesn't work
                      WITH_DEF_HEADERS="no";;
Back to top
View user's profile Send private message
dch24
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2007
Posts: 99

PostPosted: Tue Sep 14, 2010 10:06 pm    Post subject: Reply with quote

krotuss wrote:
No openmp, no problem.
Thanks, that fixed it.

Adding in the path led to this error:
configure: error: Pthreads are required to build libgomp
Code:
mkdir -p -- avr/libgomp
Configuring in avr/libgomp
...
(snip)
...
checking for type equivalent to int32_t... long
checking for type equivalent to int64_t... 'using preprocessor symbols'
checking for type equivalent to intptr_t... int16_t
configure: error: Pthreads are required to build libgomp
make[1]: *** [configure-target-libgomp] Error 1
make[1]: Leaving directory `/var/tmp/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build'
make: *** [all] Error 2
 * ERROR: cross-avr/gcc-4.4.4-r1 failed:
 *   emake failed with all
I'll just going ahead with -openmp, since avr targets are not multi-processor targets :lol:
Back to top
View user's profile Send private message
amightywind
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jun 2004
Posts: 137
Location: Andover, MN USA

PostPosted: Tue Sep 21, 2010 2:03 am    Post subject: Reply with quote

Modifying crossdev didn't work for me, but I got avr-gcc to compile by adding -openmp to the gcc-avr entry in /etc/portage/package.use:

Code:

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


The compiler seems to work.
_________________
amightywind
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