Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Problems with creating toolchain for avr (crossdev)

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
Chris.B.
n00b
n00b
Posts: 48
Joined: Tue Aug 17, 2010 11:26 am

Problems with creating toolchain for avr (crossdev)

  • Quote

Post by Chris.B. » Tue Aug 17, 2010 11:39 am

Hi,

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

Code: Select all

crossdev -t avr
And it was successful for stage1 and for libc, but it fails for stage2:

Code: Select all

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: Select all

# 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: Select all

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?
Top
Chris.B.
n00b
n00b
Posts: 48
Joined: Tue Aug 17, 2010 11:26 am

  • Quote

Post by Chris.B. » Tue Aug 17, 2010 1:31 pm

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.
Top
amightywind
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 137
Joined: Tue Jun 01, 2004 2:47 pm
Location: Andover, MN USA

  • Quote

Post by amightywind » Mon Sep 06, 2010 10:38 pm

What did you do to clear out the problem? I am having the same issue.
amightywind
Top
Chris.B.
n00b
n00b
Posts: 48
Joined: Tue Aug 17, 2010 11:26 am

  • Quote

Post by Chris.B. » Tue Sep 07, 2010 7:05 am

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

to /etc/portage/package.mask
Top
krotuss
Apprentice
Apprentice
Posts: 253
Joined: Fri Aug 01, 2008 6:11 pm

  • Quote

Post by krotuss » Tue Sep 07, 2010 9:30 am

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: Select all

!!! 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)
Top
Chris.B.
n00b
n00b
Posts: 48
Joined: Tue Aug 17, 2010 11:26 am

  • Quote

Post by Chris.B. » Thu Sep 09, 2010 8:57 am

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?
Top
jsvoboda
n00b
n00b
Posts: 1
Joined: Fri Sep 10, 2010 8:39 am

  • Quote

Post by jsvoboda » Fri Sep 10, 2010 8:52 am

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

However, this worked for me:

Code: Select all

crossdev --gcc 3.4.6-r2 --binutils 2.18-r4 avr
So the problem might be specific to gcc 4.x.
Top
sedorox
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Fri Feb 13, 2004 2:17 am

  • Quote

Post by sedorox » Tue Sep 14, 2010 1:05 am

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: Select all

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: Ryzen 3900X 3.8ghz | 32G Ram | 2x 1TB NVMe
Previous 7 Year Build: Intel i5-2400 3.1ghz | 16G Ram | 1x 60G SSD, 1x 1TB HDD
Top
dch24
Tux's lil' helper
Tux's lil' helper
Posts: 99
Joined: Thu Feb 15, 2007 2:27 am

  • Quote

Post by dch24 » Tue Sep 14, 2010 9:49 pm

I think the problem is finding the right ld:

Code: Select all

$ 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...
Top
krotuss
Apprentice
Apprentice
Posts: 253
Joined: Fri Aug 01, 2008 6:11 pm

  • Quote

Post by krotuss » Tue Sep 14, 2010 9:57 pm

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: Select all

-openmp
into:

Code: Select all

GUSE="-fortran" # doesn't work
in avr section of case statement. So result should look like this:

Code: Select all

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";;
Top
dch24
Tux's lil' helper
Tux's lil' helper
Posts: 99
Joined: Thu Feb 15, 2007 2:27 am

  • Quote

Post by dch24 » Tue Sep 14, 2010 10:06 pm

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: Select all

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:
Top
amightywind
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 137
Joined: Tue Jun 01, 2004 2:47 pm
Location: Andover, MN USA

  • Quote

Post by amightywind » Tue Sep 21, 2010 2:03 am

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: Select all

cross-avr/gcc -openmp -fortran -selinux -boundschecking -d -gtk -gcj -libffi -mudflap -objc -objc++ -objc-gc
The compiler seems to work.
amightywind
Top
Post Reply

12 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic