Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
getting started with 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
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Sat May 18, 2013 10:27 am    Post subject: getting started with crossdev Reply with quote

Want to install crossdev to take the compiling work off of older machines.

Search for "gentoo crossdev" - first link is: http://www.gentoo.org/proj/en/base/embedded/cross-development.xml

Last updated 20060822.

"This guide is outdated by the Embedded Handbook. Please use that from now on."

OK, go to: http://www.gentoo.org/proj/en/base/embedded/handbook/

Installed crossdev.

Based on this page: http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=2, I tried selecting the target:

Code:

# crossdev -S -v -t i686-pc-linux-gnu
------------------------------------------------------------------------------------------------------------------------------------
 * crossdev version:      20120721
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   x86
 * Target System:         i686-pc-linux-gnu
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[stable]
 * gcc:                   gcc-[stable]
 * headers:               linux-headers-[stable]
 * libc:                  glibc-[stable]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:   
 * Portage flags:          -v
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -

 * please convert /etc/portage/package.env to a directory
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-i686-pc-linux-gnu-info.log


Side question - how do I move CROSSDEV_OVERLAY to a different directory?

Nothing is mentioned about converting /etc/portage/package.env to a directory (I don't even like the idea behind /etc/portage/package.env - it seems like a kludge to overcome non-working implementations of the way other /etc/portage files should work).

The next chapter (http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=3) has a link to a crossdev guide:

http://www.gentoo.org/proj/en/base/embedded/handbook/cross-compiler.xml

Looks like an older version of chapter two (why does chapter three refer there instead of to chapter two?). Last updated 20100413, and still nothing about /etc/portage/package.env.

The documentation that comes with the crossdev itself seems (to put it mildly) lacking.

Is there any documentation that describes how to get this to work?
Back to top
View user's profile Send private message
Maitreya
Guru
Guru


Joined: 11 Jan 2006
Posts: 441

PostPosted: Sat May 18, 2013 11:41 am    Post subject: Reply with quote

Foreach "package.*" files in /etc/portage :

mv /etc/portage/package.keywords /etc/portage/mykeywordsfile
mkdir /etc/portage/package.keywords
mv /etc/portage/mykeywordsfile /etc/portage/portage.keywords/mykeywordsfile

etc.

This way you can have several different configs and is required for crossdev to work I guess.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Sun May 19, 2013 2:04 am    Post subject: Reply with quote

What the heck is "mykeywordsfile" (I assume that is not literal)?

And how do I move the crossdev overlay out of /usr/local/portage/?
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Wed May 22, 2013 8:49 am    Post subject: Reply with quote

Can anyone help with this?
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Thu May 23, 2013 10:30 am    Post subject: Reply with quote

The current crossdev requires /etc/portage to contain directories, not
files, so the /etc/portage layout becomes in part:
Code:

env:
  cross-armv7-none-linux-gnueabi
  cross-avr
package.env:
  cross-armv7-none-linux-gnueabi
package.keywords:
  cross-armv7-none-linux-gnueabi
  keywords
package.mask:
  cross-armv7-none-linux-gnueabi
  mask
package.use:
  cross-armv7-none-linux-gnueabi
  use

(Some of the cross-avr files are apparently missing because that cross-compiler
was built with crossdev < 2012)

My notes on the x86 => AVR cross-compiler say:
Code:

Tue Mar  6 10:26:51 GMT 2012
The crossdev avr standard build is:
 USE="-openmp" crossdev -t avr -s4 -S --without-headers
which defaults to:
  sys-devel/binutils:       2.21.1-r1
  sys-devel/gcc:            4.5.3-r1
  dev-embedded/avr-libc:    1.6.2
and gives the error:
  avr-libc-1.6.2/temp/ccGsIBs6.s: Error: .size expression for strlcat_P
  does not evaluate to a constant
Building the package with:
  USE="-openmp" crossdev --target avr --gcc 4.5.3-r1 --binutils 2.21.1-r1 \
  --libc 1.6.8 --without-headers
works ok, although the man pages end up scattered. However, the compiler
fails to build correct binaries. Use the arduino version for now.

Wed May 16 11:41:04 BST 2012
Used crossdev to remove and rebuild the avr-gcc compiler after adding the
R20 patch, which seemed to install ok.

Fri Jun 15 11:03:03 BST 2012
AVR cross-compiler patches:
    Patch crossdev Bug 147155 attachment 308991 (avr-multilib.patch)
                   Bug 147155 attachment 309069 (avr-ldscripts-symlink.patch)
                   Bug 147155 attachment 309071 (ebuild)
    Overlaps with  Bug 378387 attachment 285901 (crossdev-378387_2.patch)
    Patch portage  Bug 406765 (toolchain.eclass, hand patched)
    Patch gcc      Bug 377039 attachment 294749 (gcc-005-constructor.patch)
    Patch Arduino Ethernet library (W5100)

Updated crossdev-20111118.ebuild with crossdev-378387_2.patch.
Hand-patched /usr/portage/eclass/toolchain.eclass with:
    http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.523&r2=1.524
Updated gcc-4.5.3-r1 (NB. not -r2) with gcc-005-constructor.patch.

Sat Feb 23 13:50:42 GMT 2013
All the 2012 crossdevs require /etc/portage to contain directories, not files,
so reverted to 20111118 (20111221 should also work).  However, gcc 4.5.3 has
been updated, so the final build was:
  USE="-openmp" crossdev --target avr --gcc 4.5.3-r2 --binutils 2.21.1-r1 \
  --libc 1.6.8 --without-headers

There is still a warning:
  !!! WARNING - Cannot auto-configure CHOST avr
  !!! You should edit /usr/avr/etc/portage/make.conf
  !!! by hand to complete your configuration
    * Log: /var/log/portage/cross-avr-binutils.log

For the x86 => arm cross-compilation, using the new directory layout,
see my posts https://forums.gentoo.org/viewtopic-t-959172.html

Good luck - Will
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Fri May 24, 2013 2:20 am    Post subject: Reply with quote

cwr wrote:
The current crossdev requires /etc/portage to contain directories, not
files, so the /etc/portage layout becomes in part:


The formatting there was confusing. I also have a question about Maitreya's comment. Do I need to create make.conf files in each directory as well?

Can you paste the output of "ls -Ral /etc/portage" (I think that would help a lot)?

cwr wrote:
For the x86 => arm cross-compilation, using the new directory layout,
see my posts https://forums.gentoo.org/viewtopic-t-959172.html


That did not seem straight forward at all (but thanks for posting it - I guess I will just have to trudge through it).
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Fri May 24, 2013 8:15 am    Post subject: Reply with quote

At the moment you (probably) have a file package.use in /etc/portage. Rename it to
eg: "use", and make a directory /etc/portage/package.use. Then move the /etc/portage/use
file to the directory /etc/portage/package.use. Repeat the trick for package.keywords,
package.env, and package.mask (if they aren't already directories).

Crossdev does a lot of messing around; I generally find it easiest to let it do whatever
it wants, and then go around afterwards with a spiked stick and clean up the litter.

Reference the arm build posting, all you have to do is _fetch_ (not install) gcc-4.7x,
and then run the crossdev command I listed in footnote B. It's worked a couple of times
for me now, so you should be ok.

Will
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri May 24, 2013 10:56 am    Post subject: Reply with quote

cwr wrote:
Crossdev does a lot of messing around; I generally find it easiest to let it do whatever
it wants, and then go around afterwards with a spiked stick and clean up the litter.

Have you tried it with PORTAGE_CONFIGROOT?
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Fri May 24, 2013 9:47 pm    Post subject: Reply with quote

cwr wrote:
At the moment you (probably) have a file package.use in /etc/portage. Rename it to
eg: "use", and make a directory /etc/portage/package.use. Then move the /etc/portage/use
file to the directory /etc/portage/package.use. Repeat the trick for package.keywords,
package.env, and package.mask (if they aren't already directories).


THAT certainly seems easy enough to follow, but I thought the whole purpose of this exercise was to allow different package files for each target architecture. If I just have one package.use file in the directory, it doesn't seem to have added much. :)

And what about make.conf? Isn't there generally different settings for each target architecture? I suppose some of the differences could go into files such as package.use (but I still don't see how to specify different package.use files for each target).
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Sat May 25, 2013 8:17 am    Post subject: Reply with quote

curmudgeon wrote:

And what about make.conf? Isn't there generally different settings for each target architecture? I suppose some of the differences could go into files such as package.use (but I still don't see how to specify different package.use files for each target).


Look under /etc/portage/env/whatever (after running crossdevl, which seems to set up that directory).

Will
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