public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Crosscompile
@ 1997-03-08  2:17 Sergey Okhapkin
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Okhapkin @ 1997-03-08  2:17 UTC (permalink / raw)
  To: 'Gerhard Wesp'; +Cc: gnu-win32

Gerhard Wesp wrote:
> 
>  Should I use mywinsock.h? Or am I supposed to use the original winsock.h
> from M$ Visual C?
> 

No. You shold #include <sys/socket.h> to work with sockets.

-- 
Sergey Okhapkin
Moscow, Russia
Looking for a job

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crosscompile
@ 1997-03-08 11:52 Mikey
  0 siblings, 0 replies; 5+ messages in thread
From: Mikey @ 1997-03-08 11:52 UTC (permalink / raw)
  To: Gerhard Wesp; +Cc: cygnus

[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]

Attached are the shell scripts I wrote to use cygwin32 as a cross
linux/win95 compiler.

I tried to keep down disk space usage under both systems, so I used the
installed libs on my win95 system for the linux cross.

You'll have to edit the scripts to tell them where your cygwin32 source
tree lives, and where your vfat drives are mounted.

To use it this way, all system libraries must be in either
../cygnus-2.7.2-961023/
or H-i386-cygwin32/i386-cygwin32/lib, so I moved them all to H-...

ditto for the include files.

Unless you want to set up a linux cygnus libg++ you need a link in
/usr/include to your win32 include/g++ to compile c++ programs, the script
names this g++win32, and you have to remember to switch back and forth :^(,
or you could use -I

Your filesystems MUST! be mounted -b under cygwin32 before untaring the
header files under 95/NT to use the headers from all.tgz

Since linux/vfat dosen't understand cygwin32 symbolic links libc.a must be
copied to libg.a if you are using -g. ditto for curses/ncurses.

You might want to try it with, and without the %[cpp_cpu] in the linux
specs file, maybe it's just something wierd on my system.

typical command line

make CC=i386-cygwin32-gcc PATH=/usr/i386-cygwin32/bin:$PATH

This hasn't been tested extensivly, but I used the built compiler to
rebuild the libraries, and dll, and they seem to work. see SB.libs

----------
> From: Gerhard Wesp <gwesp@cosy.sbg.ac.at>
> To: gnu-win32@cygnus.com
> Subject: Crosscompile
> Date: Thursday, March 06, 1997 2:00 AM
> 
>  Hi all,
> 
>  I'm in the position of having to develop a piece of software which
should
> should work on UNIX as well as Win95. The code uses sockets, i.e. I
> have to use wsock32.dll. 
> 
>  I have Linux and Win95 on my PC, and I don't like rebooting into Windows
> and recompiling there everytime I change a bit of the code, so I was 
> wondering if it was possible to use gcc on Linux as a crosscompiler.
> 
>  I tried the win32-{gcc,binutils,...} packages of Debian, but they don't
> really work (especially there are problems with include files). Moreover,
> they seem a bit outdated and basically come without documentation.
> 
>  What steps would be necessary
> to use gcc as a crosscompiler?  Since the CPU is the same on Linux
> and on Win95, shouldn't it be sufficient to use just a specialized
> assembler and linker to create .obj's and then .exe's? Would it be
> possible to use the header files from e.g. M$ Visual C 4.00 with gcc?
> 
>  Any hints are deeply appreciated!
> 
> -Gerhard
> -
> For help on using this list, send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
SB.cross (CROSS File)
SB.libs (LIBS File)
Ar_obj.dif (DIF File)
Gas.dif (DIF File)


[-- Attachment #2: Ar_obj.dif --]
[-- Type: text/x-diff, Size: 1123 bytes --]

--- Makefile.in	1997/03/06 00:54:31	1.1
+++ Makefile.in	1997/03/06 01:01:16
@@ -308,15 +308,15 @@
 
 # Alternatively, you can install ranlib.sh as ranlib.
 
-ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o
-	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS)
+ar_with_ranlib: $(ADDL_DEPS) ar.o arparse.o arlex.o maybe-ranlib.o arsup.o
+	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o arparse.o arlex.o maybe-ranlib.o arsup.o $(ADDL_LIBS) $(EXTRALIBS)
 	-rm -f $(RANLIB_PROG)
 	-ln $(AR_PROG) $(RANLIB_PROG)
 
 # objcopy and strip in one binary that uses argv[0] to decide its action.
 
-objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o
-	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS)
+objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o $(WRITE_DEBUG_OBJS)
+	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS)
 	-rm -f $(STRIP_PROG)
 	-ln $(OBJCOPY_PROG) $(STRIP_PROG)
 

[-- Attachment #3: Gas.dif --]
[-- Type: text/x-diff, Size: 944 bytes --]

--- Makefile.in	1997/03/06 00:27:41	1.1
+++ Makefile.in	1997/03/06 00:21:58
@@ -231,9 +231,9 @@
 
 # How to link with both our special library facilities
 # and the system's installed libraries.
-
+LIBIBERTY = ../libiberty/libiberty.a
 LIBDEPS = @OPCODES_DEP@ @BFDDEP@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
-LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
+LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) $(LIBIBERTY)
 
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
@@ -262,7 +262,7 @@
 	listing.h bignum.h $(srcdir)/../include/libiberty.h
 
 gasp.new: $(GASPOBJS) ../libiberty/libiberty.a
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) ../libiberty/libiberty.a $(LOADLIBES)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) $(LIBS) $(LOADLIBES)
 
 installcheck:
 	@echo No installcheck target is available yet for the GNU assembler.

[-- Attachment #4: SB.cross --]
[-- Type: text/x-shellscript, Size: 3636 bytes --]

#!/bin/sh
#this is a bash shell script to make a linux/cygwin32 cross compiler
#it is designed to hopefully :^) minimize disk space usage, and
#maximize the speed of the resulting cross-compiler
set -a #export all variables

#echo change the following variables to fit your setup

CROSS_PREFIX=/dos/c/usr
CWD=`pwd`
GXXINCLUDE=$CROSS_PREFIX/include/g++
MY_HOST_COMPILER=i586-unknown-linux
CC=gcc
CPPNAME="gcc -E"
SRC_DIR=$CROSS_PREFIX/src/cygwin32
CYG_VER=cygnus-2.7.2-961023

if [ ! -f $SRC_DIR/CYGNUS ];then
 echo "please show me the source Luke :^)"
 exit 1;
fi

# first make sure only the necessary dirs get built
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild
if [ -d $SRC_DIR/byacc ];then
  pushd $SRC_DIR
  mv -f bash byacc dejagnu diff dosrel expect fileutils findutils flex gawk \
    gdb gprof grep grez gzip less libg++ libgloss libio librx libstdc++ m4 \
    make mmalloc ncurses newlib patch readline release sed send-pr \
    shellutils sim tar tcl texinfo textutils time tk utils winsup xiberty \
    znobuild/
  popd
fi 

if [ x"$TMP" = x ];then
  [ -d /tmp ] || mkdir /tmp
  TMP=/tmp;
fi

cd $TMP
mkdir -p cx32o tmp/usr

if [ ! -f $SRC_DIR/binutils/Makefile.in.* ];then
	patch -p0 -d $SRC_DIR/binutils/ < $CWD/ar_obj.dif;
fi
if [ ! -f $SRC_DIR/gas/Makefile.in.* ];then
	patch -p0 -d $SRC_DIR/gas/ < $CWD/gas.dif;
fi
 
cd cx32o

if [ ! -f config.status ];then
    $SRC_DIR/configure --prefix=/usr\
      --enable-commonbfdlib --enable-shared\
      --host=$MY_HOST_COMPILER\
      --target=i386-cygwin32 -v 
fi

make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s

make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s -C binutils/ ar_with_ranlib objcopy_with_strip

make prefix=$TMP/tmp/usr install

#this causes a bad invocation of cpp at least for me :^) so get rid of it.

sed s/%\\[cpp_cpu\\]// < gcc/specs > $TMP/tmp/usr/lib/gcc-lib/i386-cygwin32/$CYG_VER/specs

cd ../tmp/usr/bin
rm protoize unprotoize
ln -sf i386-cygwin32-ar i386-cygwin32-ranlib
ln -sf i386-cygwin32-objcopy i386-cygwin32-strip
ln -sf i386-cygwin32-g++ i386-cygwin32-c++
strip *
cd ../lib
rm -fr *.a ../man ../info
strip * 
cd ../include
ln -sf GXXINCLUDE g++cygwin32
cd ../i386-cygwin32/bin
rmdir ../install-tools #how this got here I have no idea :)
ln -sf ../../bin/i386-cygwin32-ar ranlib
ln -sf ../../bin/i386-cygwin32-ar ar
ln -sf ../../bin/i386-cygwin32-gcc gcc
ln -sf ../../bin/i386-cygwin32-as as
ln -sf ../../bin/i386-cygwin32-dlltool dlltool
ln -sf ../../bin/i386-cygwin32-ld ld
ln -sf ../../bin/i386-cygwin32-nm nm
ln -sf ../../bin/i386-cygwin32-objcopy strip
# for when you have to reset path in the Makefile to use all cross tools
ln -sf ../../bin/i386-cygwin32-g++ g++
ln -sf ../../bin/i386-cygwin32-g++ c++
ln -sf ../../bin/i386-cygwin32-c++filt c++filt
ln -sf ../../bin/i386-cygwin32-gasp gasp
ln -sf ../../bin/i386-cygwin32-objcopy objcopy
ln -sf ../../bin/i386-cygwin32-objdump objdump
ln -sf ../../bin/i386-cygwin32-size size
ln -sf ../../bin/i386-cygwin32-strings strings
rm -fr ../include ../lib
cd ..
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/include include
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/lib lib
cd ../lib/gcc-lib/i386-cygwin32/$CYG_VER/
strip c* ld
rm -fr include
ln -s $CROSS_PREFIX/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/$CYG_VER/include include

cd $TMP/tmp
makepkg cx32.tgz;mv cx32.tgz .. # or put your binary package maker here
cd $TMP

if [ x"$1" = x--cleanup ];then
	rm -fr $TMP/tmp $TMP/cx32o;
        pushd $SRC_DIR
	mv -f znobuild/* .
	rmdir znobuild
	popd
fi


[-- Attachment #5: SB.libs --]
[-- Type: text/x-shellscript, Size: 2957 bytes --]

#!/bin/sh
#this is a bash shell script to make a the cygwin32 libraries from linux
#it is designed to hopefully :^) minimize disk space usage, by installing
#the new libraries to your vfat drive where the native cygwin32 compiler lives
set -axv #export all variables

#echo change the following variables to fit your setup

CROSS_PREFIX=dos/c/usr/H-i386-cygwin32 # !! NO slash here
SRC_DIR=/dos/c/usr/src/cygwin32

if [ ! -f $SRC_DIR/CYGNUS ];then
 echo "please show me the source Luke :^)"
 exit 1;
fi

if [ ! -d /$CROSS_PREFIX ];then
 echo "please show me the destination Luke :^)"
fi

if [ x"$TMP" = x ];then
  [ -d /tmp ] || mkdir /tmp
  TMP=/tmp;
fi

cd $TMP
mkdir -p lx32o tmp/$CROSS_PREFIX/

cd lx32o

#make sure only the necesary dirs get built
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild
if [ -d $SRC_DIR/byacc ];then
  pushd $SRC_DIR
  mv -f bash binutils byacc dejagnu diff dosrel expect fileutils\
    findutils flex gas gawk gcc gdb gprof grep grez gzip ld less \
    m4 make ncurses patch release sed send-pr \
    shellutils sim tar tcl texinfo textutils time tk utils xiberty \
    znobuild/
  popd
fi

[ -f config.status ] || CC="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023"\
 CXX="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023"\
 PATH=/usr/i386-cygwin32/bin:$PATH $SRC_DIR/configure --prefix=/usr\
 --srcdir=$SRC_DIR --host=i586-unknown-linux --target=i386-cygwin32 -v

make CFLAGS="-O -g" LDFLAGS=

make prefix=$TMP/tmp/$CROSS_PREFIX install


cd $TMP/tmp/$CROSS_PREFIX/i386-cygwin32/lib
mv cygwin.dll ../../bin
ln -sf libc.a libg.a #this will fail on vfat but might remind us
mv libstdc++.a libg++.a libiberty.a libc.a libg.a libm.a ../../lib
i386-cygwin32-strip --strip-debug *.a #since these are mostly just dll stubs

cd ../../lib
mv libi386-cygwin32-bfd.a libbfd.a
mv libi386-cygwin32-opcodes.a libopcodes.a
mv *.a ../i386-cygwin32/lib/

cd ../bin
for file in cygwin ps mount umount kill;do
  mv i386-cygwin32-$file $file.exe;
done
strip *.exe
mv ../include ../man ../etc ../..

cd ../../include

mv *.h readline ../H-i386-cygwin32/i386-cygwin32/include/

if [ "1" = "0" ];then #ncurses really dosen't like being built cross

cd $TMP/lx32o
[ -d ncurses ] || mkdir ncurses
cd ncurses
[ -f config.status ] || CC="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023 -I/usr/i386-cygwin32/include "\
 CXX="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023 -I/usr/i386-cygwin32/include -I/dos/c/usr/include/g++"\
 PATH=/usr/i386-cygwin32/bin:$PATH $SRC_DIR/ncurses/configure --prefix=/usr\
 --target=i386-cygwin32 --enable-getcap --enable-termcap \
 --program-suffix=.exe --enable-symlinks -v
make includedir=/usr/i386-cygwin32/include

make LDFLAGS= prefix=$TMP/tmp/$CROSS_PREFIX/.. install

fi

cd $TMP/tmp
makepkg lx32.tgz;mv lx32.tgz .. # or put your binary package maker here
cd $TMP

if [ x"$1" = x--cleanup ];then
	rm -fr $TMP/tmp $TMP/lx32o;
        pushd $SRC_DIR
        mv -f znobuild/* .
        rmdir znobuild
        popd
fi






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crosscompile
  1997-03-07  0:05 ` Crosscompile HASEGAWA Kay
@ 1997-03-07  8:30   ` gwesp
  0 siblings, 0 replies; 5+ messages in thread
From: gwesp @ 1997-03-07  8:30 UTC (permalink / raw)
  To: HASEGAWA Kay; +Cc: gnu-win32

 Hi all,

 I did the compile today and was surprised how smooth it worked. The only
problem was that it couldn't build libreadline because of a missing
termcap.h. But I don't need that one anyway.

 However, the mywinsock.h include file still doesn't work. I get the 
following errors:
In file included from test.c:1:
/usr/local/lib/gcc-lib/i486-pc-cygwin32/cygnus-2.7.2-961023/../../../../i486-pc-cygwin32/include/mywinsock.h:87: syntax error before `u_short'
/usr/local/lib/gcc-lib/i486-pc-cygwin32/cygnus-2.7.2-961023/../../../../i486-pc-cygwin32/include/mywinsock.h:767: syntax error before string constant
/usr/local/lib/gcc-lib/i486-pc-cygwin32/cygnus-2.7.2-961023/../../../../i486-pc-cygwin32/include/mywinsock.h:809: syntax error before `}'

 Should I use mywinsock.h? Or am I supposed to use the original winsock.h
from M$ Visual C?

Greetings,
-Gerhard

HASEGAWA Kay writes:
> What I did was following;
> 1)un-tar cdksrc.tar in SRC=/usr/local/src/cygwin32 for example, 
> 2)mkdir $(SRC)/i586-pc-cygwin32 ,and cd there
> 3)../configure --target=i586-pc-cygwin32 --host=i586-pc-linux
> 4)make, then install
>  
> I think making cross-compiler from original gcc would be tough with/without
> MSV++ headers.
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crosscompile
  1997-03-06  1:01 Crosscompile Gerhard Wesp
@ 1997-03-07  0:05 ` HASEGAWA Kay
  1997-03-07  8:30   ` Crosscompile gwesp
  0 siblings, 1 reply; 5+ messages in thread
From: HASEGAWA Kay @ 1997-03-07  0:05 UTC (permalink / raw)
  To: gnu-win32

gwesp>> I tried the win32-{gcc,binutils,...} packages of Debian, but they don't
gwesp>>really work (especially there are problems with include files). Moreover,
gwesp>>they seem a bit outdated and basically come without documentation.
gwesp>>
gwesp>> What steps would be necessary
gwesp>>to use gcc as a crosscompiler?  Since the CPU is the same on Linux
gwesp>>and on Win95, shouldn't it be sufficient to use just a specialized
gwesp>>assembler and linker to create .obj's and then .exe's? Would it be
gwesp>>possible to use the header files from e.g. M$ Visual C 4.00 with gcc?

As the cross-compiler package included in Debian is slightly older to make 
cross-compiled apps run with cygwin.dll of gnu-win32 B17.1, it is a good
idea to make updated cross-compiler from 17.1B distribution.  
What I did was following;
1)un-tar cdksrc.tar in SRC=/usr/local/src/cygwin32 for example, 
2)mkdir $(SRC)/i586-pc-cygwin32 ,and cd there
3)../configure --target=i586-pc-cygwin32 --host=i586-pc-linux
4)make, then install
 
I think making cross-compiler from original gcc would be tough with/without
MSV++ headers.

-Kay
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Crosscompile
@ 1997-03-06  1:01 Gerhard Wesp
  1997-03-07  0:05 ` Crosscompile HASEGAWA Kay
  0 siblings, 1 reply; 5+ messages in thread
From: Gerhard Wesp @ 1997-03-06  1:01 UTC (permalink / raw)
  To: gnu-win32

 Hi all,

 I'm in the position of having to develop a piece of software which should
should work on UNIX as well as Win95. The code uses sockets, i.e. I
have to use wsock32.dll. 

 I have Linux and Win95 on my PC, and I don't like rebooting into Windows
and recompiling there everytime I change a bit of the code, so I was 
wondering if it was possible to use gcc on Linux as a crosscompiler.

 I tried the win32-{gcc,binutils,...} packages of Debian, but they don't
really work (especially there are problems with include files). Moreover,
they seem a bit outdated and basically come without documentation.

 What steps would be necessary
to use gcc as a crosscompiler?  Since the CPU is the same on Linux
and on Win95, shouldn't it be sufficient to use just a specialized
assembler and linker to create .obj's and then .exe's? Would it be
possible to use the header files from e.g. M$ Visual C 4.00 with gcc?

 Any hints are deeply appreciated!

-Gerhard
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-03-08 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-08  2:17 Crosscompile Sergey Okhapkin
  -- strict thread matches above, loose matches on Subject: below --
1997-03-08 11:52 Crosscompile Mikey
1997-03-06  1:01 Crosscompile Gerhard Wesp
1997-03-07  0:05 ` Crosscompile HASEGAWA Kay
1997-03-07  8:30   ` Crosscompile gwesp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).