This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug bootstrap/30341] Makefile using mv instead of ln not working on WinXP Cygwin Bash



------- Comment #2 from rob1weld at aol dot com  2007-05-03 09:49 -------
Reviewing my old bug reports I noticed a reply may be needed here...


I _do_ build in a directory that is different from the source.

It is my guess that part of the problem is that Cygwin is attempting to make
unix-LIKE commands operate on the WinXP platform - the other part of the
trouble is that WinXP creates a "ghost" file in 8.3 format that "lives" for a
moment to facilitate programs that might need 8.3 names. IE: if I access a file
called long_name_file.txt the "ghost" called long_n~1.txt is also created.

There is an explanation on msn developer (that I would need to google to
re-visit) that explains this better than the above.

In short, the links don't work if you create them and then re-name (or "mv")
them immediately. It confuses the OS (no jokes please :) ).


Here is the resulting dorectory structure:

What you (the creators of the source code) might have expected is:

gcc
prev-gcc
etc.


What you end up with is:
gcc


If you look in the "gcc" directory you then see ugly things like "gcc" (again)
and "prev-gcc". The make process will continue like this and eventually fail.

If you stop it and restart it then you can (sometimes) get things like
"gcc/gcc/prev-gcc" show up.

If you have lots of other load running at the same time then you might not
create/rename quick enough and the "ghost" disappears (thus the "mv" commands
works as expected. You can't expect to get through a whole make and not get
nailed at least once (which is enough to break it).


Searching my HD for a "Makefile" that uses "sleep" between "mv" commands (I
know I had one at one time), I found the ACL2 "Rules for Writing Makefiles"
in their port to MinGW.
file://C:\ACL2-3.1\mingw\info\make.info\Utilities-in-Makefiles.html (you
probably don't have it and it is quite short, so I will quote it):

---

Node:Utilities in Makefiles, Next:Command Variables, Previous:Makefile Basics,
Up:Makefile Conventions 


--------------------------------------------------------------------------------


Utilities in Makefiles
Write the Makefile commands (and any shell scripts, such as configure) to run
in sh, not in csh. Don't use any special features of ksh or bash. 

The configure script and the Makefile rules for building and installation
should not use any utilities directly except these: 

     cat cmp cp diff echo egrep expr false grep install-info
     ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true

The compression program gzip can be used in the dist rule. 

Stick to the generally supported options for these programs. For example, don't
use mkdir -p, convenient as it may be, because most systems don't support it. 

It is a good idea to avoid creating symbolic links in makefiles, since a few
systems don't support them. 

The Makefile rules for building and installation can also use compilers and
related programs, but should do so via make variables so that the user can
substitute alternatives. Here are some of the programs we mean: 

     ar bison cc flex install ld ldconfig lex
     make makeinfo ranlib texi2dvi yacc

Use the following make variables to run those programs: 

     $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
     $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)

When you use ranlib or ldconfig, you should make sure nothing bad happens if
the system does not have the program in question. Arrange to ignore an error
from that command, and print a message before the command to tell the user that
failure of this command does not mean a problem. (The Autoconf AC_PROG_RANLIB
macro can help with this.) 

If you use symbolic links, you should implement a fallback for systems that
don't have symbolic links. 

Additional utilities that can be used via Make variables are: 

     chgrp chmod chown mknod

It is ok to use other utilities in Makefile portions (or scripts) intended only
for particular systems where you know those utilities exist. 

---

Usually GCC makefiles _do_ follow those rules. Not everything that works for
Unix bash works for Cygwin's bash (I do have the most current version).

This only occurs on Cygwin. The makefile that ./configure creates works fine on
the i686-pc-linux-gnu target, with it's bash shell. Strangely the MinGW bash
also does NOT have any trouble - only the _current_ Cygwin bash.

My point is that the method used in the 4.1.1 Makefile (generated by
./configure) works on all these platforms and the NEW 4.2.0 "Makefile method"
breaks on Cygwin. 

This bug report is an explanation of the problem and how either it can be fixed
by the maintainers _OR_ people (who use Cygwin) can search the bug reports and
make their own repairs; in the event that the maintainers do not desire to
alter the way the makefile is created to accommadate this peculiar problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30341


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