This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Re: Building linux cross cygwin with net release source?


On Sat, 15 Apr 2000, Mo DeJong wrote:

> On Fri, 14 Apr 2000, Mumit Khan wrote:
> 
> > DJ Delorie <dj@delorie.com> writes:
> > > 
> > > > that file in the new net release. What src tar file do I
> > > > need to grab and build?
> > > 
> > > You need cygwin, to get newlib, winsup, etc.  Or just install the
> > > cygwin binary package somewhere; it has all the headers and libraries.
> > > 
> > > You'll next need binutils and gcc, as usual.
> > > 
> > > Plus, there's a howto online, but you may need to adjust it
> > > for the updated sources:
> > > 
> > > http://www.delorie.com/howto/cygwin/cygwin-cross-howto.html
> > 
> > Thanks for pointing this out! This of course becomes much simpler
> > now that we have a reasonable set of easily available sources
> > with upcoming net release. I'll update the docs as soon as the
> > release is out.
> > 
> > Regards,
> > Mumit
> 
> 
> Following DJ's advice, I grabbed the cygwin usr/i686-pc-cygwin/include
> from my cygwin distro and put them in the install dir (the --prefix
> option).
> 
> Now I am able to get a little farther in the gcc cross build process.
> It hums along until in i586-cygwin32/libiberty and i586-cygwin32/libio.
> Here is the important output written when I run the make command in
> the root of the gcc cross build directory. (comments make by me
> are inside of the !!!!! .... !!!!! blocks)
> 
> 
> 
> ...

<snip>

> /abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/bin/ld:
> cannot open crt0.o: No such file or directory
> collect2: ld returned 1 exit status

<snip>


I figured out that the missing crt0.o error was
caused by a lack of the install/i586-cygwin32/lib
directory in the --prefix location. Once I copied
that firectory from my cygwin 95 filesystem to
the linux dir, I was able to get a little farther
with the compile.

I then ran into this error:

/home/mdejong/cygwin/build/Xcygwin/gcc/gcc/xgcc
-B/home/mdejong/cygwin/build/Xcygwin/gcc/gcc/
-B/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/bin/
-I/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include
-c -DHAVE_CONFIG_H -g -O2 -I.
-I/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/../include
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/getopt1.c
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/getopt1.c: In function
`getopt_long':
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/getopt1.c:75: argument
`argv' doesn't match
prototype/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include/getopt.h:56:
prototype declaration
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/getopt1.c:75: argument
`options' doesn't match prototype
/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include/getopt.h:56:
prototype declaration
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/getopt1.c:75: argument
`long_options' doesn't match prototype
/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include/getopt.h:56:
prototype declaration
make[1]: *** [getopt1.o] Error 1
make[1]: Leaving directory
`/abomination/figment/mdejong/cygwin/build/Xcygwin/gcc/i586-cygwin32/libiberty'
make: *** [all-target-libiberty] Error 2


from src/gcc-2.95.2/libiberty/getopt1.c

int
getopt_long (argc, argv, options, long_options, opt_index)
     int argc;
     char *const *argv;
     const char *options;
     const struct option *long_options;
     int *opt_index;
{
  return _getopt_internal (argc, argv, options, long_options, opt_index,
0);
}


from src/gcc-2.95.2/include/getopt.h

#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
   differences in the consts, in stdlib.h.  To avoid compilation
   errors, only prototype getopt for the GNU C library.  */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char
*shortopts,
                        const struct option *longopts, int *longind);


from install/i586-cygwin32/getopt.h

int getopt (int, char * const *, const char *);

int getopt_long (int, char **, char *, struct option *, int *);



So the only diff is the use of the const keyword.


A quick gcc -v showed that the install/i586-cygwin32/getopt.h was
being found before the src/gcc-2.95.2/include/getopt.h, I swapped
the order of these -I flags and the getopt file compiled.





Here is the patch I created for build/gcc-2.95.2/Makefile.
(I know this is not the right place to patch the problem,
I am just putting this in so you can tell how I worked
around the problem).

The patch just adds -I$(build_tooldir)/include after the
newlib includes in each spot I thought it would matter.


--- copy_Makefile       Sat Apr 15 02:36:34 2000
+++ Makefile    Sat Apr 15 03:37:45 2000
@@ -236,12 +236,12 @@
   if [ -f $$r/gcc/xgcc ] ; then \
     if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
       if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
-        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/
-B$(build_tooldir)/bin/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -nostdinc; \
+        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/
-B$(build_tooldir)/bin/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -I$(build_tooldir)/include -nostdinc; \
       else \
-        echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -nostdinc; \
+        echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -I$(build_tooldir)/include -nostdinc; \
       fi; \
     else \
-      echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/; \
+      echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-I$(build_tooldir)/include; \
     fi; \
   else \
     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
@@ -255,11 +255,12 @@
 # variable is passed down to the gcc Makefile, where it is used to
 # build libgcc2.a.  We define it here so that it can itself be
 # overridden on the command line.
-GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-I$(build_tooldir)/include
+#GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-I$(build_tooldir)/include
+GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
 
 CHILL_FOR_TARGET = ` \
   if [ -f $$r/gcc/xgcc ] ; then \
-    echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-L$$r/gcc/ch/runtime/; \
+    echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-I$(build_tooldir)/include -L$$r/gcc/ch/runtime/; \
   else \
     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
       echo $(CC); \
@@ -272,12 +273,12 @@
   if [ -f $$r/gcc/xgcc ] ; then \
     if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
       if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
-        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/
-B$(build_tooldir)/bin/ -L$$r/winsup -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -nostdinc; \
+        echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/
-B$(build_tooldir)/bin/ -L$$r/winsup -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -nostdinc -I$(build_tooldir)/include; \
       else \
-        echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -nostdinc; \
+        echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -idirafter
$$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter
$$s/newlib/libc/include -I$(build_tooldir)/include -nostdinc; \
       fi; \
     else \
-      echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/; \
+      echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
-I$(build_tooldir)/include; \
     fi; \
   else \
     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \




I ran make again, and a bunch of other files in
libiberty then compiled. I then I got this error.


  /home/mdejong/cygwin/build/Xcygwin/gcc/gcc/xgcc
-B/home/mdejong/cygwin/build/Xcygwin/gcc/gcc/
-B/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/bin/
-I/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include
-c -DHAVE_CONFIG_H -g -O2 -I.
-I/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/../include
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c -o pic/vsprintf.o
/home/mdejong/cygwin/build/Xcygwin/gcc/gcc/xgcc
-B/home/mdejong/cygwin/build/Xcygwin/gcc/gcc/
-B/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/bin/
-I/abomination/figment/mdejong/cygwin/install/Xcygwin/i586-cygwin32/include
-c -DHAVE_CONFIG_H -g -O2 -I.
-I/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/../include
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c: In function
`vsprintf':
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:47: structure has
no member named `_flag'
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:47: `_IOWRT'
undeclared (first use in this function)
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:47: (Each
undeclared identifier is reported only once
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:47: for each
function it appears in.)
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:47: `_IOSTRG'
undeclared (first use in this function)
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:48: structure has
no member named `_ptr'
/home/mdejong/cygwin/src/gcc-2.95.2/libiberty/vsprintf.c:49: structure has
no member named `_cnt'
make[1]: *** [vsprintf.o] Error 1
make[1]: Leaving directory
`/abomination/figment/mdejong/cygwin/build/Xcygwin/gcc/i586-cygwin32/libiberty'
make: *** [all-target-libiberty] Error 2


from src/gcc-2.95.2/libiberty/vsprintf.c

int
vsprintf (buf, format, ap)
     char *buf;
     const char *format;
     va_list ap;
{
  FILE b;
  int ret;
#ifdef VMS
  b->_flag = _IOWRT|_IOSTRG;
  b->_ptr = buf;
  b->_cnt = 12000;
#else
  b._flag = _IOWRT|_IOSTRG;
  b._ptr = buf;
  b._cnt = 12000;
#endif
  ret = _doprnt(format, ap, &b);
  putc('\0', &b);
  return ret;

}



from install/i586-cygwin32/include/sys/reent.h

struct __sFILE {
  unsigned char *_p;    /* current position in (some) buffer */
  int   _r;             /* read space left for getc() */
  int   _w;             /* write space left for putc() */
  short _flags;         /* flags, below; this FILE is free if 0 */
  short _file;          /* fileno, if Unix descriptor, else -1 */
  struct __sbuf _bf;    /* the buffer (at least 1 byte, if !NULL) */
  int   _lbfsize;       /* 0 or -_bf._size, for inline putc */




The cygwin headers do define a FILE._flags member (I would guess
this is what would replace _flag in the vsprintf code) but there
is no _ptr or _cnt member of this struct.

This is just getting too whacked out, I must be doing something
wrong to be getting these strange compile results.


Has anyone actually been able to build a linux cross cygwin
with the new "net release" cygwin include and lib files,
binutils from the cygwin net release, and gcc-2.95.2?


Mo Dejong
Red Hat Inc.



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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