This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, I'm having problems compiling the simplist of programs (i.e. the infamous helloworld.c) using newlib for this target. As I'm unsure as to where the problem is (although I am suspoecting the linker) and I'm using all three packages mentioned I have posted this to all the relevant mainling lists. I will explain the steps I have taken hoping that someone here may have the answer. It may be something foolish; I am new to compiling gcc with newlib for embedded targets, if it is then I appologise in advance. I am using binutils-2.10.2.tar.gz, gcc-2.95.2.tar.gz and newlib from the cvs tree (I have tried newlib-1.9.0.tar.gz with the same errors). Having unpacked the sources into /export/sources I create empty parallel dirs in /export/sources for building in, so the directory structure in /export/sources looks like the following. ls CVS build-binutils gcc-2.95.2 newlib-cvs binutils-2.10.1 build-gcc newlib-1.9.0 from /export/sources I do the following. cd build-binutils ../binutils-2.10.1/configure --prefix=/export/usr --target=powerpc-ibm-eabi make make install Things happen and it all seems to work fine with no apparent errors. Next in the gcc-2.95.2 directory I do the following ln -s ../newlib-cvs/newlib newlib to create the symbolic link so newlib is built with the gcc build. Next I go to the build-gcc directory and issue the following (/export/usr/bin is in my PATH at this point) ../gcc-2.95.2/configure --prefix=/export/usr --target=powerpc-ibm-eabi --enable-languages="c" --with-gnu-as --with-gnu-ld --with-newlib make make install Again lots of things happen with no apparent errors and everything installs. Now, if I try to compile a 'plain' C program with no library calls in it everything works (apparently), but if I include any library calls the compilation fails at link time. Issuing the following to try and compile my helloworld.c program produces the following errors. powerpc-ibm-eabi-gcc helloworld.c /export/usr/powerpc-ibm-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 01800074 /tmp/ccsgOSlw.o: In function `main': /tmp/ccsgOSlw.o(.text+0x24): undefined reference to `printf' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x8): undefined reference to `__SDATA_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0xc): undefined reference to `__SBSS_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x14): undefined reference to `__SDATA2_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x18): undefined reference to `__SBSS2_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x1c): undefined reference to `__GOT_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x28): undefined reference to `__GOT_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x2c): undefined reference to `__GOT2_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x30): undefined reference to `__GOT2_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x34): undefined reference to `__FIXUP_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x38): undefined reference to `__FIXUP_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x4c): undefined reference to `__EXCEPT_START__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+0x50): undefined reference to `__EXCEPT_END__' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi-ctors.o)(.sdata+0x0): undefined reference to `__init' /export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi-ctors.o): In function `__do_global_ctors': /export/sources/build-gcc/gcc/eabi-ctors.c(.sdata+0x4): undefined reference to `__fini' collect2: ld returned 1 exit status Something I find odd is that in the final error the linker is looking in the source tree rather than in the built code, is this right? So... if I do the following to reduce the error I get these errors, powerpc-ibm-eabi-gcc -e main -mno-eabi -mcpu=823 helloworld.c /tmp/ccXU84tt.o: In function `main': /tmp/ccXU84tt.o(.text+0x1c): undefined reference to `printf' collect2: ld returned 1 exit status This appears to be the linker not knowing where printf is, or more specifically libc.a, so I try the following powerpc-ibm-eabi-gcc -e main -mno-eabi -mcpu=823 -L/export/usr/powerpc-ibm-eabi/lib/ helloworld.c and get the same error. I know that printf for some embedded targets is not defined as they have no concept of standard io, but I get the same errors with any other library calls (and prtinf appears to be defined here). Has anyone here been able to use gcc with binutils and newlib to create a cross compiler suite of tools for the powerpc-ibm-eabi target (i.e. a powerpc as a bare chip with no OS, i.e. Linux on it). Is there something I'm missing in the build process? Any help would be greatly appreciated. Many thanks, D. ===================================================================== Dan Alderman Software Engineer OneEighty Software Ltd. OneEighty Software Ltd. Phone: +44 20 8263 2333 The Lansdowne Building Fax: +44 20 8263 6314 2 Lansdowne Road Croydon Email: d.alderman@180sw.com CR9 2ER UK Under the Regulation of Investigatory Powers (RIP) Act 2000 together with any and all Regulations in force pursuant to the Act One Eighty Software Ltd reserves the right to monitor any or all incoming or outgoing communications as provided for under the Act. ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |