X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW,TW_BF,TW_BG,TW_CX,TW_IB,TW_JL,TW_VJ,TW_XV,TW_YM X-Spam-Check-By: sourceware.org Message-ID: <4C75D71D.6020008@cwilson.fastmail.fm> Date: Wed, 25 Aug 2010 22:53:17 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: linux->cygwin cross build environment Content-Type: multipart/mixed; boundary="------------090301090706030303020607" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 --------------090301090706030303020607 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------090301090706030303020607 Content-Type: text/plain; name="linux-to-cygwin-cross-45.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux-to-cygwin-cross-45.txt" 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 patch -p2 < ../gcc45-skiptest.diff patch -p0 < ../gcc45-pruneopts-term.diff patch -p2 < ../gcc45-weak-binding.diff patch -p2 < ../gcc4-4.5.0-1.cygwin.patch pushd libstdc++-v3 >/dev/null cat <<"EOF" > crossconfig.m4.patch --- crossconfig.m4.orig 2009-06-02 15:15:03.000000000 -0400 +++ crossconfig.m4 2010-08-22 22:35:55.345320303 -0400 @@ -141,7 +141,7 @@ ;; esac ;; - *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu | *-cygwin* ) GLIBCXX_CHECK_COMPILER_FEATURES GLIBCXX_CHECK_LINKER_FEATURES GLIBCXX_CHECK_MATH_SUPPORT EOF patch -p0 < ./crossconfig.m4.patch popd >/dev/null gcc_reconf() { local S=${BUILDTOP}/gcc45/gcc-4.5.0 pushd ${S} >/dev/null cd ${S} autoconf || exit -1 cd ${S}/gcc autoconf || exit -1 autoheader || exit -1 cd ${S}/libiberty autoconf || exit -1 cd ${S}/libstdc++-v3 autoconf || exit -1 cd ${S}/libjava autoconf || exit -1 cd ${S}/libffi aclocal -I . -I .. -I ../config || exit -1 autoconf || exit -1 cd ${S} for x in boehm-gc libffi libgfortran libgomp libjava libmudflap libssp libstdc++-v3 zlib; do pushd $x >/dev/null automake || exit -1 popd >/dev/null done cd ${S}/gcc/testsuite/ada/acats chmod a+x run_test.exp popd >/dev/null } gcc_reconf cd $BUILDTOP/gcc mkdir _build cd _build ${BUILDTOP}/gcc45/gcc-4.5.0/configure \ --prefix=${HOST_PREFIX} \ --datadir=${HOST_PREFIX}/share \ --mandir=${HOST_PREFIX}/share/man \ --infodir=${HOST_PREFIX}/share/info \ --host=${HOST_TRIPLE} \ --build=${HOST_TRIPLE} \ --target=${TARGET_TRIPLE} \ --with-build-sysroot=${SYSROOT} \ --with-sysroot=${SYSROOT} \ -v --with-gmp=/usr --with-mpfr=/usr \ --disable-bootstrap --enable-version-specific-runtime-libs \ --libexecdir=${HOST_PREFIX}/lib \ --enable-static --enable-shared --enable-shared-libgcc \ --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 \ --disable-sjlj-exceptions --enable-languages=c,c++,fortran \ --enable-graphite --disable-lto \ --disable-symvers --enable-libgomp --enable-libssp --enable-threads=posix \ --with-arch=i686 --with-tune=generic make -j6 D=${BUILDTOP}/gcc45/_inst make install DESTDIR=${D} # don't install target libiberty rm -f ${D}${HOST_PREFIX}/lib/libiberty.a rm -f ${D}${HOST_PREFIX}/${TARGET_TRIPLE}/lib/libiberty.a # move runtime DLLs to sysroot mkdir -p ${D}${SYSROOT}${TARGET_PREFIX}/bin mv ${D}${HOST_PREFIX}/bin/*.dll ${D}${SYSROOT}${TARGET_PREFIX}/bin # libgcc1 cd ${D} tar cvJf ${BUILDTOP}/gcc45/libgcc1-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${SYSROOT:1}${TARGET_PREFIX}/bin/cyggcc_s-1.dll # libstdc++6 cd ${D} tar cvJf ${BUILDTOP}/gcc45/libstdc++6-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${SYSROOT:1}${TARGET_PREFIX}/bin/cygstdc++-6.dll # libgomp cd ${D} tar cvJf ${BUILDTOP}/gcc45/libgomp1-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${SYSROOT:1}${TARGET_PREFIX}/bin/cyggomp-1.dll # libssp0 cd ${D} tar cvJf ${BUILDTOP}/gcc45/libssp0-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${SYSROOT:1}${TARGET_PREFIX}/bin/cygssp-0.dll # libgfortran3 cd ${D} tar cvJf ${BUILDTOP}/gcc45/libgfortran3-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${SYSROOT:1}${TARGET_PREFIX}/bin/cyggfortran-3.dll # g++ cd ${D} tar cvJf ${BUILDTOP}/gcc45/gcc-g++-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/include/c++ \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-c++ \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-g++ \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/cc1plus \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libstdc++.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libstdc++.dll.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libstdc++.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libsupc++.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libsupc++.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libstdc++.dll.a-gdb.py \ ${HOST_PREFIX:1}/share/gcc-${GCCVER}/python/libstdcxx/__init__.py \ ${HOST_PREFIX:1}/share/gcc-${GCCVER}/python/libstdcxx/v6/__init__.py \ ${HOST_PREFIX:1}/share/gcc-${GCCVER}/python/libstdcxx/v6/printers.py \ ${HOST_PREFIX:1}/share/man/man1/${TARGET_TRIPLE}-g++.1 # gfortran tar cvJf ${BUILDTOP}/gcc45/gcc-gfortran-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/finclude \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-gfortran \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/f951 \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgfortran.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgfortran.dll.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgfortran.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgfortranbegin.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgfortranbegin.la \ ${HOST_PREFIX:1}/share/info/gfortran.info \ ${HOST_PREFIX:1}/share/man/man1/${TARGET_TRIPLE}-gfortran.1 # gcc tar cvJf ${BUILDTOP}/gcc45/gcc-core-${GCCVER}-${PKGVER}-cygwin.tar.xz \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/include/*.h \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/include/ssp \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/include-fixed \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/install-tools \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-cpp \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-gcc \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-gcc-${GCCVER} \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-gccbug \ ${HOST_PREFIX:1}/bin/${TARGET_TRIPLE}-gcov \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/cc1 \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/collect2 \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/crtbegin.o \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/crtend.o \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/crtfastmath.o \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgcc.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgcc_eh.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgcc_s.dll.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgcov.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgomp.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgomp.dll.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgomp.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libgomp.spec \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libssp.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libssp.dll.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libssp.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libssp_nonshared.a \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/libssp_nonshared.la \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/lto-wrapper \ ${HOST_PREFIX:1}/lib/gcc/${TARGET_TRIPLE}/${GCCVER}/plugin/ \ ${HOST_PREFIX:1}/share/locale/* \ ${HOST_PREFIX:1}/share/info/cpp.info \ ${HOST_PREFIX:1}/share/info/cppinternals.info \ ${HOST_PREFIX:1}/share/info/gcc.info \ ${HOST_PREFIX:1}/share/info/gccinstall.info \ ${HOST_PREFIX:1}/share/info/gccint.info \ ${HOST_PREFIX:1}/share/info/libgomp.info \ ${HOST_PREFIX:1}/share/man/man1/${TARGET_TRIPLE}-cpp.1 \ ${HOST_PREFIX:1}/share/man/man1/${TARGET_TRIPLE}-gcc.1 \ ${HOST_PREFIX:1}/share/man/man1/${TARGET_TRIPLE}-gcov.1 \ ${HOST_PREFIX:1}/share/man/man7/gpl.7 \ ${HOST_PREFIX:1}/share/man/man7/gfdl.7 \ ${HOST_PREFIX:1}/share/man/man7/fsf-funding.7 cd / tar xvJf ${BUILDTOP}/gcc45/gcc-core-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/gcc-g++-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/gcc-gfortran-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/libgcc1-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/libgfortran3-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/libgomp1-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/libssp0-${GCCVER}-${PKGREL}-cygwin.tar.xz tar xvJf ${BUILDTOP}/gcc45/libstdc++6-${GCCVER}-${PKGREL}-cygwin.tar.xz --------------090301090706030303020607 Content-Type: text/plain; charset=us-ascii -- 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 --------------090301090706030303020607--