I am using: RedHat Linux 7.2, gcc version 2.95.3, binutils version 2.11.90.0.8
------------------------------------
My lib and include directories from cygwin are in a setup that already has gcc2-2.95.3-10 installed, so that may have made this easier ;)
- Get what you need...
I have all of this in /cross/src and am doing my building in this directory. My target directory is /cross
Get CYGWIN binutils-src (binutils-20030307-1-src.tar.bz2) CYGWIN gcc-2.95.3-10-src (gcc2-2.95.3-10-src.tar.bz2)
and unpack.
Copy from your cygwin machine, /lib to build/lib on the linux machine /usr/include to build/include on the linux machine
- Build CYGWIN binutils
mkdir bubuild cd bubuild ../binutils-20030307-1/configure --prefix=/cross --target=i686-pc-cygwin
make all make install cd ..
- Set up includes and libs
cp -a include ../i686-pc-cygwin
cp -a lib ../i686-pc-cygwin
cp /cross/i686-pc-cygwin/lib/gcc-lib/i686-pc-cygwin/2.95.3-10/*.a /cross/i686-pc-cygwin/lib -v
- Set up paths export PATH=$PATH:/cross/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/cross/lib
- build CYGWIN gcc-2.95.3-10
mkdir gbuild
cd gbuild
../gcc2-2.95.3-10/configure --prefix=/cross --target=i686-pc-cygwin -v --with-headers=../include --with-libs=../lib --with-gnu-ld --with-gnu-as --with-newlib
PATCH - gcc/Makefile - CLIB = -lintl -> remove -lintl cause my system doesn't have it.
PATCH - /cross/i686-pc-cygwin/include/sys/errno.h
- line 23 -> extern __IMPORT const char ** sys_errlist <- to match gcc libiberty's
- this is probably not right, should change the way gcc works, not cygwin's includes ;)
make cross make install-cross cd ..
- Test it:
test.cc: #include <iostream.h> void main() { cout << "TEST" << endl; }
i686-pc-cygwin-g++ -o test.exe test.cc
renner_linux(trenner):/tmp> i686-pc-cygwin-g++ -o test.exe test.cc renner_linux(trenner):/tmp> file test.exe test.exe: MS Windows PE Intel 80386 console executable not relocatable
renner_linux(trenner):/tmp> i686-pc-cygwin-g++ -o test.exe -mno-cygwin test.cc
renner_linux(trenner):/tmp> file test.exe
test.exe: MS Windows PE Intel 80386 console executable not relocatable
And it works ;)
If you get this:
renner_linux(trenner):/tmp> i686-pc-cygwin-g++ -o test.exe test.cc
/c/cross/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.3-10/../../../../i686-pc-cygwin/bin/ld: cannot find -lstdc++-2
collect2: ld returned 1 exit status
Make sure you've done this...
cp /cross/i686-pc-cygwin/lib/gcc-lib/i686-pc-cygwin/2.95.3-10/*.a /cross/i686-pc-cygwin/lib -v
------------------------------------
_________________________________________________________________
-- 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/