public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Cross Compile Gcc
@ 2007-05-12 14:11 none none
  2007-05-12 14:25 ` Tim Prince
  0 siblings, 1 reply; 7+ messages in thread
From: none none @ 2007-05-12 14:11 UTC (permalink / raw)
  To: Kai Ruottu; +Cc: gcc-help

Hi, Sorry for the delay in replaying,

You were right if I do sudo I have to export again. I did a sudo bash at the begining and I did not  used sudo again. Now the problem is new...

checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [configure-target-libmudflap] Error 1
make[1]: Leaving directory `/home/idipous/powerpc/build_gcc'
make: *** [all] Error 2

and for that matter I checked config.log and  I saw this:

configure:2320:17: error: gmp.h: No such file or directory
configure: In function 'main':
configure:2324: error: 'choke' undeclared (first use in this function)
configure:2324: error: (Each undeclared identifier is reported only once
configure:2324: error: for each function it appears in.)
configure:2324: error: expected ';' before 'me'
configure: failed program was:
#line 2319 "configure"
#include "confdefs.h"
#include "gmp.h"
int main() {

#if __GNU_MP_VERSION < 3
choke me
#endif

why is this?

any help?



I do not want to build for an Ubuntu powerpc. It is for a university
essay (in order to get my diploma)  and I have an embedded powerpc
having Linux 2.2.0. 

I think at a later point I will have to download the kernel 2.2.0 and use its headers.  

This is a part of what I intend to do but so far I was not  able to make the cross compile. 

----- Original Message ----
From: Kai Ruottu <karuottu@mbnet.fi>
To: none none <menwn@yahoo.co.uk>
Cc: gcc-help@gcc.gnu.org
Sent: Wednesday, 9 May, 2007 8:07:25 PM
Subject: Re: Cross Compile Gcc

none none wrote:

 > I have this very peculiar error when I try to make gcc for cross 
compilation with target a powerpc
 > on my Ubuntu 7.0.4 box. I keep getting the error:
 > make[2]: powerpc-linux-ar: Command not found
 >
 > and then I export the path with the command:
 > export PATH=$PATH:/opt/powerpc/bin

What will be told if you simply  write:

       sudo powerpc-linux-ar --version

as a command?  Is the command found or not after first using the 
'export' for redefining PATH?

Usually the $prefix/bin will be puts into the PATH definitions in the 
startup-scripts so when opening
a new terminal session the PATH is right and includes ALL the required 
search places...

 > I configure gcc with the command:
 > sudo /home/idipous/Desktop/gcc-4.1.0/configure --target=powerpc-linux 
--prefix=/opt/powerpc/
 > --disable-shared --disable-threads --enable-languages=c --with-newlib

The 'sudo' probably starts a new shell session as 'root', reads the 
startup scripts for root and uses the
PATH got from them... And your earlier 'export' command probably was 
totally vain and forgotten...

BTW, what is your goal for the $target ?  Someone using Ubuntu 7.0.4/x86 
or .../x86_64  could
be expected to be interested to crosscompile to Ubuntu 7.0.4/PPC but 
your configure command
clearly tells this not being the case at all!  A 
Ubuntu/x86-X-Ubuntu/PPC  cross-GCC build will
succeed in only one build step, producing C/C++/Fortran/Java etc. 
compilers and all the shared libs
with threads support etc.







	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross Compile Gcc
  2007-05-12 14:11 Cross Compile Gcc none none
@ 2007-05-12 14:25 ` Tim Prince
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Prince @ 2007-05-12 14:25 UTC (permalink / raw)
  To: none none; +Cc: Kai Ruottu, gcc-help

none none wrote:
> Hi, Sorry for the delay in replaying,
>
> You were right if I do sudo I have to export again. I did a sudo bash at the begining and I did not  used sudo again. Now the problem is new...
>
> checking for C compiler default output file name... configure: error: C compiler cannot create executables
> See `config.log' for more details.
> make[1]: *** [configure-target-libmudflap] Error 1
> make[1]: Leaving directory `/home/idipous/powerpc/build_gcc'
> make: *** [all] Error 2
>
> and for that matter I checked config.log and  I saw this:
>
> configure:2320:17: error: gmp.h: No such file or directory
> configure: In function 'main':
> configure:2324: error: 'choke' undeclared (first use in this function)
> configure:2324: error: (Each undeclared identifier is reported only once
> configure:2324: error: for each function it appears in.)
> configure:2324: error: expected ';' before 'me'
> configure: failed program was:
> #line 2319 "configure"
> #include "confdefs.h"
> #include "gmp.h"
> int main() {
>
> #if __GNU_MP_VERSION < 3
> choke me
> #endif
>
> why is this?
>
>   
<context snipped due to top posting>
You may not have identified the test which led to "cannot create 
executables."  This one appears to be testing whether you are using at 
least gcc-3.0, so it should not have failed an any current gcc installation.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross Compile Gcc
  2007-05-12 15:59 none none
@ 2007-05-13 17:38 ` Kai Ruottu
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Ruottu @ 2007-05-13 17:38 UTC (permalink / raw)
  To: none none; +Cc: gcc-help

none none wrote:

 > My target system is a powerpc running linux-2.2.

But this has no 'glibc' yet installed in it, the '/lib', '/usr/lib' and 
'/usr/include' on the Linux-2.2 system are
mainly empty?  An usual cross GCC for something uses the prebuilt target 
C library "as it is", copied onto
the cross host, nowadays onto some $sysroot (please see later)...

In that Ubuntu/PPC case installing its prebuilt glibc below some 
$sysroot would be one of the prerequisites
before starting to build GCC....

When starting from absolute scratch - no Linux etc. on the target system 
- one must use some bootstraping
methods like using a glibc from some "similar system" - a glibc made for 
Linux/PPC in your case, or some
"bolshevism" like the "crosstool" when for some political reasons not 
accepting any prebuilt "bootstrap"
components ("Don't use anything the capitalism has created, start 
everything from absolute scratch!")....

 > So in order to build glibc I got the kernel from kernels.org and 
unpacked it.

You mean that you also downloaded some (maybe newer) Linux kernel in 
order to get the kernel headers,
'include/linux' and 'include/asm*' ?  The target system didn't have any 
although it had Linux?

 > Then I configure with the command:
 > configure --prefix=/home/idipous/powerpc/

When one builds glibc, one of the mail goals is to install it onto the 
target system, to serve as the "runtime
libraries" there.  Linux usually has its runtime in '/lib' and 
'/usr/lib' and in this "usual" case the $prefix is fixed
to be '/usr', so usually '--prefix=/usr' in the glibc configure.  One 
shouldn't think where to put the built glibc
on the cross host but where to put it on the target host !  When needing 
to install onto the cross host,  one
uses the "install_root=$sysroot" option to put the alien glibc below 
some chosen $sysroot, for instance
'/opt/host-powerpc-linux/', onto '$sysroot/lib', '$sysroot/usr/lib', 
'$sysroot/usr/include' etc.  From this
$sysroot it is then easy to make a 1-to-1 copy onto the target system....

When configuring the cross binutils and cross GCC, there is that new 
'--with-sysroot=$sysroot' which
puts the binutils (mainly 'ld') and GCC to search the target C library 
below the $sysroot....

> --target=powerpc-linux --host=powerpc-linux --enable-add-ons=linuxthreads --with-headers=/home/idipous/powerpc/linux/include/asm-ppc
The '--with-headers=the_dir' should point to the 'include' where the 
kernel headers are, not to the
'include/asm' !  So the usual case is using 
'--with-headers=$sysroot/usr/include' after copying the
Linux kernel headers onto the chosen '$sysroot/usr/include/linux' and 
'$sysroot/usr/include/asm*'....

>  --with-binutils=/home/idipous/powerpc/bin/home/idipous/Desktop/linux/include/linux
 ??????   The 'binutils' are binaries running on the cross host....

> configure: error: GNU libc requires kernel header files from
> Linux 2.0.10 or later to be installed before configuring.
>   
I think that the 'include/linux/version.h' will be checked for the Linux 
kernel version...
> The kernel header files are found usually in /usr/include/asm and
> /usr/include/linux; make sure these directories use files from
> Linux 2.0.10 or later.  This check uses <linux/version.h>,
and here it was told....
> What I am doing wrong? is that the correct header files? Should I do something more or else than just copy them and point the configure script to them?
>   
Let's hope my explanations gave you some clues...

BTW, if your goal only is to build a cross GCC with which to produce 
apps and tools being run
on the target system, and the the target system already has its own, 
maybe "custom", glibc, then
you shouldn't (need to) rebuild the  glibc for the cross host, only copy 
it there!   In any remote
debugging case it is necessary to have identical runtimes on both the 
remote target and the cross
host running the remote debugger !  A function in another address on the 
target system than it is
seen on the runtime libraries on the cross host, is a serious "clash" 
between these two systems...


 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross Compile Gcc
@ 2007-05-12 15:59 none none
  2007-05-13 17:38 ` Kai Ruottu
  0 siblings, 1 reply; 7+ messages in thread
From: none none @ 2007-05-12 15:59 UTC (permalink / raw)
  To: gcc-help

It went away by typing make all-gcc install-gcc



Thanks.



One finally note though. My target system is a powerpc running linux-2.2. So in order to build glibc I got the kernel from kernels.org and unpacked it. Then I configure with the command:



configure --prefix=/home/idipous/powerpc/ --target=powerpc-linux --host=powerpc-linux --enable-add-ons=linuxthreads --with-headers=/home/idipous/powerpc/linux/include/asm-ppc --with-binutils=/home/idipous/powerpc/bin/home/idipous/Desktop/linux/include/linux 



--with-headers=/home/idipous/powerpc/linux/include/asm-ppc is where I have copied the kernel file after the untar. I get the error message:

configure: error: GNU libc requires kernel header files from
Linux 2.0.10 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 2.0.10 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.

What I am doing wrong? is that the correct header files? Should I do something more or else than just copy them and point the configure script to them?
I tried googling but I did not make any sense.

Thanks again
andreas


----- Original Message ----

From: Tim Prince <tprince@myrealbox.com>

To: none none <menwn@yahoo.co.uk>

Cc: Kai Ruottu <karuottu@mbnet.fi>; gcc-help@gcc.gnu.org

Sent: Saturday, 12 May, 2007 5:25:45 PM

Subject: Re: Cross Compile Gcc



none none wrote:

> Hi, Sorry for the delay in replaying,

>

> You were right if I do sudo I have to export again. I did a sudo bash at the begining and I did not  used sudo again. Now the problem is new...

>

> checking for C compiler default output file name... configure: error: C compiler cannot create executables

> See `config.log' for more details.

> make[1]: *** [configure-target-libmudflap] Error 1

> make[1]: Leaving directory `/home/idipous/powerpc/build_gcc'

> make: *** [all] Error 2

>

> and for that matter I checked config.log and  I saw this:

>

> configure:2320:17: error: gmp.h: No such file or directory

> configure: In function 'main':

> configure:2324: error: 'choke' undeclared (first use in this function)

> configure:2324: error: (Each undeclared identifier is reported only once

> configure:2324: error: for each function it appears in.)

> configure:2324: error: expected ';' before 'me'

> configure: failed program was:

> #line 2319 "configure"

> #include "confdefs.h"

> #include "gmp.h"

> int main() {

>

> #if __GNU_MP_VERSION < 3

> choke me

> #endif

>

> why is this?

>

>   

<context snipped due to top posting>

You may not have identified the test which led to "cannot create 

executables."  This one appears to be testing whether you are using at 

least gcc-3.0, so it should not have failed an any current gcc installation.









      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross Compile Gcc
  2007-05-09 11:30 none none
  2007-05-09 16:00 ` David Daney
@ 2007-05-09 17:03 ` Kai Ruottu
  1 sibling, 0 replies; 7+ messages in thread
From: Kai Ruottu @ 2007-05-09 17:03 UTC (permalink / raw)
  To: none none; +Cc: gcc-help

none none wrote:

 > I have this very peculiar error when I try to make gcc for cross 
compilation with target a powerpc
 > on my Ubuntu 7.0.4 box. I keep getting the error:
 > make[2]: powerpc-linux-ar: Command not found
 >
 > and then I export the path with the command:
 > export PATH=$PATH:/opt/powerpc/bin

What will be told if you simply  write:

       sudo powerpc-linux-ar --version

as a command?  Is the command found or not after first using the 
'export' for redefining PATH?

Usually the $prefix/bin will be puts into the PATH definitions in the 
startup-scripts so when opening
a new terminal session the PATH is right and includes ALL the required 
search places...

 > I configure gcc with the command:
 > sudo /home/idipous/Desktop/gcc-4.1.0/configure --target=powerpc-linux 
--prefix=/opt/powerpc/
 > --disable-shared --disable-threads --enable-languages=c --with-newlib

The 'sudo' probably starts a new shell session as 'root', reads the 
startup scripts for root and uses the
PATH got from them... And your earlier 'export' command probably was 
totally vain and forgotten...

BTW, what is your goal for the $target ?  Someone using Ubuntu 7.0.4/x86 
or .../x86_64  could
be expected to be interested to crosscompile to Ubuntu 7.0.4/PPC but 
your configure command
clearly tells this not being the case at all!  A 
Ubuntu/x86-X-Ubuntu/PPC  cross-GCC build will
succeed in only one build step, producing C/C++/Fortran/Java etc. 
compilers and all the shared libs
with threads support etc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross Compile Gcc
  2007-05-09 11:30 none none
@ 2007-05-09 16:00 ` David Daney
  2007-05-09 17:03 ` Kai Ruottu
  1 sibling, 0 replies; 7+ messages in thread
From: David Daney @ 2007-05-09 16:00 UTC (permalink / raw)
  To: none none; +Cc: gcc-help

none none wrote:
> Hi everyone,
> 
> 
> 
> I have this very peculiar error when I try to make gcc for cross compilation with target a powerpc on my Ubuntu 7.0.4 box. I keep getting the error:
> 
> 
> 
> make[2]: powerpc-linux-ar: Command not found
> 
> make[2]: *** [libgcc.a] Error 127
> 
> make[2]: Leaving directory `/opt/powerpc/build-gcc/gcc'
> 
> make[1]: *** [stmp-multilib] Error 2
> 
> make[1]: Leaving directory `/opt/powerpc/build-gcc/gcc'
> 
> make: *** [all-gcc] Error 2
> 
> 
> 
> The thing is that I have already build binutils 2.16 and 2.17 and I have tried with gcc 4.1.0 and 4.1.2 (and  some older versions as well, 3.3.2 etc).
> 
> 
> 
> I configure binutils with the command:
> 
> 
> 
> /home/idipous/Desktop/binutils-2.16/configure --target=powerpc-linux --prefix=/opt/powerpc 
> 
> 
> 
> and 
> 
> 
> 
> sudo make all install
> 
> 
> 
> and then I export  the path with the command:
> 
> 
> 
> export PATH=$PATH:/opt/powerpc/bin
> 
> 
> 
> I configure gcc with the command:
> 
> 
> 
> sudo /home/idipous/Desktop/gcc-4.1.0/configure --target=powerpc-linux --prefix=/opt/powerpc/ --disable-shared --disable-threads --enable-languages=c --with-newlib 
> 
> 
> 
> and then 
> 
> 
> 
> sudo make all-gcc install-gcc
> 
> 
> 
> This error I expected to have it in case I forgot to export the path in which the powerpc-linux-ar was in. But this is in the /opt/powerpc/bin.
> 
> 
> 
> It is driving me nuts. With older versions of gcc I have the same error with powerpc-linux-ranlib.
> 
> 
> 
> Any ideas?
> 

Well you say your target is powerpc-linux, but you also say 
--with-newlib.  Is that really correct?  I do similar mips builds all 
the time without problem, but I also specify --with-sysroot= so that the 
  system libraries and header files are found.

If you are trying to bootstrap a toolchain, you might give Crosstool a 
try.  It takes care of specifying all the fiddly options needed to 
bootstrap a toolchain.

David Daney

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Cross Compile Gcc
@ 2007-05-09 11:30 none none
  2007-05-09 16:00 ` David Daney
  2007-05-09 17:03 ` Kai Ruottu
  0 siblings, 2 replies; 7+ messages in thread
From: none none @ 2007-05-09 11:30 UTC (permalink / raw)
  To: gcc-help

Hi everyone,



I have this very peculiar error when I try to make gcc for cross compilation with target a powerpc on my Ubuntu 7.0.4 box. I keep getting the error:



make[2]: powerpc-linux-ar: Command not found

make[2]: *** [libgcc.a] Error 127

make[2]: Leaving directory `/opt/powerpc/build-gcc/gcc'

make[1]: *** [stmp-multilib] Error 2

make[1]: Leaving directory `/opt/powerpc/build-gcc/gcc'

make: *** [all-gcc] Error 2



The thing is that I have already build binutils 2.16 and 2.17 and I have tried with gcc 4.1.0 and 4.1.2 (and  some older versions as well, 3.3.2 etc).



I configure binutils with the command:



/home/idipous/Desktop/binutils-2.16/configure --target=powerpc-linux --prefix=/opt/powerpc 



and 



sudo make all install



and then I export  the path with the command:



export PATH=$PATH:/opt/powerpc/bin



I configure gcc with the command:



sudo /home/idipous/Desktop/gcc-4.1.0/configure --target=powerpc-linux --prefix=/opt/powerpc/ --disable-shared --disable-threads --enable-languages=c --with-newlib 



and then 



sudo make all-gcc install-gcc



This error I expected to have it in case I forgot to export the path in which the powerpc-linux-ar was in. But this is in the /opt/powerpc/bin.



It is driving me nuts. With older versions of gcc I have the same error with powerpc-linux-ranlib.



Any ideas?

Thanks in advance

Andreas















		
___________________________________________________________ 
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-13 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-12 14:11 Cross Compile Gcc none none
2007-05-12 14:25 ` Tim Prince
  -- strict thread matches above, loose matches on Subject: below --
2007-05-12 15:59 none none
2007-05-13 17:38 ` Kai Ruottu
2007-05-09 11:30 none none
2007-05-09 16:00 ` David Daney
2007-05-09 17:03 ` Kai Ruottu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).