This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Building cross compiler Linux host -> Cygwin target


I'm trying to build a cross compiler to i686-cygwin.  Host is a i686
Debian 3.0 Linux with gcc 2.95.4 and glibc 2.2.5.

(Debian packages are available for mingw32 and cygwin, however the
need to access the hardware the Posix way on the target rules out
mingw and packages for cygwin appear to be unsupported, though
working.)

After much web and usenet rambling (particularly
http://www.cygwin.com/xfree/docs/cg/prog-build-cross.html) I put the
following together:


############################################################################

CYGDIR=~/workspace/cygwin
mkdir -p $CYGDIR $CYGDIR/download $CYGDIR/src


# FOLLOWING RUNS FINE
echo "Getting files..."
cd $CYGDIR/download
wget -nc ftp://sources.redhat.com/pub/cygwin/release/binutils/binutils-20030307-1-src.tar.bz2
wget -nc ftp://sources.redhat.com/pub/cygwin/release/gcc2/gcc2-2.95.3-10-src.tar.bz2
wget -nc ftp://sources.redhat.com/pub/cygwin/release/cygwin/cygwin-1.3.22-1.tar.bz2


# FOLLOWING RUNS FINE
echo "Setting up include files and pre-made libraries..." 
cd $CYGDIR
mkdir -p i686-pc-cygwin 
tar jxf download/cygwin-1.3.22-1.tar.bz2 usr/include usr/lib
mv usr/include usr/lib i686-pc-cygwin
rm -rf usr


# FOLLOWING RUNS FINE
echo "Building binutils..."
cd $CYGDIR/src
tar jxf ../download/binutils-20030307-1-src.tar.bz2
cd binutils-20030307-1
mkdir -p build; cd build
../configure --prefix=$CYGDIR --exec-prefix=$CYGDIR --target=i686-pc-cygwin \
  --host=i686-pc-linux
make all
make install


# FOLLOWING RUNS FINE IN PART
echo "Making gcc..." 
cd $CYGDIR/src
tar jxf ../download/gcc2-2.95.3-10-src.tar.bz2
cd gcc2-2.95.3-10
mkdir -p build; cd build
../configure --prefix=$CYGDIR --exec-prefix=$CYGDIR --target=i686-pc-cygwin \
  --host=i686-pc-linux

# (DID THE FOLLOWING BECAUSE I DIDN'T WANT TO ADD COMPLEXITY...  IS
# THERE A RIGHT WAY TO DO IT THROUGH CONFIGURE?)
grep -v 'CLIB = -lintl' gcc/Makefile >
gcc/Makefile.tmp && \
  mv -f gcc/Makefile.tmp gcc/Makefile

export PATH=$PATH:$CYGDIR/bin:$CYGDIR/i686-pc-cygwin/bin
# TROUBLE BEGINS HERE!
make all

############################################################################

That last `make all' ends with this error:


cd ../libiberty ; make "SHELL=/bin/sh" "INSTALL=/bin/sh
/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/install-sh -c"
"INSTALL_DATA=/bin/sh
/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/install-sh -c -m 644"
"INSTALL_PROGRAM=/bin/sh
/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/install-sh -c "
"prefix=/home/bard/workspace/cygwin"
"exec_prefix=/home/bard/workspace/cygwin"
"tooldir=/home/bard/workspace/cygwin/i686-pc-cygwin"
"gxx_include_dir=/home/bard/workspace/cygwin/include/g++-3"
"libsubdir=/home/bard/workspace/cygwin/lib/gcc-lib/i686-pc-cygwin/2.95.3-10"
"gcc_version=2.95.3-10"
"gcc_version_trigger=/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/gcc/version.c"
"AR=i686-pc-cygwin-ar" "AR_FLAGS=rc"
"CC=/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/gcc/xgcc
-B/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/gcc/
-B/home/bard/workspace/cygwin/i686-pc-cygwin/bin/"
"CXX=/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/gcc/xgcc
-B/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/gcc/
-B/home/bard/workspace/cygwin/i686-pc-cygwin/bin/" "CFLAGS=-g -O2"
"CXXFLAGS=-g -O2" "NM=i686-pc-cygwin-nm"
"RANLIB=i686-pc-cygwin-ranlib" "LIBCFLAGS=-g -O2" "LIBCXXFLAGS=-g -O2
-fno-implicit-templates" "LOADLIBES=" "LDFLAGS=" "MAKEINFO=makeinfo "
"SHLIB=libstdc++.so.2.10.0" "SHCURSES=" "RUNTESTFLAGS="

make[2]: Entering directory
`/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/i686-pc-cygwin/libiberty'
make[2]: *** No targets specified and no makefile found.  Stop.
make[2]: Leaving directory
`/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/i686-pc-cygwin/libiberty'
make[1]: *** [../libiberty/libiberty.a] Error 2
make[1]: Leaving directory
`/home/bard/workspace/cygwin/src/gcc2-2.95.3-10/build/i686-pc-cygwin/libstdc++'
make: *** [all-target-libstdc++] Error 2



Proceeding with `make all-gcc && make install-gcc' does what it should
and I am left with a cross compiler, which is able to do the
following:

    $ export PATH=$PATH:$CYGDIR/bin:$CYBDIR/i686-pc-cygwin/bin 
    $ i686-pc-cygwin-gcc -c hello.c

But chokes on this:

    $ i686-pc-cygwin-gcc hello.c
    /home/bard/workspace/cygwin//bin/../lib/gcc-lib/i686-pc-cygwin/
    2.95.3-10/../../../../i686-pc-cygwin/bin/ld: cannot find -luser32
    collect2: ld returned 1 exit status

So I guess that the remaining part of gcc's making would have taken
care of the linker side of the story, right?

Does anybody have an idea about what is going wrong in building
libiberty.a?  I found messages about libiberty.a in the
cygwin-developers list archives about a similar situation ("no
makefile found"), but they had to do with autoconf 2.13 and are about
two years old... is there still an issue there?

Thank you for reading so far and for any help.



Massimiliano

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]