Re: linux->cygwin cross build environment
On 8/27/2010 11:18 AM, Charles Wilson wrote: > But...this one works. I'll try again, with some of the other options > and maybe sysroot support, but not until next week. > > I've attached my *working* recipe, based on Corinna's instructions. It > also includes the recipe for then building cygwin itself, and packaging > the results for installation on win32. The attached is a second recipe; this one builds a linux->cygwin gcc-4.5.0 compiler with sysroot support, as well as enabling libgomp. It differs from the "native" cygwin 4.5.0 compiler in the following ways (other than the obvious, of course): graphite is not enabled lto is not enabled To use this recipe, I recommend (a) modifying the various settings at the top as needed (b) cut and paste small sections (10 lines or so) into a terminal -- rather than attempting the "run" the recipe as a script. It's not that polished. Using the cross-compiler generated using this recipe, the "sysroot" support in libtool-2.2.11a passes its own tests (the cross-compiler built using the previous recipe, because it had no sysroot support, caused those tests to be skipped). I was able to rebuild cygwin itself using this compiler with no issues (except those related to -Werror; there are a number of files in cygwin that cause alias warnings). -- Chuck HOST_TRIPLE=i686-pc-linux-gnu HOST_PREFIX=/opt/devel/cygwin TARGET_TRIPLE=i686-pc-cygwin TARGET_PREFIX=/usr SYSROOT=${HOST_PREFIX}/${TARGET_TRIPLE}/sys-root SRCTOP=/mnt/junk/gcc45c/src BUILDTOP=/mnt/junk/gcc45c/build GCCVER=4.5.0 PKGREL=2 DOWNLOADS=/opt/devel/cygwin/src/DOWNLOADS MIRROR=http://mirrors.kernel.org/sourceware/cygwin/release export PATH=${HOST_PREFIX}/bin:/mnt/junk/private/bin:${PATH} mkdir -p ${BUILDTOP} mkdir -p ${SRCTOP} mkdir -p ${SYSROOT} do_get () { pushd ${DOWNLOADS} >/dev/null wget ${MIRROR}/$1 popd >/dev/null } mkdir -p ${DOWNLOADS} do_get binutils/binutils-2.20.51-2-src.tar.bz2 do_get gcc4/gcc4-4.5.0-1-src.tar.bz2 do_get cygwin/cygwin-1.7.6-1-src.tar.bz2 ## Prepare $target libs and headers do_get binutils/binutils-2.20.51-2.tar.bz2 do_get w32api/w32api-3.14-1.tar.bz2 do_get cygwin/cygwin-1.7.6-1.tar.bz2 do_get zlib/zlib-devel/zlib-devel-1.2.3-10.tar.bz2 do_get mingw/mingw-zlib/mingw-zlib-devel/mingw-zlib-devel-1.2.3-10.tar.bz2 do_get mingw-runtime/mingw-runtime-3.18-1.tar.bz2 do_get libiconv/libiconv-1.13.1-1.tar.bz2 do_get gettext/gettext-0.17-11.tar.bz2 cd ${SYSROOT} tar xjf ${DOWNLOADS}/binutils-2.20.51-2.tar.bz2usr/include usr/lib tar xjf ${DOWNLOADS}/gettext-0.17-11.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/libiconv-1.13.1-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/mingw-runtime-3.18-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/mingw-zlib-devel-1.2.3-10.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/zlib-devel-1.2.3-10.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/w32api-3.14-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/cygwin-1.7.6-1.tar.bz2usr/include usr/lib find ./usr/lib -name '*.dll.a' -o -name '*.la' | xargs rm # not sure if sysroot support extends to the w32api stuff, so # make sure the libs that appear in the specs file exist in the # main lib dir, and not just in the w32api subdir. In any case, # this is *absolutely* necessary during the build of the language # runtime libraries... (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libkernel32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libuser32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libadvapi32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libshell32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libgdi32.a.) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libcomdlg32.a .) # ensure linux package installed: libgmp-devel, libgmp10 # ensure linux package installed: mpfr-devel, libmpfr1 # ensure linux package installed: libmpc-devel, libmpc2 # ensure linux package installed: libcloog-devel, libcloog0 # ensure linux package installed: libppl-devel, libppl7 ## custom autoconf, automake ## gcc-4.5.0 requires ac-2.64, am-1.11.1 cd ${DOWNLOADS} wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.bz2 wget http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.bz2 cd ${SRCTOP} tar xvjf ${DOWNLOADS}/autoconf-2.64.tar.bz2 tar xvjf ${DOWNLOADS}/automake-1.11.1.tar.bz2 cd ${BUILDTOP} mkdir autoconf cd autoconf ${SRCTOP}/autoconf-2.64/configure --prefix=/mnt/junk/private make make install cd ${BUILDTOP} mkdir automake cd automake ${SRCTOP}/automake-1.11.1/configure --prefix=/mnt/junk/private make make install mkdir -p /mnt/junk/private/share/aclocal echo '/usr/share/aclocal' > /mnt/junk/private/share/aclocal/dirlist ## unpack gcc, binutil
Re: linux->cygwin cross build environment
On 8/25/2010 10:53 PM, Charles Wilson wrote: > Anybody have a suggestion? What am I doing wrong? Based on Corinna's posted procedure http://cygwin.com/ml/cygwin-developers/2010-08/msg00099.html with a few changes, I was able to create a working linux->cygwin toolchain. The changes I had to make were: 1) I had to do the "unpack a couple of cygwin distro packages" step and the "postinstall" step BEFORE trying to compile gcc. Otherwise, compiling libgcc fails because of "missing stdio.h". 2) I *did* have to patch gcc's libstdc++-v3/crossconfig.m4 file. Otherwise, I got a complaint about unsupported "host/target" combination. 3) And, since Dave's patches do modify m4, Makefile.am, and configure.ac files, I did run automake and autoconf manually in the affected subdirectories, before attempting to build. Testing: Hello World in C, worked fine Hello World in C++, worked fine Rebuilt cygwin-1.7.6 from source, and installed into win32 -- worked fine. Now, how this build -- unlike my previous attempt -- doesn't have a sysroot. The $target libs are installed directly under $host_prefix/$target_triple. Also, unlike the native cygwin 4.5.0 compiler, this one doesn't --enable-libgomp nor --enable-graphite nor --enable-lto. And builds only C, C++, and Fortran. But...this one works. I'll try again, with some of the other options and maybe sysroot support, but not until next week. I've attached my *working* recipe, based on Corinna's instructions. It also includes the recipe for then building cygwin itself, and packaging the results for installation on win32. -- Chuck HOST_TRIPLE=i686-pc-linux-gnu HOST_PREFIX=/opt/devel/cygwin TARGET_TRIPLE=i686-pc-cygwin TARGET_PREFIX=/usr SRCTOP=/mnt/junk/gcc45b/src BUILDTOP=/mnt/junk/gcc45b/build GCCVER=4.5.0 PKGREL=2 DOWNLOADS=/opt/devel/cygwin/src/DOWNLOADS MIRROR=http://mirrors.kernel.org/sourceware/cygwin/release export PATH=${HOST_PREFIX}/bin:/mnt/junk/private/bin:${PATH} mkdir -p ${BUILDTOP} mkdir -p ${SRCTOP} do_get () { pushd ${DOWNLOADS} >/dev/null wget ${MIRROR}/$1 popd >/dev/null } mkdir -p ${DOWNLOADS} do_get binutils/binutils-2.20.51-2-src.tar.bz2 do_get gcc4/gcc4-4.5.0-1-src.tar.bz2 do_get cygwin/cygwin-1.7.6-1-src.tar.bz2 ## Prepare $target libs and headers do_get binutils/binutils-2.20.51-2.tar.bz2 do_get w32api/w32api-3.14-1.tar.bz2 do_get cygwin/cygwin-1.7.6-1.tar.bz2 do_get zlib/zlib-devel/zlib-devel-1.2.3-10.tar.bz2 do_get mingw/mingw-zlib/mingw-zlib-devel/mingw-zlib-devel-1.2.3-10.tar.bz2 do_get mingw-runtime/mingw-runtime-3.18-1.tar.bz2 do_get libiconv/libiconv-1.13.1-1.tar.bz2 do_get gettext/gettext-0.17-11.tar.bz2 cd ${HOST_PREFIX} tar xjf ${DOWNLOADS}/binutils-2.20.51-2.tar.bz2usr/include usr/lib tar xjf ${DOWNLOADS}/gettext-0.17-11.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/libiconv-1.13.1-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/mingw-runtime-3.18-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/mingw-zlib-devel-1.2.3-10.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/zlib-devel-1.2.3-10.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/w32api-3.14-1.tar.bz2 usr/include usr/lib tar xjf ${DOWNLOADS}/cygwin-1.7.6-1.tar.bz2usr/include usr/lib find i686-pc-cygwin/lib -name '*.dll.a' -o -name '*.la' | xargs rm mkdir i686-pc-mingw32 cd i686-pc-mingw32 ln -s ../i686-pc-cygwin/bin bin ln -s ../i686-pc-cygwin/include/mingw include ln -s ../i686-pc-cygwin/lib/mingw lib cd .. # ensure linux package installed: libgmp-devel, libgmp10 # ensure linux package installed: mpfr-devel, libmpfr1 # ensure linux package installed: libmpc-devel, libmpc2 # ensure linux package installed: libcloog-devel, libcloog0 # ensure linux package installed: libppl-devel, libppl7 ## custom autoconf, automake ## gcc-4.5.0 requires ac-2.64, am-1.11.1 cd ${DOWNLOADS} wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.bz2 wget http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.bz2 cd ${SRCTOP} tar xvjf ${DOWNLOADS}/autoconf-2.64.tar.bz2 tar xvjf ${DOWNLOADS}/automake-1.11.1.tar.bz2 cd ${BUILDTOP} mkdir autoconf cd autoconf ${SRCTOP}/autoconf-2.64/configure --prefix=/mnt/junk/private make make install cd ${BUILDTOP} mkdir automake cd automake ${SRCTOP}/automake-1.11.1/configure --prefix=/mnt/junk/private make make install mkdir -p /mnt/junk/private/share/aclocal echo '/usr/share/aclocal' > /mnt/junk/private/share/aclocal/dirlist ## unpack gcc, binutils source cd $SRCTOP tar xvjf ${DOWNLOADS}/binutils-2.20.51-2-src.tar.bz2 tar xvjf ${DOWNLOADS}/gcc4-4.5.0-1-src.tar.bz2 tar xvjf gcc-4.5.0.tar.bz2 ## apply patches cd gcc-4.5.0 pa
Re: linux->cygwin cross build environment
On Thu, Aug 26, 2010 at 2:24 PM, Chiheng Xu wrote: > I attached the scripts I used in December, 2009, trying to build a > Cygwin cross toolchain. > Also attcach the MinGW scripts. -- Chiheng Xu Wuhan,China gcc_mingw.tar.bz2 Description: BZip2 compressed data -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: linux->cygwin cross build environment
On Thu, Aug 26, 2010 at 10:53 AM, Charles Wilson wrote: > Last weekend I attempted to setup a linux->cygwin cross compiler (and > basic sysroot). However, it didn't work: while a simple C 'Hello World' > app could be compiled, copied over to a win32 system and executed, a C++ > 'Hello World' did not: > I attached the scripts I used in December, 2009, trying to build a Cygwin cross toolchain. This is much like the MinGW cross toolchain build scripts. The scripts seem not to be able complete the build procdure of gcc. The Chinese characters in the scripts is encoded as gb2312. -- Chiheng Xu Wuhan,China gcc_cygwin.tar.bz2 Description: BZip2 compressed data -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
linux->cygwin cross build environment
Last weekend I attempted to setup a linux->cygwin cross compiler (and basic sysroot). However, it didn't work: while a simple C 'Hello World' app could be compiled, copied over to a win32 system and executed, a C++ 'Hello World' did not: 1) using the cygwin-provided cygstdc++-6.dll and cyggcc_s-1.dll, it segfaulted. 2) copying over to the win32 system ALSO the cygstdc++-6.dll and cyggcc_s-1.dll built as part of the cross toolchain, and running the C++ hello world app -- it didn't segfault. But it didn't print anything to stdout (std::cout), either. Now, I've build linux-hosted cross compilers before -- and I'm very familiar with cygwin, too -- so I'm not exactly a novice here. But...I wonder if I'm just doing something silly, and need another pair (or hundred) of eyes to point out the obvious. so, I've attached my build procedure (WARNING, for the archvies: the compiler produced using this procedure is BROKEN. DO NOT USE). I based my compiler on Dave's recent 4.5.0-1 release, and the current cygwin binutils packages. Anybody have a suggestion? What am I doing wrong? -- Chuck HOST_TRIPLE=i686-pc-linux-gnu HOST_PREFIX=/opt/devel/cygwin TARGET_TRIPLE=i686-pc-cygwin TARGET_PREFIX=/usr SYSROOT=${HOST_PREFIX}/${TARGET_TRIPLE}/sys-root BUILDTOP=/mnt/junk GCCVER=4.5.0 PKGREL=1 DOWNLOADS=/opt/devel/cygwin/src/downloads MIRROR=http://mirrors.kernel.org/sourceware/cygwin/release export PATH=${HOST_PREFIX}/bin:/opt/devel/cygwin/src/private/bin:${PATH} do_get () { pushd ${DOWNLOADS} >/dev/null wget ${MIRROR}/$1 popd >/dev/null } mkdir -p ${DOWNLOADS} do_get w32api/w32api-3.14-1.tar.bz2 do_get cygwin/cygwin-1.7.6-1.tar.bz2 do_get binutils/binutils-2.20.51-2-src.tar.bz2 do_get gcc4/gcc4-4.5.0-1-src.tar.bz2 mkdir -p ${SYSROOT} (cd ${SYSROOT} && tar xvjf ${DOWNLOADS)/w32api-3.14-1.tar.bz2) (cd ${SYSROOT} && tar xvjf ${DOWNLOADS}/cygwin-1.7.6-1.tar.bz2) # not sure if sysroot support extends to the w32api stuff, so # make sure the libs that appear in the specs file exist in the # main lib dir, and not just in the w32api subdir. In any case, # this is *absolutely* necessary during the build of the language # runtime libraries... (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libkernel.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libuser32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libadvapi32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libshell32.a .) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libgdi32.a.) (cd ${SYSROOT}${TARGET_PREFIX}/lib && ln -fs w32api/libcomdlg32.a .) # ensure linux package installed: libgmp-devel, libgmp10 # ensure linux package installed: mpfr-devel, libmpfr1 # ensure linux package installed: libmpc-devel, libmpc2 # ensure linux package installed: libcloog-devel, libcloog0 # ensure linux package installed: libppl-devel, libppl7 ## binutils cd $BUILDTOP mkdir binutils cd binutils tar xvjf ${DOWNLOADS}/binutils-2.20.51-2-src.tar.bz2 mkdir _build cd _build ${BUILDTOP}/binutils/binutils-2.20.51-2/configure \ --prefix=${HOST_PREFIX} \ --host=${HOST_TRIPLE} \ --build=${HOST_TRIPLE} \ --target=${TARGET_TRIPLE} \ --with-build-sysroot=${SYSROOT} \ --with-sysroot=${SYSROOT} make make install DESTDIR=${BUILDTOP}/binutils/_inst cd ${BUILDTOP}/binutils/_inst tar cvJf ../binutils-2.20.51-2-cygwin.tar.xz opt cd / tar xvJf ${BUILDTOP}/binutils/binutils-2.20.51-2-cygwin.tar.xz ## custom autoconf, automake ## gcc-4.5.0 requires ac-2.64, am-1.11.1 cd ${DOWNLOADS} wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.bz2 wget http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.bz2 cd ${BUILDTOP} mkdir autoconf cd autoconf tar xvjf ${DOWNLOADS}/autoconf-2.64.tar.bz2 mkdir _build cd _build ${BUILDTOP}/autoconf/autoconf-2.64/configure --prefix=${BUILDTOP}/private make make install cd ${BUILDTOP} mkdir automake cd automake tar xvjf ${DOWNLOADS}/automake-1.11.1.tar.bz2 mkdir _build cd _build ${BUILDTOP}/automake/automake-1.11.1/configure --prefix=${BUILDTOP}/private make make install mkdir -p ${BUILDTOP}/private/share/aclocal echo '/usr/share/aclocal' > ${BUILDTOP}/private/share/aclocal/dirlist ## gcc cd $BUILDTOP mkdir gcc45 cd gcc45 tar xvjf ${DOWNLOADS}/gcc4-4.5.0-1-src.tar.bz2 tar xvjf gcc-4.5.0.tar.bz2 cd gcc-4.5.0 patch -p2 < ../classpath-0.98-FIONREAD.patch patch -p2 < ../classpath-0.98-build.patch patch -p2 < ../classpath-0.98-awt.patch patch -p2 < ../gcc45-ada.diff patch -p0 < ../gcc45-cygwin-lto.diff patch -p2 < ../gcc45-ehdebug.diff patch -p2 < ../gcc45-libffi.diff patch -p2 < ../gcc45-libstdc.diff patch -p2 < ../gcc45-misc-core.diff patch -p2 < ../gcc45-mnocygwin.diff patch -p0 < ../gcc45-sig-unwind.diff pa