From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Marius Storm-Olsen <mstormo@gmail.com>
Cc: GIT Mailing-list <git@vger.kernel.org>,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: MSVC build broken (on cygwin)
Date: Sat, 03 Oct 2009 20:36:28 +0100 [thread overview]
Message-ID: <4AC7A7BC.5070608@ramsay1.demon.co.uk> (raw)
In-Reply-To: <4AC5B4AE.5070307@gmail.com>
Marius Storm-Olsen wrote:
> ...
> Clone the git://repo.or.cz/msvcgit.git, and run the
> setup_32bit_env.cmd script in there, and you should have everything
> you need to both compile and link Git with MSVC.
>
Hmm, I'm trying to avoid YASORD (Yet Another Set Of Redundant
Dependencies ;-) On my laptop, I currently have 4 zlib installations,
5 openssl installations, 3 iconv's ...
As I said earlier (see below), I'm not so interested in getting the
msvc build to work for me, rather than understand why it works for you,
since it should not work!
Having said that, I *may* try to get it working on my cygwin
installation. However, I'm much more likely to make some changes to
the build/Makefile to allow the dependent libraries to be installed
in different locations :) There is nothing wrong with my zlib at
C:\zlib.
>> Anyway, the point is *not* to get the msvc build to work for me; rather
>> it is to understand why the build *works* for you. ;-)
>
> First of all, thanks for the thorough report! :)
You're welcome.
> Second, I just recompiled, and it magically works for me. Why is a
> good question, since I also think it shouldn't at this point. The
Oh, you *really* don't want "magic" to be the answer... :P
> So, obviously, some magic in there is making it work for me. I have a
> hard time locating the magic in question though. :-/
Which shell are you using? MSYS-bash?
Which make are you using? MSYS-GNU?
Which Perl are you using? ActiveState? MSYS?
I'm using cygwin 1.5.22, along with the cygwin versions of
bash 3.2, GNU make 3.81, perl 5.8.7
I noticed that the clink.pl script was not returning the correct exit
code to the Makefile, which is why I ended up snipping 940 lines of
output from the earlier #error demonstration; the Makefile does not
notice when the compile exits with an error.
In order to fix this issue for me, I made the following change:
-- >8 --
diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl
index 0ffd59f..3e4e501 100644
--- a/compat/vcbuild/scripts/clink.pl
+++ b/compat/vcbuild/scripts/clink.pl
@@ -45,4 +45,18 @@ if ($is_linking) {
push(@args, @cflags);
}
#printf("**** @args\n");
-exit system(@args);
+
+system(@args);
+
+if ($? == -1) {
+ print "clink.pl: failed to execute: $!\n";
+ exit 1;
+}
+elsif ($? & 127) {
+ printf "clink.pl: child died with signal %d%s\n",
+ ($? & 127), ($? & 128) ? ', coredump.' : '.';
+ exit 1;
+}
+
+exit $? >> 8;
+
-- >8 --
See "perldoc -f system" for more explanation of the above. This is
how it works on unix and unix-alike systems, so this may not work
too well on (say) ActiveState Perl; Dunno. Also, according to this
documentation, the form of the call to system() should result in a
call to an exec function, rather than using a shell; this may or
may not be true on other platforms.
Having fixed that problem, I modified clink.pl again so that it
would run args.exe rather than cl.exe; this allowed me to see,
using: make -> perl -> "system()" -> args.exe, just what will be
passed to the compiler.
Just in case you can't guess, create args.exe from:
$ cat -n args.c
1 #include <stdio.h>
2
3 int main(int argc, char *argv[])
4 {
5 int i;
6
7 for (i=0; i< argc; i++) {
8 printf("argv[%d] = '%s'\n", i, argv[i]);
9 }
10 exit(1);
11 }
12
$
and put it somewhere in your path (~/bin for me).
$ make MSVC=1
GIT_VERSION = 1.6.5.rc1.38.gb4f27.dirty
* new build flags or prefix
CC fast-import.o
argv[0] = 'args'
argv[1] = '-Fofast-import.o'
argv[2] = '-c'
argv[3] = '-nologo'
argv[4] = 'fast-import.c'
argv[5] = '-I.'
argv[6] = '-I../zlib'
argv[7] = '-Icompat/vcbuild'
argv[8] = '-Icompat/vcbuild/include'
argv[9] = '-DWIN32-D_CONSOLE'
[...snipped...]
argv[56] = '-Icompat/regex'
make: *** [fast-import.o] Error 1
Perhaps you could try a similar exercise?
Hmm, do you have any funny environment variables set which msvc is
picking up?
Oh, what about the CL variable?
> That being said, does adding the space between the defines fix the
> MSVC compilation using Cygwin's GNU Make? It's none-the-less a correct
> patch, so you get an ack from me. Thanks!
>
> Acked-by: Marius Storm-Olsen <mstormo@gmail.com>
>
Thanks!
ATB,
Ramsay Jones
prev parent reply other threads:[~2009-10-03 20:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 17:11 MSVC build broken (on cygwin) Ramsay Jones
2009-10-02 8:07 ` Marius Storm-Olsen
2009-10-02 8:23 ` Alex Riesen
2009-10-02 8:49 ` Marius Storm-Olsen
2009-10-03 20:06 ` Ramsay Jones
2009-10-03 20:29 ` Marius Storm-Olsen
2009-10-03 19:36 ` Ramsay Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC7A7BC.5070608@ramsay1.demon.co.uk \
--to=ramsay@ramsay1.demon.co.uk \
--cc=git@vger.kernel.org \
--cc=mstormo@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.