This is the mail archive of the cygwin-developers 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]

crossbuild cygwin-1.7.6-1 on linux x64


Hi,

	After a great struggle (and lots of googling around) i finally
compiled cygwin1.dll on
	linux and tested in a win32 environment, the process wasn't
straightforward but it worked.

	I've attached the original email body (for long lines format
protection) and all changes i've made
	(all trivial) as unified diff.

	What i want, is to know if i have done something *very* wrong in the
cygwin configuration
	and compilation, because the cygwin compilation raised a lot of
undefined references from
	cygserver, i had to compile cygserver separately and manually
(outside autotools) for the
	process to complete, below are the procedures i've followed.
	
	If this listing isn't the proper place to discuss this, please
forgive-me and point me the right
	direction.

	I also thank you all for the great work on cygwin.

procedures:


download required files

	mkdir -p ~/Downloads/cygwin-cross && cd ~/Downloads/cygwin-cross
	wget -c http://mirror.cpsc.ucalgary.ca/mirror/cygwin.com/release/binutils/binutils-2.20.51-2-src.tar.bz2
	wget -c http://mirror.cpsc.ucalgary.ca/mirror/cygwin.com/release/gcc4/gcc4-4.3.4-3-src.tar.bz2
	wget -c http://mirror.cpsc.ucalgary.ca/mirror/cygwin.com/release/cygwin/cygwin-1.7.6-1-src.tar.bz2
	wget -c http://mirror.cpsc.ucalgary.ca/mirror/cygwin.com/release/cygwin/cygwin-1.7.6-1.tar.bz2

install cocom (shilka tool required by cygwin)

	# instructions at cocom/README.txt

prepare sources and auxiliary files

	mkdir -p ~/src && cd ~/src

	tar -xjf ~/Downloads/cygwin-cross/binutils-2.20.51-2-src.tar.bz2
	tar -xjf ~/Downloads/cygwin-cross/gcc4-4.3.4-3-src.tar.bz2
	tar -xjf gcc-4.3.4.tar.bz2

	tar -xjf ~/Downloads/cygwin-cross/cygwin-1.7.6-1-src.tar.bz2
	rm -fv src && ln -s cygwin-1.7.6-1 src

	cd ~/src/binutils-2.20.51-2
	git init && git add . && git commit -m 'initial commit' && git repack
-d && git prune

	cd ~/src/gcc-4.3.4
	git init && git add . && git commit -m 'initial commit'

	patch -p2 < ../gcc4-4.3.4-3.src.patch
	git add . && git commit -m 'applied gcc4-4.3.4-3.src.patch'

	patch -p2 < ../gcc4-4.3.4-3.cygwin.patch
	git add . && git commit -m 'applied gcc4-4.3.4-3.cygwin.patch'

	patch -p1 < ~/Downloads/cygwin-cross/gcc4-4.3.4-3-strsignal.patch
	git add . && git commit -m 'applied gcc4-4.3.4-3-strsignal.patch'

	patch -p1 < ~/Downloads/cygwin-cross/gcc4-4.3.4-3-use-libstdc-wrappers.patch
	git add . && git commit -m 'applied gcc4-4.3.4-3-use-libstdc-wrappers.patch'

	git repack -d && git prune

	cd ~/src/src
	git init && git add . && git commit -m 'initial commit'

	patch -p1 < ~/Downloads/cygwin-cross/cygwin-1.7.6-1-winsup-utils-mingw.patch
	git add . && git commit -m 'applied cygwin-1.7.6-1-winsup-utils-mingw.patch'

	git repack -d && git prune

	mkdir -p ~/src/cygwin-1.7.6-1-dist && tar -C
~/src/cygwin-1.7.6-1-dist -xjf
~/Downloads/cygwin-cross/cygwin-1.7.6-1.tar.bz2

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

setup (always execute this before going further)

	export _ZTARGET=i686-pc-cygwin
	export PATH=$PATH:~/cygwin-cross/bin:~/cygwin-cross/$_ZTARGET/bin

binutils

	mkdir -p ~/build/cygwin-cross/binutils && cd ~/build/cygwin-cross/binutils \
	&& ~/src/binutils-2.20.51-2/configure --target=$_ZTARGET
--prefix=$HOME/cygwin-cross --exec-prefix=$HOME/cygwin-cross
--disable-nls 2>&1 | tee -a configure.log \
	&& make all 2>&1 | tee all.log \
	&& make install 2>&1 | tee install.log \

gcc4, gcc only

	&& mkdir -p ~/build/cygwin-cross/gcc4-gcc && cd ~/build/cygwin-cross/gcc4-gcc \
	&& ~/src/gcc-4.3.4/configure --target=$_ZTARGET
--prefix=$HOME/cygwin-cross --exec-prefix=$HOME/cygwin-cross \
	  --enable-haifa --disable-bootstrap
--enable-version-specific-runtime-libs --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++ --disable-symvers \
	  --enable-threads=posix --with-arch=i686 --with-tune=generic
--with-newlib 2>&1 | tee -a configure.log \
	&& make CFLAGS='-DUSE_CYGWIN_LIBSTDCXX_WRAPPERS=0
-DHAVE_GAS_ALIGNED_COMM=1 -g -O2' all-gcc 2>&1 | tee all.log \
	&& make install-gcc 2>&1 | tee install.log \

cygwin's newlib

	&& mkdir -p ~/build/cygwin-cross/newlib && cd ~/build/cygwin-cross/newlib \
	&& ~/src/src/configure --target=$_ZTARGET --prefix=$HOME/cygwin-cross
--exec-prefix=$HOME/cygwin-cross 2>&1 | tee -a configure.log \
        && make configure-target-newlib 2>&1 | tee configure-target-newlib.log \
        && make -C ${_ZTARGET}/newlib 2>&1 | tee -a newlib.log \
        && make -C ${_ZTARGET}/newlib install 2>&1 | tee -a newlib-install.log \

gcc4, full

	&& mkdir -p ~/build/cygwin-cross/gcc4-all && cd ~/build/cygwin-cross/gcc4-all \
	&& ~/src/gcc-4.3.4/configure --target=$_ZTARGET
--prefix=$HOME/cygwin-cross --exec-prefix=$HOME/cygwin-cross \
	  --enable-haifa --disable-bootstrap
--enable-version-specific-runtime-libs --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++ --disable-symvers \
	  --enable-threads=posix --with-arch=i686 --with-tune=generic
--with-newlib 2>&1 | tee -a configure.log \
	&& ${_ZTARGET}-dlltool --as=${_ZTARGET}-as -k --output-lib
~/cygwin-cross/$_ZTARGET/lib/libkernel32.a --def
~/src/src/winsup/w32api/lib/kernel32.def \
	&& ${_ZTARGET}-dlltool --as=${_ZTARGET}-as -k --output-lib
~/cygwin-cross/$_ZTARGET/lib/libuser32.a --def
~/src/src/winsup/w32api/lib/user32.def \
	&& ${_ZTARGET}-dlltool --as=${_ZTARGET}-as -k --output-lib
~/cygwin-cross/$_ZTARGET/lib/libadvapi32.a --def
~/src/src/winsup/w32api/lib/advapi32.def \
	&& ${_ZTARGET}-dlltool --as=${_ZTARGET}-as -k --output-lib
~/cygwin-cross/$_ZTARGET/lib/libshell32.a --def
~/src/src/winsup/w32api/lib/shell32.def \
	&& (cd ~/cygwin-cross/${_ZTARGET} && tar -cjf
include-newlib-original.tar.bz2 include) \
	&& rsync -a --exclude '- CVS' ~/src/src/winsup/cygwin/include/
~/cygwin-cross/${_ZTARGET}/include/ \
	&& ln -s ~/src/cygwin-1.7.6-1-dist/usr/lib/libcygwin.a
~/cygwin-cross/${_ZTARGET}/lib/libcygwin.a \
	&& ln -s ~/src/cygwin-1.7.6-1-dist/usr/lib/crt0.o
~/cygwin-cross/${_ZTARGET}/lib/crt0.o \
	&& make CFLAGS='-DUSE_CYGWIN_LIBSTDCXX_WRAPPERS=0
-DHAVE_GAS_ALIGNED_COMM=1 -g -O2
-I$(HOME)/src/src/winsup/w32api/include' all 2>&1 | tee all.log \
	&& make install 2>&1 | tee install.log \
	&& echo 'main() {puts("hello world of real possibilities!");}' |
${_ZTARGET}-gcc -o "_test_${_ZTARGET}_pe32_output" -x c - && echo
'gcc4 can generate pe executables' \

cygwin

	&& mkdir -p ~/build/cygwin-cross/cygwin && cd ~/build/cygwin-cross/cygwin \
	&& ~/src/src/configure --target=$_ZTARGET 2>&1 | tee -a configure.log \
	&& make all 2>&1 | tee all.log \

	# generate cygwin0.dll manually

		&& pushd i686-pc-cygwin/winsup/cygwin \
		&& mkdir -p __libcygserver && cd __libcygserver \
		&& alias compile="i686-pc-cygwin-c++ \
		    -L$HOME/build/cygwin-cross/cygwin/i686-pc-cygwin/winsup \
		    -L$HOME/build/cygwin-cross/cygwin/i686-pc-cygwin/winsup/cygwin \
		    -L$HOME/build/cygwin-cross/cygwin/i686-pc-cygwin/winsup/w32api/lib \
		    -isystem $HOME/src/src/winsup/include \
		    -isystem $HOME/src/src/winsup/cygwin/include \
		    -isystem $HOME/src/src/winsup/w32api/include \
		    -B$HOME/build/cygwin-cross/cygwin/i686-pc-cygwin/newlib/ \
		    -isystem $HOME/build/cygwin-cross/cygwin/i686-pc-cygwin/newlib/targ-include
\
		    -isystem $HOME/src/src/newlib/libc/include \
		    -c -nostdinc++  -DHAVE_CONFIG_H  -g -O2 -MMD  -Werror -fmerge-constants \
		    -ftracer -mno-use-libstdc-wrappers  -Wall -Wstrict-aliasing
-Wwrite-strings \
		    -fno-common -pipe -fbuiltin -fmessage-length=0  -I.. \
		    -I$HOME/src/src/winsup/cygwin \
		    -I$HOME/src/src/winsup/w32api/include \
		    -I$HOME/src/src/winsup/cygwin/config/i386 \
		    -I$HOME/cygwin-cross/lib/gcc/i686-pc-cygwin/4.3.4/include \
		    -fno-rtti -fno-exceptions";

		for i in $HOME/src/src/winsup/cygserver/*.cc; do compile -o
"$(basename ${i%.cc}.o)" "$i"; done \
		&& i686-pc-cygwin-ar cr ../__libcygserver.a *.o \
		&& cd .. \
		&& make EXTRA_OFILES='__libcygserver.a' cygwin0.dll \
		&& popd

	make all \
	&& DESTDIR=~/cygwin-dist make install 2>&1 | tee install.log \




thanks and sorry for the long email,

Alexandre Girao

Attachment: email-cygwin-developers.txt
Description: Text document

Attachment: email-cygwin-developers--all.log.gz
Description: GNU Zip compressed data

Attachment: email-cygwin-developers--config.log.gz
Description: GNU Zip compressed data

diff --git a/winsup/utils/mingw b/winsup/utils/mingw
index 4e270fd..8f970d0 100755
--- a/winsup/utils/mingw
+++ b/winsup/utils/mingw
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Front-end kludge to cause a Cygwin gcc to default to
 # an installed version of the MinGW components.
 
diff --git a/gcc/unwind.inc b/gcc/unwind.inc
index 4e39c2f..2c011c6 100644
--- a/gcc/unwind.inc
+++ b/gcc/unwind.inc
@@ -101,9 +101,9 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc)
 
       /* Set up fs to describe the FDE for the caller of cur_context.  The
 	 first time through the loop, that means __cxa_throw.  */
-if (__debug_unwind_enabled) printf ("Ctx: ra %p\n", cur_context.ra);
+//if (__debug_unwind_enabled) printf ("Ctx: ra %p\n", cur_context.ra);
       code = uw_frame_state_for (&cur_context, &fs);
-if (__debug_unwind_enabled) printf ("... code %d, perso %p\n", code, fs.personality);
+//if (__debug_unwind_enabled) printf ("... code %d, perso %p\n", code, fs.personality);
       if (code == _URC_END_OF_STACK)
 	/* Hit end of stack with no handler found.  */
 	return _URC_END_OF_STACK;
@@ -118,7 +118,7 @@ if (__debug_unwind_enabled) printf ("... code %d, perso %p\n", code, fs.personal
 	{
 	  code = (*fs.personality) (1, _UA_SEARCH_PHASE, exc->exception_class,
 				    exc, &cur_context);
-if (__debug_unwind_enabled) printf ("perso returns code %d\n", code);
+//if (__debug_unwind_enabled) printf ("perso returns code %d\n", code);
 	  if (code == _URC_HANDLER_FOUND)
 	    break;
 	  else if (code != _URC_CONTINUE_UNWIND)
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c
index 4ca9e21..a624a5e 100644
--- a/libiberty/strsignal.c
+++ b/libiberty/strsignal.c
@@ -404,7 +404,7 @@ call to @code{strsignal}.
 
 #ifndef HAVE_STRSIGNAL
 
-const char *
+char *
 strsignal (int signo)
 {
   const char *msg;
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 85a64df..af14a35 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -117,7 +117,6 @@ along with GCC; see the file COPYING3.  If not see
   %{mwindows:--subsystem windows} \
   %{mconsole:--subsystem console} \
   -tsaware \
-  " CXX_WRAP_SPEC " \
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \

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