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

Re: side effects after installing gcc-

Akakima wrote:

> Why "of course" ?. You said in a previous post that the update would go
> without change in behaviour. 

  Sorry, I guess it was only implied by my post: the behaviour of *Cygwin*
applications hasn't changed.  I can't make guarantees about what DOS or
Windows will do because that's outside my control.  (And I don't think it
would make sense to avoid using Linux features in Cygwin just so that stuff
will work from DOS!)

> I do not want to use gcc-3.exe.
> I have many .bat/.cmd files calling gcc and i do not want to modify them.
> I still want to be able to call gcc.

  Wouldn't a good solution be for your windows path to have an extra directory
in it ahead of Cygwin's /bin directory, where you could put a windows shortcut
to gcc-3.exe and call it "gcc"?  That should work; by having this directory at
the front of your PATH in DOS (but not in Cygwin) you could easily add
overrides for the names of any Cygwin applications/symlinks that you wanted.

>>> and now if i type "gcc", cmd finds gcc-3.exe and launch it.
>>  That didn't work when I tried it:
>> C:\cygwin\etc\alternatives>gcc
>> Access is denied.
> Sorry, i dont know why. I assure you it works on my computer.
> The are many entries in the WIndows registry to support shortcuts.
> May be one of these entries is not ok on your machine.

  Yes, or it could just be a version difference.  I use win2k on my main system.

> the two commands:
>  gcc
>  gcc --version
> ask for an enter.
> The command: gcc file.c
> does generate a.exe without asking for an enter.
> I dont know why but will do some more checks.

  Something very strange is happening!  GCC doesn't read any input from stdin
in any of those cases, so it's surprising that it behaves differently.

> Yes i want to use cmd.exe. This is ok i think.
> And i want to type gcc not ggc-3. (lots of .bat files with gcc.exe refs)

  It's your own choice, of course, but I'd consider modifying the batch files.
 It might be easier than you think to change them all in one go:

find . -name '*.bat' | xargs sed -i -e 's/gcc.exe/gcc-3.exe/g'

> cmd.exe does understand links. I just reinstalled the update.
> Now, if i type (under cmd.exe):
>  E:\cygwin>E:\cygwin\etc\alternatives\gcc.lnk
>  E:\cygwin>gcc-3: no input files
>    <--- waiting for an enter here. Enter does gives me the next line.
>  E:\cygwin>

  OK, hang on a moment, I know it might sound silly of me to ask but now I
have to check: you aren't doing something unusual like running cmd.exe in a
rxvt window are you?  Or do you by any chance have CYGWIN=tty set in your
environment variables?  I wonder if it's really "waiting for an enter", or if
it's actually waiting for a full command line, and just the prompt hasn't been
flushed to the screen yet.  What happens if you type "dir <enter>" or some
other command instead of just pressing enter on its own?

  In your earlier examples, where I said "Cygwin doesn't read stdin anyway",
that's still the case.  But there is one difference that might be the reason
here: when you run "gcc file.c", gcc launches a number of subprocesses -
preprocessor, compiler, assembler, linker.  With the other two commands, it
runs and exits without launching any other executables; I wonder if somehow
that means that in one case all the output gets flushed and you see the prompt
and know it's finished, in the other case the prompt gets lost in a buffer
somewhere and you don't see it.  Maybe launching subprocesses causes all the
buffers to be flushed through in the first case.

> Now, i am not saying this is a bug in cygwin. Again, i just want to make
> someone aware of the fact this is not without change in behaviour.

  Sorry, yes, we're not always clear about this.  Usage from DOS is a
nice-to-have feature, but can't always be guaranteed to work the same as usage
from within a Cygwin shell.  When I said "no change in behaviour", I was only
thinking of "within a Cygwin environment"; my apologies for not being as clear
as I could have been.

> For the moment, i undone the update. Later i will find something else.
> (Like copy gcc-3.exe gcc.exe).

  I would advise you consider my suggestion of having a
renaming-and-overriding directory full of windows shortcuts at the head of
your PATH.  There are quite a lot of things in /bin that exist primarily as
symlinks to the real application, gcc is just one among many.

> And if i want to use both gcc3 and gcc4, i will probably use a couples
> of bat files that will switch things around.

  That would work nicely with the directory-full-of-shortcuts approach, and
basically you'd then have reimplemented in DOS the switching that I've done
only within the Cygwin environment.

  Hey, I just tried that out to see if it works, and it does, but it also
allows me to see the "waits for enter" problem occurring!  It's definitely
just the DOS prompt getting lost somehow; any command that you type before
pressing enter does get executed when you do.  Ah, look, it's not that the
prompt is getting lost: it's just that GCC's output comes out after the prompt
for some reason.  See the example below:


C:\cyg-overrides>gcc-3: no input files
 Volume in drive C is SYSTEM
 Volume Serial Number is D472-11D8

 Directory of C:\cyg-overrides

02/03/2009  19:04       <DIR>          .
02/03/2009  19:04       <DIR>          ..
02/03/2009  19:04                  443 gcc.lnk
               1 File(s)            443 bytes
               2 Dir(s)  50,528,649,216 bytes free


  Is that how it's happening for you?


Unsubscribe info:
Problem reports:

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