
From: Simon Peyton-Jones
To: "Edward Z. Yang" , Simon Marlow Cc: "ghc-devs@haskell.org" Subject: RE: More windows woe Message-ID: <59543203684B2244980D7E4057D5FBC1485BB7AB@DB3EX14MBXC308.europe.corp.microsoft.com> Content-Type: text/plain; charset="utf-8"
Simon Marlow: please help! At the moment windows builds are hosed, which is a Bad Situation.
Actually it turns out that what want is
debugBelch("Checking whether to unload %S\n", oc->fileName));
That is, use "%S" rather than "%s" as format specifier for wide chars.
Sadly, this works on Windows, but not on Linux: rts/CheckUnload.c:260:13: error: format ?%S? expects argument of type ?wchar_t *?, but argument 2 has type ?pathchar *? [-Werror=format]
So what I need guidance on, please!, is what the approved way to deal with this is. I suppose that I could identify each use of %s on a filepath and say
#ifdef mingw32_HOST_OS debugBelch("Checking whether to unload %S\n", oc->fileName)); #else debugBelch("Checking whether to unload %s\n", oc->fileName)); #endif
But that seems deeply unsatisfactory doesn't it?
If not that, then what?
Simon
Similar code is in place to distinguish between 32-bit and 64-bit StgWords:
grep -r -e FMT_Word includes/ includes/stg/Types.h:#define FMT_Word32 "u" includes/stg/Types.h:#define FMT_Word32 "lu" includes/stg/Types.h:#define FMT_Word64 "lu" includes/stg/Types.h:#define FMT_Word64 "llu" includes/stg/Types.h:#define FMT_Word FMT_Word64 includes/stg/Types.h:#define FMT_Word FMT_Word32
and format strings like "blabla " FMT_Word " ..blabla" are used inside rts/. One could do the same for FMT_Path and introduce it where required. Maybe this would be acceptable? / Jost

I think this is reasonable, with the added caveat that the macros should be placed in includes/rts/Linker.h, because that is where pathchar is defined. So how about something like: diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h index e900e85..871b8cd 100644 --- a/includes/rts/Linker.h +++ b/includes/rts/Linker.h @@ -16,8 +16,10 @@ #if defined(mingw32_HOST_OS) typedef wchar_t pathchar; +#define FMT_PATH "%S" #else typedef char pathchar; +#define FMT_PATH "%s" #endif /* initialize the object linker */ diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index a758b06..8dc8fdc 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -254,7 +254,7 @@ void checkUnload (StgClosure *static_objects) // Mark every unloadable object as unreferenced initially for (oc = unloaded_objects; oc; oc = oc->next) { - IF_DEBUG(linker, debugBelch("Checking whether to unload %s\n", + IF_DEBUG(linker, debugBelch("Checking whether to unload " FMT_PATH "\n", oc->fileName)); oc->referenced = rtsFalse; } @@ -290,11 +290,11 @@ void checkUnload (StgClosure *static_objects) } else { prev->next = oc->next; } - IF_DEBUG(linker, debugBelch("Unloading object file %s\n", + IF_DEBUG(linker, debugBelch("Unloading object file " FMT_PATH "\n", oc->fileName)); freeObjectCode(oc); } else { - IF_DEBUG(linker, debugBelch("Object file still in use: %s\n", + IF_DEBUG(linker, debugBelch("Object file still in use: " FMT_PATH "\n", oc->fileName)); } } diff --git a/rts/Linker.c b/rts/Linker.c index 6490242..4f0a1c4 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -2790,7 +2790,7 @@ unloadObj( pathchar *path ) initLinker(); - IF_DEBUG(linker, debugBelch("unloadObj: %s\n", path)); + IF_DEBUG(linker, debugBelch("unloadObj: " FMT_PATH "\n", path)); prev = NULL; for (oc = objects; oc; prev = oc, oc = next) { Excerpts from Jost Berthold's message of Tue Sep 03 12:56:03 -0700 2013:
From: Simon Peyton-Jones
To: "Edward Z. Yang" , Simon Marlow Cc: "ghc-devs@haskell.org" Subject: RE: More windows woe Message-ID: <59543203684B2244980D7E4057D5FBC1485BB7AB@DB3EX14MBXC308.europe.corp.microsoft.com> Content-Type: text/plain; charset="utf-8"
Simon Marlow: please help! At the moment windows builds are hosed, which is a Bad Situation.
Actually it turns out that what want is
debugBelch("Checking whether to unload %S\n", oc->fileName));
That is, use "%S" rather than "%s" as format specifier for wide chars.
Sadly, this works on Windows, but not on Linux: rts/CheckUnload.c:260:13: error: format ?%S? expects argument of type ?wchar_t *?, but argument 2 has type ?pathchar *? [-Werror=format]
So what I need guidance on, please!, is what the approved way to deal with this is. I suppose that I could identify each use of %s on a filepath and say
#ifdef mingw32_HOST_OS debugBelch("Checking whether to unload %S\n", oc->fileName)); #else debugBelch("Checking whether to unload %s\n", oc->fileName)); #endif
But that seems deeply unsatisfactory doesn't it?
If not that, then what?
Simon
Similar code is in place to distinguish between 32-bit and 64-bit StgWords:
grep -r -e FMT_Word includes/ includes/stg/Types.h:#define FMT_Word32 "u" includes/stg/Types.h:#define FMT_Word32 "lu" includes/stg/Types.h:#define FMT_Word64 "lu" includes/stg/Types.h:#define FMT_Word64 "llu" includes/stg/Types.h:#define FMT_Word FMT_Word64 includes/stg/Types.h:#define FMT_Word FMT_Word32
and format strings like "blabla " FMT_Word " ..blabla" are used inside rts/. One could do the same for FMT_Path and introduce it where required.
Maybe this would be acceptable?
/ Jost

IF_DEBUG(linker, debugBelch("Checking whether to unload " FMT_PATH "\n",
doesn't that expand to
IF_DEBUG(linker, debugBelch("Checking whether to unload " "%S" "\n",
What does the C compiler make of three strings in a row? Does it automatically concatenate them? Is that ANSI C?
S
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Edward
| Z. Yang
| Sent: 04 September 2013 10:15
| To: Jost Berthold
| Cc: ghc-devs
| Subject: Re: RE: More windows woe
|
| I think this is reasonable, with the added caveat that
| the macros should be placed in includes/rts/Linker.h, because that is
| where pathchar is defined. So how about something like:
|
| diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h
| index e900e85..871b8cd 100644
| --- a/includes/rts/Linker.h
| +++ b/includes/rts/Linker.h
| @@ -16,8 +16,10 @@
|
| #if defined(mingw32_HOST_OS)
| typedef wchar_t pathchar;
| +#define FMT_PATH "%S"
| #else
| typedef char pathchar;
| +#define FMT_PATH "%s"
| #endif
|
| /* initialize the object linker */
| diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
| index a758b06..8dc8fdc 100644
| --- a/rts/CheckUnload.c
| +++ b/rts/CheckUnload.c
| @@ -254,7 +254,7 @@ void checkUnload (StgClosure *static_objects)
|
| // Mark every unloadable object as unreferenced initially
| for (oc = unloaded_objects; oc; oc = oc->next) {
| - IF_DEBUG(linker, debugBelch("Checking whether to unload %s\n",
| + IF_DEBUG(linker, debugBelch("Checking whether to unload "
| FMT_PATH "\n",
| oc->fileName));
| oc->referenced = rtsFalse;
| }
| @@ -290,11 +290,11 @@ void checkUnload (StgClosure *static_objects)
| } else {
| prev->next = oc->next;
| }
| - IF_DEBUG(linker, debugBelch("Unloading object file %s\n",
| + IF_DEBUG(linker, debugBelch("Unloading object file " FMT_PATH
| "\n",
| oc->fileName));
| freeObjectCode(oc);
| } else {
| - IF_DEBUG(linker, debugBelch("Object file still in use: %s\n",
| + IF_DEBUG(linker, debugBelch("Object file still in use: "
| FMT_PATH "\n",
| oc->fileName));
| }
| }
| diff --git a/rts/Linker.c b/rts/Linker.c
| index 6490242..4f0a1c4 100644
| --- a/rts/Linker.c
| +++ b/rts/Linker.c
| @@ -2790,7 +2790,7 @@ unloadObj( pathchar *path )
|
| initLinker();
|
| - IF_DEBUG(linker, debugBelch("unloadObj: %s\n", path));
| + IF_DEBUG(linker, debugBelch("unloadObj: " FMT_PATH "\n", path));
|
| prev = NULL;
| for (oc = objects; oc; prev = oc, oc = next) {
|
| Excerpts from Jost Berthold's message of Tue Sep 03 12:56:03 -0700 2013:
| > > From: Simon Peyton-Jones

Yep, it's string concatenation, and it's ANSI C as per 5.1.1.2. We use this idiom in other parts of the RTS. Cheers, Edward Excerpts from Simon Peyton-Jones's message of Wed Sep 04 02:22:48 -0700 2013:
IF_DEBUG(linker, debugBelch("Checking whether to unload " FMT_PATH "\n",
doesn't that expand to
IF_DEBUG(linker, debugBelch("Checking whether to unload " "%S" "\n",
What does the C compiler make of three strings in a row? Does it automatically concatenate them? Is that ANSI C?
S
| -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Edward | Z. Yang | Sent: 04 September 2013 10:15 | To: Jost Berthold | Cc: ghc-devs | Subject: Re: RE: More windows woe | | I think this is reasonable, with the added caveat that | the macros should be placed in includes/rts/Linker.h, because that is | where pathchar is defined. So how about something like: | | diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h | index e900e85..871b8cd 100644 | --- a/includes/rts/Linker.h | +++ b/includes/rts/Linker.h | @@ -16,8 +16,10 @@ | | #if defined(mingw32_HOST_OS) | typedef wchar_t pathchar; | +#define FMT_PATH "%S" | #else | typedef char pathchar; | +#define FMT_PATH "%s" | #endif | | /* initialize the object linker */ | diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c | index a758b06..8dc8fdc 100644 | --- a/rts/CheckUnload.c | +++ b/rts/CheckUnload.c | @@ -254,7 +254,7 @@ void checkUnload (StgClosure *static_objects) | | // Mark every unloadable object as unreferenced initially | for (oc = unloaded_objects; oc; oc = oc->next) { | - IF_DEBUG(linker, debugBelch("Checking whether to unload %s\n", | + IF_DEBUG(linker, debugBelch("Checking whether to unload " | FMT_PATH "\n", | oc->fileName)); | oc->referenced = rtsFalse; | } | @@ -290,11 +290,11 @@ void checkUnload (StgClosure *static_objects) | } else { | prev->next = oc->next; | } | - IF_DEBUG(linker, debugBelch("Unloading object file %s\n", | + IF_DEBUG(linker, debugBelch("Unloading object file " FMT_PATH | "\n", | oc->fileName)); | freeObjectCode(oc); | } else { | - IF_DEBUG(linker, debugBelch("Object file still in use: %s\n", | + IF_DEBUG(linker, debugBelch("Object file still in use: " | FMT_PATH "\n", | oc->fileName)); | } | } | diff --git a/rts/Linker.c b/rts/Linker.c | index 6490242..4f0a1c4 100644 | --- a/rts/Linker.c | +++ b/rts/Linker.c | @@ -2790,7 +2790,7 @@ unloadObj( pathchar *path ) | | initLinker(); | | - IF_DEBUG(linker, debugBelch("unloadObj: %s\n", path)); | + IF_DEBUG(linker, debugBelch("unloadObj: " FMT_PATH "\n", path)); | | prev = NULL; | for (oc = objects; oc; prev = oc, oc = next) { | | Excerpts from Jost Berthold's message of Tue Sep 03 12:56:03 -0700 2013: | > > From: Simon Peyton-Jones
| > > To: "Edward Z. Yang" , Simon Marlow | > > | > > Cc: "ghc-devs@haskell.org" | > > Subject: RE: More windows woe | > > Message-ID: | > > | <59543203684B2244980D7E4057D5FBC1485BB7AB@DB3EX14MBXC308.europe.corp.mic | rosoft.com> | > > | > > Content-Type: text/plain; charset="utf-8" | > > | > > Simon Marlow: please help! | > > At the moment windows builds are hosed, which is a Bad Situation. | > > | > > Actually it turns out that what want is | > > | > > debugBelch("Checking whether to unload %S\n", oc->fileName)); | > > | > > That is, use "%S" rather than "%s" as format specifier for wide | chars. | > > | > > Sadly, this works on Windows, but not on Linux: | > > rts/CheckUnload.c:260:13: | > > error: format ?%S? expects argument of type ?wchar_t *?, but | argument 2 has type ?pathchar *? [-Werror=format] | > > | > > | > > So what I need guidance on, please!, is what the approved way to | deal with this is. I suppose that I could identify each use of %s on a | filepath and say | > > | > > #ifdef mingw32_HOST_OS | > > debugBelch("Checking whether to unload %S\n", oc->fileName)); | > > #else | > > debugBelch("Checking whether to unload %s\n", oc->fileName)); | > > #endif | > > | > > But that seems deeply unsatisfactory doesn't it? | > > | > > If not that, then what? | > > | > > | > > Simon | > | > Similar code is in place to distinguish between 32-bit and 64-bit | StgWords: | > | > > grep -r -e FMT_Word includes/ | > includes/stg/Types.h:#define FMT_Word32 "u" | > includes/stg/Types.h:#define FMT_Word32 "lu" | > includes/stg/Types.h:#define FMT_Word64 "lu" | > includes/stg/Types.h:#define FMT_Word64 "llu" | > includes/stg/Types.h:#define FMT_Word FMT_Word64 | > includes/stg/Types.h:#define FMT_Word FMT_Word32 | > | > and format strings like "blabla " FMT_Word " ..blabla" are used inside | > rts/. One could do the same for FMT_Path and introduce it where | required. | > | > Maybe this would be acceptable? | > | > / Jost | > | | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | http://www.haskell.org/mailman/listinfo/ghc-devs

Hello cvs-devs, On a relatively recent Linux, man sprintf says "S [conversion specifier] (Not in C99, but in SUSv2.) Synonym for ls. Don't use.", so perhaps "%ls" is better than "%S". Best regards Thorkil ----- Original meddelelse -----
Fra: Edward Z. Yang
Til: Jost Berthold Cc: ghc-devs Dato: Ons, 04. sep 2013 11:15 Emne: Re: RE: More windows woe I think this is reasonable, with the added caveat that the macros should be placed in includes/rts/Linker.h, because that is where pathchar is defined. So how about something like:
diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h index e900e85..871b8cd 100644 --- a/includes/rts/Linker.h +++ b/includes/rts/Linker.h @@ -16,8 +16,10 @@
#if defined(mingw32_HOST_OS) typedef wchar_t pathchar; +#define FMT_PATH "%S" #else typedef char pathchar; +#define FMT_PATH "%s" #endif
/* initialize the object linker */ diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index a758b06..8dc8fdc 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -254,7 +254,7 @@ void checkUnload (StgClosure *static_objects)
// Mark every unloadable object as unreferenced initially for (oc = unloaded_objects; oc; oc = oc->next) { - IF_DEBUG(linker, debugBelch("Checking whether to unload %s\n", + IF_DEBUG(linker, debugBelch("Checking whether to unload " FMT_PATH "\n", oc->fileName)); oc->referenced = rtsFalse; } @@ -290,11 +290,11 @@ void checkUnload (StgClosure *static_objects) } else { prev->next = oc->next; } - IF_DEBUG(linker, debugBelch("Unloading object file %s\n", + IF_DEBUG(linker, debugBelch("Unloading object file " FMT_PATH "\n", oc->fileName)); freeObjectCode(oc); } else { - IF_DEBUG(linker, debugBelch("Object file still in use: %s\n", + IF_DEBUG(linker, debugBelch("Object file still in use: " FMT_PATH "\n", oc->fileName)); } } diff --git a/rts/Linker.c b/rts/Linker.c index 6490242..4f0a1c4 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -2790,7 +2790,7 @@ unloadObj( pathchar *path )
initLinker();
- IF_DEBUG(linker, debugBelch("unloadObj: %s\n", path)); + IF_DEBUG(linker, debugBelch("unloadObj: " FMT_PATH "\n", path));
prev = NULL; for (oc = objects; oc; prev = oc, oc = next) {
Excerpts from Jost Berthold's message of Tue Sep 03 12:56:03 -0700 2013:
From: Simon Peyton-Jones
To: "Edward Z. Yang" , Simon Marlow Cc: "ghc-devs@haskell.org" Subject: RE: More windows woe Message-ID: <59543203684B2244980D7E4057D5FBC1485BB7AB@DB3EX14MBXC308.europe.corp .microsoft.com>
Content-Type: text/plain; charset="utf-8"
Simon Marlow: please help! At the moment windows builds are hosed, which is a Bad
Situation.
Actually it turns out that what want is
debugBelch("Checking whether to unload %S\n",
oc->fileName));
That is, use "%S" rather than "%s" as format specifier for wide
chars.
Sadly, this works on Windows, but not on Linux: rts/CheckUnload.c:260:13: error: format ?%S? expects argument of type ?wchar_t *?,
but argument 2 has type ?pathchar *? [-Werror=format]
So what I need guidance on, please!, is what the approved way to
deal with this is. I suppose that I could identify each use of %s on a filepath and say
#ifdef mingw32_HOST_OS debugBelch("Checking whether to unload %S\n",
oc->fileName));
#else debugBelch("Checking whether to unload %s\n", oc->fileName)); #endif
But that seems deeply unsatisfactory doesn't it?
If not that, then what?
Simon
Similar code is in place to distinguish between 32-bit and 64-bit StgWords:
grep -r -e FMT_Word includes/ includes/stg/Types.h:#define FMT_Word32 "u" includes/stg/Types.h:#define FMT_Word32 "lu" includes/stg/Types.h:#define FMT_Word64 "lu" includes/stg/Types.h:#define FMT_Word64 "llu" includes/stg/Types.h:#define FMT_Word FMT_Word64 includes/stg/Types.h:#define FMT_Word FMT_Word32
and format strings like "blabla " FMT_Word " ..blabla" are used inside rts/. One could do the same for FMT_Path and introduce it where required.
Maybe this would be acceptable?
/ Jost
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

I've gotten GHC to build on Windows, but the test suite is finicky. Here is an error I am getting: =====> T5267(normal) 50 of 3724 [0, 0, 0] cd ./arrows/should_compile && 'c:/Users/ezyang/Dev/ghc-validate/bindisttest/install dir/bin/ghc.exe' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-histor y -c T5267.hs >T5267.comp.stderr 2>&1 Compile failed (status 256) errors were: T5267.hs:11:15: tee: standard output: Permission denied It consistently fails on this test, and when I look at the process list I see: I 1032 1548 1548 4064 con 500 14:54:08 /usr/bin/tee I was seeing something similar when I used parallel make, apparently there is a known deadlock when running make -j2 (or higher). But I don't know why tee would be deadlocking. Edward

I manually removed the tee from the validate script, and sallied on. Here's the next error. =====> cabal01(normal) 81 of 3724 [0, 0, 0] cd ./cabal/cabal01 && $MAKE -s --no-print-directory cabal01 VANILLA=--enable-library-vanilla PR OF=--disable-library-profiling DYN=--enable-shared CLEANUP=1 cabal01.run.stdout 2>cabal01.run.stderr Wrong exit code (expected 0 , actual 2 ) Stdout: Stderr: Creating library file: dist\build\libHStest-1.0-ghc7.7.20130904.dll.a setup.exe: Error: Could not find module: A with any suffix: ["dyn_hi"] in the search path: ["dist\\build"] make[3]: *** [cabal01] Error 1 *** unexpected failure for cabal01(normal) Cheers, Edward Excerpts from Edward Z. Yang's message of Wed Sep 04 14:56:30 -0700 2013:
I've gotten GHC to build on Windows, but the test suite is finicky. Here is an error I am getting:
=====> T5267(normal) 50 of 3724 [0, 0, 0] cd ./arrows/should_compile && 'c:/Users/ezyang/Dev/ghc-validate/bindisttest/install dir/bin/ghc.exe' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-histor y -c T5267.hs >T5267.comp.stderr 2>&1 Compile failed (status 256) errors were:
T5267.hs:11:15: tee: standard output: Permission denied
It consistently fails on this test, and when I look at the process list I see:
I 1032 1548 1548 4064 con 500 14:54:08 /usr/bin/tee
I was seeing something similar when I used parallel make, apparently there is a known deadlock when running make -j2 (or higher). But I don't know why tee would be deadlocking.
Edward
participants (4)
-
Edward Z. Yang
-
Jost Berthold
-
naur@post11.tele.dk
-
Simon Peyton-Jones