Opened 5 years ago

Closed 4 years ago

#3390 closed task (fixed)

Upgrade the Windows build to use gcc 4.4.0

Reported by: simonmar Owned by: simonmar
Priority: normal Milestone: 7.0.1
Component: Build System Version: 6.10.4
Keywords: Cc:
Operating System: Windows Architecture: x86
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Apparently there is breakage when using gcc 4.4.0 to build on Windows (not surprisingly).

We should

  • make the build work
  • update the wiki instructions to point to the new gcc

Change History (7)

comment:1 Changed 5 years ago by simonmar

  • Owner set to igloo

comment:2 Changed 5 years ago by igloo

  • Milestone changed from 6.12.1 to 6.14.1
  • Owner igloo deleted
  • Priority changed from high to normal
  • Summary changed from Make the Windows build work with mingw gcc 4.4.0 to Upgrade the Windows build to use gcc 4.4.0

We now put the mingw tarballs we use in the source tree, so we always use the same version no matter what is installed.

We should upgrade to gcc 4.4.0 at some point, though.

comment:3 Changed 4 years ago by simonmar

  • Owner set to simonmar
  • Status changed from new to assigned
  • Type of failure set to None/Unknown

I'm looking at this, because gcc 4.4 has support for thread-local variables on Windows and we need that in the RTS. Currently whenever we call myTask() it involves a call into Win32 which trashes the value of GetLastError(), and since we can call myTask() from pure code (e.g. in a GMP operation) this can cause error messages to go missing with -threaded.

comment:4 Changed 4 years ago by simonmar

  • Owner changed from simonmar to igloo

Ian is looking at this.

comment:5 Changed 4 years ago by igloo

  • Owner igloo deleted

gcc is updated, but with:

hunk ./rts/Task.h 236
-#if defined(linux_HOST_OS) && \
-    (defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH))
+#if defined(mingw32_HOST_OS) || \
+    (defined(linux_HOST_OS) && \
+     (defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)))
 #define MYTASK_USE_TLV
 extern __thread Task *my_task;

I get:

$ cat q.hs

main = putStrLn "Foo"

$ inplace/bin/ghc-stage1 --make q -threaded
[1 of 1] Compiling Main             ( q.hs, q.o )
Linking q.exe ...
$ ./q
Segmentation fault/access violation in generated code

and when linked with -debug too:

(gdb) r +RTS -DS
Starting program: /cygdrive/c/msys/1.0/home/ian/ghc/q +RTS -DS
[New thread 2956.0xabc]

Program received signal SIGSEGV, Segmentation fault.
0x7c91b21a in ntdll!RtlpWaitForCriticalSection ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) bt
#0  0x7c91b21a in ntdll!RtlpWaitForCriticalSection ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
#1  0x7c901046 in ntdll!RtlEnumerateGenericTableLikeADirectory ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
#2  0x00649b1c in tasksInitialized ()
#3  0x005d5057 in newTask (worker=rtsFalse) at rts\Task.c:81
#4  0x005d4e9f in allocTask () at rts\Task.c:81
#5  0x005d51d0 in newBoundTask () at rts\Task.c:81
#6  0x005d62e2 in rts_lock () at rts\RtsAPI.c:478
#7  0x005c54d0 in hs_add_root (init_root=0x401538 <__stginit_ZCMain>)
    at rts\RtsStartup.c:130
#8  0x005c54c3 in startupHaskell (argc=1, argv=0x3f2520, 
    init_root=0x401538 <__stginit_ZCMain>) at rts\RtsStartup.c:130
#9  0x005ba709 in real_main () at rts\RtsMain.c:50
#10 0x005ba8d2 in hs_main (argc=3, argv=0x3f2520, 
    main_init=0x401538 <__stginit_ZCMain>, main_closure=0x5f7034)
    at rts\RtsMain.c:113
#11 0x00401570 in main ()

This isn't a regression, so I don't expect to dig deeper before the next major release.

comment:6 Changed 4 years ago by simonmar

  • Owner set to simonmar

Strange, I'll try to look into it. There is a bug that would be fixed by this (I think it was one of the directory tests, but I don't remember which).

comment:7 Changed 4 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

Fixed:

Wed Sep 15 13:06:27 BST 2010  Simon Marlow <marlowsd@gmail.com>
  * Windows: use a thread-local variable for myTask()
  Which entailed fixing an incorrect #ifdef in Task.c
Note: See TracTickets for help on using tickets.