[TriLUG] OT: cross compiling

Ed Hill ed at eh3.com
Tue May 9 11:58:17 EDT 2006


On Tue, 2006-05-09 at 08:16 -0700, Joseph Mack NA3T wrote:
> On Tue, 9 May 2006, Ed Hill wrote:
> 
> > What you've done above is a start but you left out a critical step.
> > What you really need to use is a program name prefix and/or suffix
> > ***PLUS*** a different --prefix=${SOME_PATH} so that ${SOME_PATH} does
> > not equal /usr.
> 
> I understand this, but I didn't know how to solve it.

Hi Joseph,

Sorry, I don't understand the above sentence!


> > For testing purposes, I typically use something like:
> >
> >  ./gcc-4.1.0/configure --prefix=/opt/gcc-4.1.0 \
> >    --enable-languages=c,c++,f95 --program-suffix=-4.1.0
> >
> > and you will want a similar syntax for binutils, etc...
> 
> assuming I'm producing the native compiler from the cross 
> compiler here and the native compiler (and its libraries) 
> winds up in /opt/gcc-x.x.x on the linux machine, then when I 
> tar| untar the native compiler onto the target machine in 
> /usr, will the native compiler be looking for its own files 
> (and libraries) in /opt/gcc-x.x.x or in /usr?

I haven't spent much time with cross-compilers but what you describe
above doesn't seem necessary to me.  If I was trying to boot-strap a
full compiler system onto a non-native platform then I would probably do
it in multiple stages:

 - build a local cross-compiler
 - build a compiler using the cross-compiler and install it 
     in a non-/usr location on the remote machine
 - using the non-/usr compiler on the remote machine, build a 
     full native compiler

None of the above stages involve doing a "make install" on the local
(starting) platform that overwrote any system things in /usr.  I just
don't see why you would ever need (or even *want*) to do that -- its
such a bad idea...

Also, there are many ways to deal with libraries including:

 - build executables with static linkage
 - specify rpaths (see "man ld" for details)
 - add dirs to ld.so.conf
 - use the old stand-by: "export LD_LIBRARY_PATH=..."

Ed

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464





More information about the TriLUG mailing list