Ticket #2342 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

timer problem under Sparc Solaris for Release Candidate ghc-6.8.2.20080603

Reported by: maeder Owned by:
Priority: normal Milestone: 6.10.2
Component: Build System Version: 6.8.2
Keywords: Cc:
Operating System: Solaris Architecture: sparc
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

../../compiler/stage1/ghc-inplace -package-name base-3.0.2.0 -hide-all-packages -split-objs -i -idist/build/autogen -idist/build -i. -Idist/build -Iinclude -#include "HsBase.h" -odir dist/build -hidir dist/build -stubdir dist/build -package rts-1.0 -O -package-name base -XMagicHash -XExistentialQuantification -XRank2Types -XScopedTypeVariables -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes -XDeriveDataTypeable -XGeneralizedNewtypeDeriving -XFlexibleInstances -XPatternSignatures -XStandaloneDeriving -XPatternGuards -XCPP -idist/build  -H16m -O -optc-mcpu=ultrasparc -opta-mcpu=ultrasparc -O -Rghc-timing -fgenerics -c GHC/Base.lhs -o dist/build/GHC/Base.o  -ohi dist/build/GHC/Base.hi
In file included from include/HsBase.h:109,

                 from /tmp/ghc13901_0/ghc13901_0.hc:4:0:

/usr/include/sys/resource.h:146:0:
     error: field 'ru_utime' has incomplete type

/usr/include/sys/resource.h:147:0:
     error: field 'ru_stime' has incomplete type

In file included from /tmp/ghc13901_0/ghc13901_0.hc:4:0:
include/HsBase.h: In function 'sizeofTimeVal':

include/HsBase.h:721:0:
     error: invalid application of 'sizeof' to incomplete type 'struct timeval'
include/HsBase.h: In function 'getUSecOfDay':

include/HsBase.h:725:0:  error: storage size of 'tv' isn't known
include/HsBase.h: In function 'setTimevalTicks':

include/HsBase.h:735:0:
     error: dereferencing pointer to incomplete type

include/HsBase.h:736:0:
     error: dereferencing pointer to incomplete type
<<ghc: 120711684 bytes, 13 GCs, 954368/1814528 avg/max bytes residency (2 samples), 19M in use, 0.00 INIT (0.00 elapsed), 1.76 MUT (2.83 elapsed), 0.20 GC (0.22 elapsed) :ghc>>
gmake[2]: *** [dist/build/GHC/Base.o] Error 1
gmake[2]: Leaving directory `/export/local/home/maeder/ghc-6.8.2.20080603/libraries/base'
gmake[1]: *** [make.library.base] Error 2
gmake[1]: Leaving directory `/export/local/home/maeder/ghc-6.8.2.20080603/libraries'
gmake: *** [stage1] Error 2

Attachments

resource.h Download (6.8 KB) - added by maeder 5 years ago.
time.h Download (12.6 KB) - added by maeder 5 years ago.
ghcautoconf.h Download (10.4 KB) - added by maeder 5 years ago.
HsTimeConfig.h Download (2.7 KB) - added by maeder 5 years ago.
usr-include-time.h Download (10.6 KB) - added by maeder 5 years ago.
The (normal) time.h file not from /usr/include/sys

Change History

Changed 5 years ago by igloo

  • priority changed from normal to high
  • difficulty set to Unknown
  • milestone set to 6.8.3

Hmm, does this patch against libraries/base/include/HsBase.h fix it?

diff -rN -u old-base/include/HsBase.h new-base/include/HsBase.h
--- old-base/include/HsBase.h   2008-06-04 19:49:08.000000000 +0100
+++ new-base/include/HsBase.h   2008-06-04 19:49:08.000000000 +0100
@@ -67,11 +67,10 @@
 #if HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
 #endif
-#if HAVE_GETTIMEOFDAY
-#  if HAVE_SYS_TIME_H
-#   include <sys/time.h>
-#  endif
-#elif HAVE_GETCLOCK
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_GETCLOCK
 # if HAVE_SYS_TIMERS_H
 #  define POSIX_4D9 1
 #  include <sys/timers.h>

Changed 5 years ago by maeder

Same problem, I'll attach the header files time.h and resource.h from /usr/include/sys/

Changed 5 years ago by maeder

Changed 5 years ago by maeder

Changed 5 years ago by igloo

OK, I think that this patch should get _XPG4_2 defined, and thus make struct timeval be defined:

diff -rN -u old-ghc/includes/Stg.h new-ghc/includes/Stg.h
--- old-ghc/includes/Stg.h      2008-06-03 21:59:00.000000000 +0100
+++ new-ghc/includes/Stg.h      2008-06-03 21:59:00.000000000 +0100
@@ -49,7 +49,7 @@
 
 // And finally, we need _XOPEN_SOURCE in order to get a prototype for
 // putenv on Linux:
-#define _XOPEN_SOURCE
+#define _XOPEN_SOURCE 600
 
 #endif

Can you give it a whirl please?

Changed 5 years ago by maeder

This patch caused the following error message

../compiler/ghc-inplace -H16m -O -optc-mcpu=ultrasparc -opta-mcpu=ultrasparc -optc-O2 -package-name rts -static -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint     -c Apply.cmm -o Apply.o
In file included from /usr/include/sys/types.h:18,
                 from /usr/local/include/stdint.h:2,
                 from /export/local/home/maeder/ghc-6.8.2.20080603/includes/HsFFI.h:31,
                 from /export/local/home/maeder/ghc-6.8.2.20080603/includes/RtsAPI.h:16,
                 from /export/local/home/maeder/ghc-6.8.2.20080603/includes/RtsExternal.h:13,
                 from /export/local/home/maeder/ghc-6.8.2.20080603/includes/Stg.h:182,

                 from /tmp/ghc27097_0/ghc27097_0.hc:3:0:

/export/local/mirror/sparc-solaris/lang/bin/../lib/gcc/sparc-sun-solaris2.10/4.2.2/include/sys/feature_tests.h:345:2:
     error: #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications  require the use of c99"
gmake[1]: *** [Apply.o] Error 1
gmake: *** [stage1] Error 1

I'm trying now with "gnu89" (as under i386 Solaris)

Changed 5 years ago by maeder

_XOPEN_SOURCE 600 does not go together with -std=gnu89 and the initial problem is unsolved

Changed 5 years ago by igloo

What happens? "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications require the use of c99"?

If so, does defining _XOPEN_SOURCE to be 500 work?

Changed 5 years ago by maeder

Yes, _XOPEN_SOURCE 600 causes "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications require the use of c99", but 500 (and -std=gnu89) works! (It's not finished yet, but beyond GHC/Base)

Changed 5 years ago by maeder

A similar problem occurs now for libraries/old-time

../../compiler/stage1/ghc-inplace -package-name old-time-1.0.0.0 -hide-all-packages -split-objs -i -idist/build/autogen -idist/build -i. -Idist/build -Iinclude -#include "HsTime.h" -odir dist/build -hidir dist/build -stubdir dist/build -package base-3.0.2.0 -package old-locale-1.0.0.0 -O -XCPP -XForeignFunctionInterface -idist/build  -H16m -O -optc-mcpu=ultrasparc -opta-mcpu=ultrasparc -O -Rghc-timing -fgenerics -c dist/build/System/Time.hs -o dist/build/System/Time.o  -ohi dist/build/System/Time.hi
/tmp/ghc4604_0/ghc4604_0.hc: In function 'oldzmtimezm1zi0zi0zi0_SystemziTime_zdLr69ZZzdwa1_entry':

/tmp/ghc4604_0/ghc4604_0.hc:3200:0:
     error: 'altzone' undeclared (first use in this function)

/tmp/ghc4604_0/ghc4604_0.hc:3200:0:
     error: (Each undeclared identifier is reported only once

/tmp/ghc4604_0/ghc4604_0.hc:3200:0:
     error: for each function it appears in.)
<<ghc: 549314440 bytes, 305 GCs, 8472576/12242944 avg/max bytes residency (8 samples), 34M in use, 0.00 INIT (0.00 elapsed), 7.22 MUT (10.66 elapsed), 3.62 GC (3.75 elapsed) :ghc>>
gmake[2]: *** [dist/build/System/Time.o] Error 1
gmake[2]: Leaving directory `/export/local/home/maeder/ghc-6.8.2.20080603/libraries/old-time'
gmake[1]: *** [make.library.old-time] Error 2
gmake[1]: Leaving directory `/export/local/home/maeder/ghc-6.8.2.20080603/libraries'
gmake: *** [stage1] Error 2

Changed 5 years ago by maeder

Changed 5 years ago by maeder

Changed 5 years ago by maeder

The (normal) time.h file not from /usr/include/sys

Changed 5 years ago by maeder

What an include madness. Adding extern long altzone; manually to libraries/old-time/include/HsTime.h allowed me to continue.

Changed 5 years ago by igloo

  • milestone changed from 6.8.3 to 6.10 branch

I've applied a rather hacky fix to the 6.8 branch, but this'll probably need fixing in the HEAD too.

Changed 5 years ago by simonmar

  • milestone changed from 6.10 branch to 6.10.1

Changed 5 years ago by simonmar

  • priority changed from high to normal

Changed 5 years ago by igloo

  • milestone changed from 6.10.1 to 6.10.2

Changed 5 years ago by maeder

I think the above hack fixed it, so this ticket can be closed.

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

OK, closing it. Thanks!

Note: See TracTickets for help on using tickets.