public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: linking newlib (libc.a crt0.o) for powerpc-ibm-eabi target on i686-pc-cygwinhost
@ 2001-09-14  8:20 Anthony P Ferranti
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony P Ferranti @ 2001-09-14  8:20 UTC (permalink / raw)
  To: newlib, crossgcc, binutils, gcc-help

Thanks to the replies posted to newlib@sources.redhat.com I am now able to
accomplish what I want to do.  Thanks to those who assisted.  If anyone is
reading this because they are experiencing similar problems I would suggest
that they read the replies there.  There is an excellent explanation of the
newlib environment and a helpful FAQ web site which answers some additional
questions.

Regards,
Tony Ferranti

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

* linking newlib (libc.a crt0.o) for powerpc-ibm-eabi target on i686-pc-cygwinhost
@ 2001-09-13 14:14 Anthony P Ferranti
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony P Ferranti @ 2001-09-13 14:14 UTC (permalink / raw)
  To: newlib, crossgcc, gcc-help, binutils

I am experiencing problems when cross-compiling programs with GCC that
involve a linking stage.  I believe they are related to the library
"libc.a" and the startup file "crt0.o".  It is my understanding that these
files are installed with newlib and they appear to be present.  This
appears to be the same problem Dan Alderman experienced on Feb 12, 2001 and
posted to this mailing list.  Dan, if you could remember how you solved
this problem your help would be greatly apprecieated.  I am new to the UNIX
environment and C-programming.  Building GCC as a cross-compiler has been
my first project so I'm a bit confused.  I've tried reading all the FAQs
and mailing lists to no avail.  Any help is greatly appreciated.

Here is what I did to install an i686-pc-cygwin hosted powerpc-unknown-eabi
cross-compiler in "/usr/local".  Source files were unpacked into
"/usr/local/src".  Packages were built in "/usr/local/obj"...


cygwin$  host=i686-pc-cygwin
cygwin$  build=$host
cygwin$  target=powerpc-unknown-eabi
cygwin$  prefix=/usr/local
cygwin$  srcroot=$prefix/src
cygwin$  buildroot=$prefix/obj


First, I configure, build, and install binutils...


cygwin$  mkdir -p $buildroot/binutils
cygwin$  cd $buildroot/binutils
cygwin$  $srcroot/binutils-2.10.1/configure \
   --with-included-gettext \
   --host=$host --target=$target --build=$build \
   --prefix=$prefix -v
cygwin$  make >make.log 2>&1
cygwin$  make install >install.log 2>&1


Next, I configure, build, and install the GCC C compiler...


cygwin$  mkdir -p $buildroot/gcc
cygwin$  cd $buildroot/gcc
cygwin$  $srcroot/gcc-2.95.3-5/configure \
   --enable-languages=c,c++ \
   --with-included-gettext \
   --with-cpu=powerpc \
   --host=$host --target=$target --build=$build \
   --with-newlib \
   --prefix=$prefix -v
cygwin$  make LANGUAGES=c all-gcc >make_c_only.log 2>&1
cygwin$  make LANGUAGES=c install-gcc >install_c_only.log 2>&1


Next, I configure, build, and install newlib...


cygwin$  mkdir -p $buildroot/newlib
cygwin$  cd $buildroot/newlib
cygwin$  $srcroot/newlib-1.9.0/configure \
   --host=$host --target=$target --build=$build \
   --prefix=$prefix -v
cygwin$  make >make.log 2>&1
cygwin$  make install >install.log 2>&1


Next, I configure, build, and install the remaining GCC compilers, and
language runtime and/or support libraries...


cygwin$ cd $buildroot/gcc
cygwin$ make >make.log 2>&1
cygwin$ make install >install.log 2>&1


At this point, I I realize there are problems during compiles with a
linking stage.  After reading numerous FAQs, mailing list archives, etc, I
try to reconfigure, rebuild, and reinstall newlib with some additional
options...


cygwin$  cd $buildroot/newlib
cygwin$  mv make.log make.log.old
cygwin$  mv install.log install.log.old
cygwin$  make distclean
cygwin$  $srcroot/newlib-1.9.0/configure \
   --host=$host --target=$target --build=$build \
   --prefix=$prefix -v
cygwin$  make \
   CC_FOR_TARGET=$prefix/bin/$target-gcc \
   AS_FOR_TARGET=$prefix/bin/$target-as \
   LD_FOR_TARGET=$prefix/bin/$target-ld \
   AR_FOR_TARGET=$prefix/bin/$target-ar \
   RANLIB_FOR_TARGET=$prefix/bin/$target-ranlib \
   NM_FOR_TARGET=$prefix/bin/$target-nm \
   >make.log 2>&1
cygwin$  make install >install.log 2>&1


These are the problems I am experiencing...


cygwin$  $target-gcc helloworld.c
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/../../../../powerpc-unknown-eabi/bin/ld:

warning: cannot find entry symbol _start; defaulting to 01800074
/c/TEMP/ccWya32M.o: In function `main':
/c/TEMP/ccWya32M.o(.text+0x24): undefined reference to `printf'
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/libgcc.a(eabi.o)
(.got2+0x8): undefined reference to `__SDATA_START__'
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/libgcc.a(eabi.o)
(.got2+0xc): undefined reference to `__SBSS_END__'
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/libgcc.a(eabi.o)
(.got2+0x14): undefined reference to `__SDATA2_START__'
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/libgcc.a(eabi.o)
(.got2+0x18): undefined reference to `__SBSS2_END__'
/usr/local/lib/gcc-lib/powerpc-unknown-eabi/2.95.3-5/libgcc.a(eabi-ctors.o):

In function `__do_global_ctors':
/usr/local/obj/gcc/gcc/eabi-ctors.c(.sdata+0x0): undefined reference to
`__init'
/usr/local/obj/gcc/gcc/eabi-ctors.c(.sdata+0x4): undefined reference to
`__fini'
collect2: ld returned 1 exit status


I believe that _start is supposed to be defined in crt0.o but I added -e
main to bypass this.  Does anyone know ehat eabi.o does or why eliminating
it reduces the errors?  Here is what I tried next...


cygwin$  $target-gcc -e main -mno-eabi helloworld.c
/c/TEMP/ccwCYRid.o: In function `main':
/c/TEMP/ccwCYRid.o(.text+0x20): undefined reference to `printf'
collect2: ld returned 1 exit status


Next I added the -L\usr\local\$target\lib command.  There are files called
libc.a and crt0.o in that directory.  This had no effect...


cygwin$  $target-gcc -e main -mno-eabi -L\usr\local\$target\lib
helloworld.c
/c/TEMP/ccFfHYTg.o: In function `main':
/c/TEMP/ccFfHYTg.o(.text+0x20): undefined reference to `printf'
collect2: ld returned 1 exit status


Finally I added the -lc to force libc.a to be linked.  Again, no effect...


cygwin$  $target-gcc -e main -mno-eabi -L\usr\local\$target\lib -lc
helloworld.c
/c/TEMP/ccTbWSZk.o: In function `main':
/c/TEMP/ccTbWSZk.o(.text+0x20): undefined reference to `printf'
collect2: ld returned 1 exit status


Any sugestions???  if I add the -msim option it compiles correctly for the
simulation board but in that case libc.a and crt0.o are not used.

Regards,
Tony Ferranti
ferranti@us.ibm.com

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

end of thread, other threads:[~2001-09-14  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-14  8:20 linking newlib (libc.a crt0.o) for powerpc-ibm-eabi target on i686-pc-cygwinhost Anthony P Ferranti
  -- strict thread matches above, loose matches on Subject: below --
2001-09-13 14:14 Anthony P Ferranti

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).