[PATCH] do not use CLK_TCK on Solaris host
This patch fixes Solaris cross-compilation issue as CLK_TCK is not constant on Solaris and hsc2hs chokes on it when cross-compiling from i386-solaris to x86_64-solaris. --- System/CPUTime.hsc | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/System/CPUTime.hsc b/System/CPUTime.hsc index 8934a7e..270fd13 100644 --- a/System/CPUTime.hsc +++ b/System/CPUTime.hsc @@ -39,7 +39,7 @@ import CPUTime ( getCPUTime, cpuTimePrecision ) #ifdef __GLASGOW_HASKELL__ import Foreign.Safe import Foreign.C -#if !defined(CLK_TCK) +#if !defined(CLK_TCK) || solaris2_HOST_OS import System.IO.Unsafe (unsafePerformIO) #endif @@ -187,7 +187,10 @@ cpuTimePrecision = round ((1000000000000::Integer) % fromIntegral (clockTicks)) #ifdef __GLASGOW_HASKELL__ clockTicks :: Int clockTicks = -#if defined(CLK_TCK) +-- CLK_TCK is no longer a constant on Solaris so avoid to use it +-- this way. In fact it's defined in a way like syscall below in +-- Solaris' <time.h> +#if defined(CLK_TCK) && ! solaris2_HOST_OS (#const CLK_TCK) #else unsafePerformIO (sysconf (#const _SC_CLK_TCK) >>= return . fromIntegral) -- 1.7.3.2
Somebody claiming to be Karel Gardas wrote:
This patch fixes Solaris cross-compilation issue as CLK_TCK is not constant on Solaris and hsc2hs chokes on it when cross-compiling from i386-solaris to x86_64-solaris.
There is an existing Trac for that: <http://hackage.haskell.org/trac/ghc/ticket/7519> This affects more than just Solaris. -- Stephen Paul Weber, @singpolyma See <http://singpolyma.net> for how I prefer to be contacted edition right joseph
Hi, I've just verified that your patch is working well on cross-compiling ghc on solaris (i386 -> amd64). Also as your patch is much cleaner and support also other OSes, I'd like to ask GHC developers to scratch my patch provided in this thread and consider merging your version provided in http://hackage.haskell.org/trac/ghc/ticket/7519 Thanks! Karel On 01/18/13 11:57 PM, Stephen Paul Weber wrote:
Somebody claiming to be Karel Gardas wrote:
This patch fixes Solaris cross-compilation issue as CLK_TCK is not constant on Solaris and hsc2hs chokes on it when cross-compiling from i386-solaris to x86_64-solaris.
There is an existing Trac for that: <http://hackage.haskell.org/trac/ghc/ticket/7519>
This affects more than just Solaris.
participants (2)
-
Karel Gardas -
Stephen Paul Weber