This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Thanks a lot for info , Kai! It was most helpful. Here's where I stand: ( gcc* is the gcc-2.95.2 directory from which I am building my cross-compiler ) -Downloaded the 2.5 binaries for Powerpc OpenBSD with all the libs and headers -Created the link to the ppc obsd headers in my cross-tools/powerpc--openbsd/ directory. -Created the link to the PPC headers in the /usr/local/powerpc--openbsd -Copied all .a files from powerpc-openbsd binary/usr/lib to /cross-tools/powerpc--openbsd/lib -Commented out vsprintf.o in gcc*/powerpc--openbsd/ libiberty/ and gcc*/powerpc--openbsd/ libchill makefiles did a make clean and then make all install in the gcc-2.95.2 directory During biild there were several errors,: 1.couldn't find config files for ppc platform ( in gcc*/gcc/config/rs6000) Found them in src/gnu/egcs/gcc/config/rs6000 and copied them to gcc*/gcc/config/rs6000 the files it was missing were: openbsd.h t-openbsd xm-openbsd.h 2. confilicting types for sys_errlist in gcc*/powerpc--openbsd/ libiberty/strerror.c Turns out it checks for a flag HAVE_SYS_ERRLIST that is never defined and redefines the variable sys_errlist. 3. PATH_MAX undefined in in gcc*/powerpc--openbsd/ libchill/basicio.c 4. gcc*/ libiberty/strsignal.c: void psignal (signo, message) unsigned signo; char *message; the second parameter defined as const in the headers After that I had no errors - build and install completed. So far so good Now on to build a powerpc kernel with the cross-compiler. I have a little script called ppc-make ( which I lifted from netbsd be cross-compile FAQ) that sets up the correct location of the tools and then invokes make : #! /bin/sh MACHINE=openbsd export MACHINE MACHINE_ARCH=powerpc export MACHINE_ARCH WHICH=powerpc--openbsd LOCAL=/usr BINDIR=$LOCAL/cross-tools/bin PATH=$PATH:$BINDIR:$LOCAL/cross-tools/$WHICH/bin:$PATH:$LOCAL/cross-tools/bin ex port PATH GCC_EXEC_PREFIX=$WHICH AR=$BINDIR/$WHICH-ar export AR AS=$BINDIR/$WHICH-as export AS CC=$BINDIR/$WHICH-gcc export CC CPP=`$CC -print-prog-name=cpp` export CPP CXX=$BINDIR/$WHICH-c++ export CXX FC=$BINDIR/$WHICH-f77 export FC LD=$BINDIR/$WHICH-ld export LD NM=$BINDIR/$WHICH-nm export NM RANLIB=$BINDIR/$WHICH-ranlib export RANLIB SIZE=$BINDIR/$WHICH-size export SIZE ADDR2LINE=$BINDIR/$WHICH-addr2line export ADDR2LINE GASP=$BINDIR/$WHICH-gasp export GASP OBJCOPY=$BINDIR/$WHICH-objcopy export OBJCOPY OBJDUMP=$BINDIR/$WHICH-objdump export OBJDUMP STRINGS=$BINDIR/$WHICH-strings export STRINGS STRIP=$BINDIR/$WHICH-strip export STRIP MKPROFILE=no export MKPROFILE #MKMAN=no export MKMAN MKLINT=no export MKLINT HOSTED_CC=cc export HOSTED_CC MAKE=make export MAKE #MAKE="make -f ${DESTDIR}/usr/share/mk/sys.mk -f Makefile"; export MAKE #MAKEFLAGS="-I ${DESTDIR}/usr/share/mk" ; export MAKEFLAGS set -x exec $MAKE "$@" Also I added a -I /usr/cross-tools/powerpc--openbsd/lib to the LINKFLAGS variable of the kernel makefile. now finally: ./ppc-make depend ; and ./ppc-make Everything compiles but in the link phase I unresolved references ot bzero and bcomp ( which are declared in /src/sys/sys/systm.h/ now the questions: 1. Obviously : where are bzero and bcmp defined ? 2. from the description above do i have a functional cross- compiler or am I missing something? thanks a lot in advance Andy >Andy wrote: > >> I'm trying to build a cross compiler for powerpc OpenBSD on a i386 >> OpenBSD machine (2.5) >> >> I configured binutils with the following: >> configure ---host=$MACHTYPE --target=powerpc--openbsd >> --prefix=/usr/cross-tools -v >> This worked fine and built binutils. >> I then ran configure script for gcc with the same parameters and then ran >> make all install. >> There I get error: >> /usr/buildtools/gcc-2.95.2/gcc/xgcc -B/usr/buildtools/gcc-2.95.2/gcc/ >> -B/usr/cross-tools/powerpc--openbsd/bin/ -c -DHAVE_CONFIG_H -g -O2 -I. >> -I./../../include vsprintf.c >> vsprintf.c: In function `vsprintf': >> vsprintf.c:47: structure has no member named `_flag' >> vsprintf.c:47: `_IOWRT' undeclared (first use in this function) >> vsprintf.c:47: (Each undeclared identifier is reported only once >> vsprintf.c:47: for each function it appears in.) >> vsprintf.c:47: `_IOSTRG' undeclared (first use in this function) >> vsprintf.c:48: structure has no member named `_ptr' >> vsprintf.c:49: structure has no member named `_cnt' >> >> Looks like it's running a test of libgc1.a and fails to find the correct >> definitions for things like FILE among others. > > You have clipped quite a lot away from your output sample, but the last rows >will tell where the problem is. Not in building 'libgcc.a' but in building >'libiberty.a' for the target. > >> Stop in /usr/buildtools/gcc-2.95.2/powerpc--openbsd/libiberty. >> *** Error code 1 > > Before trying libiberty there is a search of the 'missing' functions in the >C-library (libc.a) and this results to the decision to include the >'vsprintf()' >into 'libiberty.a'. If you haven't the 'libc.a' for the target yet, it also >cannot find the vsprintf() from it. > >> I don't quite understand why this is happening. >> Also: gcc was complaining a lot about not being able to find files >> stdio.h and stdedef.h and such until I created a symllink to usr/include >> in cross-tools/powerpc--openbsd ( my prefix directory) > > If you already have GCC or are going to build it, you should have the GCC >manual, "Using and Porting the GNU Compiler" : > >---------------- clip ------------------------ >Introduction > >This manual documents how to run, install and port the GNU compiler, as well >as its new features and incompatibilities, and how to report bugs. It >corresponds to GCC version 2.95. >---------------- clip ------------------------ > >The chapter/section "Installation/Cross-Compiler" says: > >---------------- clip ------------------------ >Cross-Compilers and Header Files > >If you are cross-compiling a standalone program or a program for an embedded >system, then you may not need any header files except the few that are part >of GNU CC (and those of your program). However, if you intend to link your >program with a standard C library such as libc.a, then you probably need to >compile with the header files that go with the library you use. > >The GNU C compiler does not come with these files, because (1) they are >system-specific, and (2) they belong in a C library, not in a compiler. > >If the GNU C library supports your target machine, then you can get the header >files from there (assuming you actually use the GNU library when you link your >program). > >If your target machine comes with a C compiler, it probably comes with >suitable >header files also. If you make these files accessible from the host machine, >the cross-compiler can use them also. > >Otherwise, you're on your own in finding header files to use when >cross-compiling. > >When you have found suitable header files, put them in the directory >/usr/local/target/include, before building the cross compiler. Then >installation >will run fixincludes properly and install the corrected versions of the >header files >where the compiler will use them. > >Provide the header files before you build the cross-compiler, because the >build stage >actually runs the cross-compiler to produce parts of libgcc.a. (These are >the parts >that can be compiled with GNU CC.) Some of them need suitable header files. >---------------- clip ------------------------ > > (The 'target' is in italics in the original text... and the '/usr/local' >is the >default, '--prefix=/usr/local') > > The OpenBSD/PowerPC may have common headers with OpenBSD/x86, but the >Linux-case tells >that expecting an operating system on different architectures to use the >same headers >may be a wrong idea. So the sure case would be to take the target headers >from the target >OpenBSD/PowerPC machine. Then you can make a diff between them and your >native OpenBSD >headers and decide if a symlink is enough (= the headers are just the same). > >> The thing that confuses me most is how do I determine from the error >> messages it spits out which particular module it was compiling. > > For me the 'libiberty/vsprintf.c' seems to be quite obvious... > >> Also, what else do I need to build a functional cross compile environment >> besides gcc and binutils? > > Let me quote the GCC-manual again: > >---------------- clip ------------------------ > · Link those files to make an executable. You can do this either with a >linker on > the target machine, or with a cross-linker on the host machine. >Whichever machine > you use, you need libraries and certain startup files (typically >crt....o) for the > target machine. >---------------- clip ------------------------ > > You'll need the prebuilt target C-library with headers (for >OpenBSD/PowerPC) or the >sources from where to compile it. For embedded systems the C-library is >newlib, for >Linux it is the glibc, but for OpenBSD it is some BSD C-library. The >startup-files >will also come with the C-library. > > I found prebuilt libs for OpenBSD/x86 via 'www.openbsd.org' or something >when I tried >a cross-compiler for it a year or so ago. I would suggest you to start >from there for >searching the OpenBSD/PowerPC stuff... Unless you have the target machine >available. > > If you cannot find suitable pre-built libs for OpenBSD/PowerPC, probably >you will >find at least the sources for them... Otherwise you can just forget the >whole project... > > If your problems are now in building 'libiberty.a', this means that you >have already >a working compiler, which you can use to build the C-library. But getting >a prebuilt >C-library for the target, even a little old, would be much easier... > > After the C-library has been built and installed into the proper place >(under >$(prefix)/$(target)/lib and $(prefix)/$(target)/include), you can continue >with libiberty. >Then it will have a 'libc.a' where to search the 'vsprintf()' and probably >it finds it >there and doesn't try to build the one in the libiberty sources, which >caused the error. > > Of course you may have troubles although you already had the target >C-library with headers. >But when it went as far as really building 'libiberty.a', you passed the >'Cannot make >executables' somehow... > > It may be that your OpenBSD/PowerPC C-library doesn't have the >'vsprintf()'... And you >cannot compile the code in libiberty with your OpenBSD-headers. Then the >quick way is to >decide that you don't need it and edit the > > /usr/buildtools/gcc-2.95.2/powerpc--openbsd/libiberty/Makefile > >and remove the 'vsprintf.o' from the 'needed objects'-list there. I had >this same problem >latest with the 'm68k-coff' or 'm68k-elf' target -- mystically it didn't >find the function >in the 'libc.a' (perhaps it is really missing from newlib-1.8.0 or what I >then have as the >C-library for m68k...) > >Cheers, Kai > > > >------ >Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ >Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |