Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Originating-IP: [192.234.181.70] X-Originating-Email: [l0ci AT hotmail DOT com] From: "Tim Renner" To: cygwin AT cygwin DOT com Subject: Success! Cross Compiler Linux to Cygwin Date: Mon, 31 Mar 2003 19:13:04 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 01 Apr 2003 00:13:05.0304 (UTC) FILETIME=[776CA180:01C2F7E3] Success! I got it working ;) Ignore my last post, I read the advice wrong ;) Anyways... here are the exact steps I went through... this is only for building the 2.95.3-10 version of gcc, which is what I needed... I havn't tried to patch up 3.2-2 yet... If anyone uses these instructions, let me know how well they work or what you had to do to tweak it... 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 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/