A crossgcc target=powerpc-eabi report

Andersson Jan Janh.Andersson@ericsson.com
Sat Apr 1 00:00:00 GMT 2000


Hi there,
all crossgcc subscribers, maybe some of you could have some interest
reading this little report.

If so, enjoy :)

/Janne

========================================================

    Summary for the crossgcc building procedure.

I'm trying to build a crossgcc targeting embedded powerpc (ppc-eabi).
I have no previous experience of crossgcc building and hopefully
someone with more expertise in this area could bring some useful
hints and comments on the subject.

I have built and installed a "native" version of gcc, gdb and a lot
of other excellent GNU-tools and thought I was in a pretty good shape
for "cross-building". At the beginning, I was reading crossgcc FAQ
and got some useful information about how to do it, well, no problems,
what could be easier?

Below follows the steps I was taking, probably I did a lot of
stupid things but at the end, I got myself a ppc-eabi-gcc.


In my ~/gnu directory I have "unzipped" (gtar -xvzf xxx.tgz xxx)
binutils-2.9.1, gcc-2.95.2, gdb-4.18, newlib-1.8.2
and a building directory called
ppc-eabi where I have these directorys
binut, gcc, gdb and newlib
I also have an environment variable
CROSS_ENV = ~/gnu/TOOLS

1. start with building binutils from ~/gnu/ppc-eabi/binut
## first we do the binutil stuff ppc-eabi-(as, ld ...)
 > cd binut
 > ../../binutils-2.9.1/configure --target=ppc-eabi --prefix=$CROSS_ENV -v
 > make all install

GOOD! no problems I have all binutils ppc-eabi-xx stuff.

2. Let's try crossgcc


#### 1. configure crossgcc for ppc-eabi
 > pwd
~/gnu/ppc-eabi/gcc

 > ../../gcc-2.95.2/configure --target=ppc-eabi --prefix=$CROSS_ENV \
--nfp --with-cpu=603e \
--with-gnu-as --with-gnu-ld --with-newlib \
--with-headers=~/gnu/newlib-1.8.2/newlib/libc/include \
--enable-languages=c -v >../gccconfig.log
--------  some outputs from the configuration program ---------------
Configuring for a sparc-sun-solaris2.7 host.
Links are now set up to build a cross-compiler for powerpc-unknown-eabi
  from sparc-sun-solaris2.7.
------------------------------------------------------------

As it will be lot's  of output from the configuration I prefer to
re-direct that information to a log-file (gccconfig.log), than
I can catch error messages more easily and it is quite simple to
use "emacs" to eyeball the log-file if necessary.
Further more, I'm only interested of a crossgcc-C version.
According to my opinion the  C++ stuff is of less importance
in the real-time embedded market.


## no complains during the configuration phase

 > tail ../gccconfig.log
--------- output ---------------
creating po/Makefile.in
creating fixinc/Makefile
creating auto-host.h
linking ../../../gcc-2.95.2/gcc/intl/libgettext.h to intl/libintl.h
creating libintl.h
Configuring etc...
loading cache ../config.cache
checking for a BSD compatible install... ../../../gcc-2.95.2/etc/../install-sh -c
creating ./config.status
creating Makefile
--------------------------------

OK! if configur has nothing to complain abot, I will continue with


> make cross install >../makegcc.log
---------- some 20 minutes later -------------
make[1]: *** No rule to make target `c++', needed by `native'.  Stop.
make: *** [cross] Error 2
---------------------------------------------

D..m! I was not interested in C++.


##### what to do? rerun with this

 > make cross LANGUAGES="c c++" install > ../make2gcc.log
---------- some time later -------------
make[1]: *** No rule to make target `c++', needed by `native'.  Stop.
make: *** [cross] Error 2
---------------------------------------------


##### one last desperate try  #######

 > make cross LANGUAGES="c" install > ../make3gcc.log
------------- error  -----------------
make[1]: *** No rule to make target `c++', needed by `native'.  Stop.
make: *** [cross] Error 2
---------------------------------------------

#### OK! I give up, lets try with some new configuration
# I'm not shore about how mutch I need to clean, 
# maybe this is a little to mutch but ...
#
 > pwd
~/gnu/ppc-eabi/gcc
 > cd ..
 > rm -rf gcc
 > mkdir gcc
 > cd gcc

Obviously, the LANGUAGES macro is not supported or ...?

After some more crossgcc digging I found an article in embedded system
by Bill Gatliff regarding the crossgcc isue.
( Thank's Bill, I'll try it. :)

#  1. replace libf2c with newlib in gcc-2.95.2 directory
%315> cd ../../gcc-2.95.2/
%316> ls
%317> mv libf2c xxlibf2c     # (insted of rm -rf :)
%318> ln -s ../newlib-1.8.2/newlib .

### than go back to my building crossgcc directory

%322> back
%323> pwd
~/gnu/ppc-eabi/gcc
%324> ls
total 0

### Run configure and take a coffee-break

%325> ../../gcc-2.95.2/configure --target=ppc-eabi --prefix=$CROSS_ENV \
--with-gnu-as --with-gnu-ld --with-newlib \
--with-headers=~/gnu/newlib-1.8.2/newlib/libc/include \
-v >../configgcc2.log


OK! configuration done, let's run

329> make cross LANGUAGES="c c++" install >../make4gcc.log
------------  about 20 minutes later  ------------
./fixinc.sh: ./fixinc.sh: cannot open
make[1]: *** [stmp-fixinc] Error 1
make: *** [cross] Error 2
-------------------------------------------------


#### NOK! check end of log file ######

334> tail -30 ../make4gcc.log
gcc -DCROSS_COMPILE -DIN_GCC -DHAIFA  -DSVR4  -g -O2  -DHAVE_CONFIG_H  -o collect2 collect2.o tlink.o hash.o intl.o underscore.o version.o  obstack.o alloca.o       ../libiberty/libiberty.a
cp xgcc gcc-cross
~/gnu/ppc-eabi/gcc/gcc/xgcc -B~/gnu/ppc-eabi/gcc/gcc/ -B~/gnu/TOOLS/ppc-eabi/bin/ -I~/gnu/TOOLS/ppc-eabi/include -dumpspecs > tmp-specs
mv tmp-specs specs
touch stmp-headers
rm -rf include; mkdir include
TARGET_MACHINE=powerpc-unknown-eabi; srcdir=`cd ../../../gcc-2.95.2/gcc; pwd`; \
INSTALL_ASSERT_H=install-assert-h; SHELL=/bin/sh ;\
export TARGET_MACHINE srcdir INSTALL_ASSERT_H SHELL ; \
/bin/sh ./fixinc.sh `pwd`/include ~/gnu/TOOLS/ppc-eabi/sys-include 
make[1]: Leaving directory `~/gnu/ppc-eabi/gcc/gcc'
%335> 
--------------------------------------------------

###
# Configure has built the gcc/fixinc directory with a Makefile
# but that Makefile is never used to produce the fixinc.sh in current
# gcc building directory, WHY???
# (there was no fixinc problem during the "native" gcc build) 

%337> ls gcc/f*
----------------------------------------
 224 gcc/final.o         304 gcc/fold-const.o
 280 gcc/flow.o          376 gcc/function.o

gcc/f:
total 56          56 Makefile      0 stage2@       0 stage4@
   0 include@      0 stage1@       0 stage3@

gcc/fixinc:
total 16          16 Makefile
----------------------------------------

Well, I also found this.
===========   from ../../../gcc-2.95.2/gcc/fixinc/README =============
POSSIBLE PROBLEMS

There may be some systems on which the fixinc binary program appears
to be functional, but fails to work.  Current thinking is that this
is due to some new process limitations (fork() calls) on those
systems.  If you are experiencing this problem, then copy the script
${src}/gcc/fixinc/inclhack.sh into ${builddir}/gcc/fixinc.sh and run
make again.

And, *please* also report the problem with a description of
the failure mode (symptoms) and the output from:

        egcs/config.guess

to me:  Bruce Korb <fixincludes@autogen.freeservers.com>

TO DO

* fixincl needs to be converted to use gcc's system.h, libiberty, and
  other portability frameworks.

===========================================================

#######  OK, but I doubt it will help :(

338> cp ../../gcc-2.95.2/gcc/fixinc/inclhack.sh gcc/fixinc.sh

######## 
%340> make cross LANGUAGES="c " install > ../make5gcc.log

-----------  some error messages  (stderr output) -------------

fix-header: In file included from ~/gnu/ppc-eabi/gcc/gcc/include/math.h:10:
~/gnu/TOOLS/ppc-eabi/sys-include/machine/ieeefp.h:151: #error Endianess not declared!!
~/gnu/ppc-eabi/gcc/gcc/include/syslimits.h:7: warning: #include_next in primary source file
fix-header: In file included from ~/gnu/TOOLS/ppc-eabi/sys-include/dirent.h:4:
~/gnu/TOOLS/ppc-eabi/sys-include/sys/dirent.h:12: No include path in which to find dirent.h
fix-header: fixing signal.h
~/gnu/TOOLS/ppc-eabi/sys-include/termios.h:4: sys/termios.h: No such file or directory
fix-header: fixing time.h
~/gnu/TOOLS/ppc-eabi/sys-include/sys/dirent.h:12: warning: #include_next in primary source file
fix-header: In file included from ~/gnu/TOOLS/ppc-eabi/sys-include/dirent.h:4,
                 from ~/gnu/TOOLS/ppc-eabi/sys-include/sys/dirent.h:12:
~/gnu/TOOLS/ppc-eabi/sys-include/sys/dirent.h:12: No include path in which to find dirent.h
~/gnu/TOOLS/ppc-eabi/sys-include/machine/ieeefp.h:151: #error Endianess not declared!!
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
make[2]: [stmp-multilib-sub] Error 1 (ignored)
../../../gcc-2.95.2/gcc/libgcc1-test.c:101: warning: conflicting types for built-in function `memcpy'
cxxmain.c: In function `main':
cxxmain.c:4527: warning: assignment discards qualifiers from pointer target type
cxxmain.c:4530: warning: assignment discards qualifiers from pointer target type
../../../gcc-2.95.2/gcc/libgcc1-test.c:101: warning: conflicting types for built-in function `memcpy'

##--------------  then, two hours later  -----------------
##      this output was produced :(((

make[1]: *** [install-info] Error 1
make: *** [install-gcc] Error 2

---------------------------------------  

## check the logfile to get any hint about what was going on
%341> 
291> tail make5gcc.log 
------------- output  -----------
rm -f ~/gnu/TOOLS/lib/gcc-lib/ppc-eabi/2.95.2/lang-f77
rm -f ~/gnu/TOOLS/info/cpp.info* ~/gnu/TOOLS/info/gcc.info*
for f in cpp.info* gcc.info*; do \
    /bin/sh ~/gnu/gcc-2.95.2/install-sh -c -m 644 $f ~/gnu/TOOLS/info/$f; \
done
install:  cpp.info* does not exist
install:  gcc.info* does not exist
make[1]: Leaving directory `~/gnu/ppc-eabi/gcc/gcc'
-------------------------------------

For the moment, info is of less importance and I did:

314> touch gcc/gcc.info
%315> touch gcc/cpp.info
%316> ls gcc/*.info
   0 gcc/cpp.info      0 gcc/gcc.info
%317> 

## then we have some dummy info files
%317> make  install-gcc-cross >../install-gcc-cross.log
-----------  error again -------------
install-info: ~/gnu/TOOLS/info/cpp.info: empty file
install-info: ~/gnu/TOOLS/info/gcc.info: empty file
make[1]: [install-info] Error 1
---------------------------------


#########################################################
##  OK! lets try to ignore ( -i ) the info crap

%401> make -i install > ../install-gcc-cross2.log
-------------  error outputs ------------
../../../../gcc-2.95.2/gcc/f/com.c: In function `ffecom_possible_partial_overlap_':
../../../../gcc-2.95.2/gcc/f/com.c:1599: warning: unused parameter `expr2'
chmod: WARNING: can't access ~/gnu/TOOLS/bin/g77
make[1]: [f77.install-common] Error 1 (ignored)
install-info: ~/gnu/TOOLS/info/cpp.info: empty file
install-info: ~/gnu/TOOLS/info/gcc.info: empty file
make[1]: [install-info] Error 1 (ignored)
-----------------------------------


### (((( Yes! YEs! YES! look what we have!! :))))
-----------------------------------------
~/gnu/TOOLS/bin/ppc-eabi-gcc*
~/gnu/TOOLS/bin/ppc-eabi-unprotoize*
~/gnu/TOOLS/bin/ppc-eabi-protoize*
~/gnu/TOOLS/bin/ppc-eabi-gcj*
~/gnu/TOOLS/bin/ppc-eabi-c++filt*
~/gnu/TOOLS/bin/ppc-eabi-c++*
~/gnu/TOOLS/bin/ppc-eabi-g++*
~/gnu/TOOLS/bin/ppc-eabi-chill*
-----------------------------------------

That's all folk's, I will verify the ppc-cross compiler before
I'm trying to build a cross-gdb.
If anyone has experience about cross-gdb building problems,
please give me a hint.

I have a more detailed "command - output" info about my adventure
"copied" from the screen to this emacs-buffer
If you think you have any interest in that, just let me know.

Else
Bye for now.

/ Janne

-- 
Jan H Andersson
Wireless LAN Systems
Esplanaden 3C SUNDBYBERG
SE-164 80 STOCKHOLM, Sweden
Phone No: +46 8 585 34130
E-mail: Janh.Andersson@ericsson.com


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list