delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/01/09/08:18:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Apparently-From: <earnie?boyd AT yahoo DOT com>
Message-ID: <3A5B0F7F.79EB3754@yahoo.com>
Date: Tue, 09 Jan 2001 08:17:51 -0500
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: cygwin AT cygwin DOT com
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: NOE Nicolas <n DOT noe AT cstb DOT fr>
CC: "Cygwin (Adresse de messagerie)" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: latest release trouble using stat() with -mno-cygwin flag
References: <F0793061A5B1D411AC9B08000628282304B7E9 AT cervin DOT grenoble DOT cstb DOT fr>

--------------1E07AC2EA0D92158F935EFCA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

NOE Nicolas wrote:
> 
> Hello,
> 
> I use stat() from sys/stat.h to get a file size in a C program,
> compiling with -mno-cygwin flag. It used to work before I updated
> to latest releases (cygwin, gcc and mingw), but now the stat
> structure seems to be melted, since I always get 4 as st_size, and
> that the real size seems to be in the st_atime field ! By the way,
> everything works fine without -mno-cygwin flag.
> 
> Maybe I should ask my question on the mingw list, but I don't know
> if the mingw included in cygwin distribution is just a copy of the
> latest mingw release or if some things are changed. If the bug
> comes from a faulty mingw, is there a safe way to remove my current
> one (mingw-20001225-1.tar.gz) and reinstall a previous one ?
> 
> I use the command line : gcc -mno-cygwin -o stat stat.c and my test
> program is the following (stat.c) :
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> #include <sys/stat.h>
> 
> int main(int argc, char *argv[])
> {
>         int             i;
>         struct stat     buf;
> 
>         for (i = 1; i < argc; i++)
>                 if (stat(argv[i], &buf))
>                         fprintf(stderr, "stat(): error\n");
>                 else
>                         printf("%s size is %d\n", argv[i], buf.st_size);
> 
>         return 0;
> }
> 

I've modified the MinGW runtime such that the GCC specs file is
incorrect with regard to the oldname library and you've used an old
name.  You have three options:

1) Don't use the oldname function, i.e.: use the _stat() version
instead.
2) gcc -o stat stat.c -lcoldname
3) Apply the attached patch:
   A) download diff file to /tmp/specs.diff.txt
   B) cd /
   C) patch -i /tmp/specs.diff.txt

Cheers,
Earnie
--------------1E07AC2EA0D92158F935EFCA
Content-Type: text/plain; charset=us-ascii;
 name="specs.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="specs.diff.txt"

--- /lib/gcc-lib/i686-pc-cygwin/2.95.2-6/specs.orig	Wed Jan  3 12:01:40 2001
+++ /lib/gcc-lib/i686-pc-cygwin/2.95.2-6/specs	Tue Jan  9 08:08:45 2001
@@ -25,3 +25,3 @@
 *libgcc:
-%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lcrtdll}
+%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lcoldname -lcrtdll}
 


--------------1E07AC2EA0D92158F935EFCA
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
--------------1E07AC2EA0D92158F935EFCA--


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019