Pages

Wednesday, 28 December 2016

stack install wai-app-static遇错的解决办法

我运行stack install wai-app-static,会遇到如下的错误。

root@AR:/usr/local# stack install wai-app-static
wai-app-static-3.1.6.1: configure
wai-app-static-3.1.6.1: build

--  While building package wai-app-static-3.1.6.1 using:
      /root/.stack/setup-exe-cache/i386-linux/Cabal-simple_mPHDZzA
J_1.24.0.0_ghc-8.0.1 --builddir=.stack-work/dist/i386-linux/Cabal-1.24.0.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /usr/local/yblog/.stack-work/logs/wai-app-static-3.1.6.1.log

    Configuring wai-app-static-3.1.6.1...
    Building wai-app-static-3.1.6.1...
    Preprocessing library wai-app-static-3.1.6.1...
    [1 of 9] Compiling WaiAppStatic.Types ( WaiAppStatic/Types.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Types.o )
    [2 of 9] Compiling Util             ( Util.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/Util.o )
    [3 of 9] Compiling WaiAppStatic.Listing ( WaiAppStatic/Listing.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Listing.o )
   
    /tmp/stack21583/wai-app-static-3.1.6.1/WaiAppStatic/Listing.hs:67:34: warning: [-Wname-shadowing]
        This binding for ‘pieces’ shadows the existing binding
          bound at WaiAppStatic/Listing.hs:27:16
   
    /tmp/stack21583/wai-app-static-3.1.6.1/WaiAppStatic/Listing.hs:120:24: warning: [-Wunused-local-binds]
        Defined but not used: ‘isFile’
    [4 of 9] Compiling WaiAppStatic.Storage.Filesystem ( WaiAppStatic/Storage/Filesystem.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Storage/Filesystem.o )
    [5 of 9] Compiling WaiAppStatic.Storage.Embedded.Runtime ( WaiAppStatic/Storage/Embedded/Runtime.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Storage/Embedded/Runtime.o )
    [6 of 9] Compiling WaiAppStatic.Storage.Embedded.TH ( WaiAppStatic/Storage/Embedded/TH.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Storage/Embedded/TH.o )
   
    /tmp/stack21583/wai-app-static-3.1.6.1/WaiAppStatic/Storage/Embedded/TH.hs:10:1: warning: [-Wunused-imports]
        The import of ‘Control.Applicative’ is redundant
          except perhaps to import instances from ‘Control.Applicative’
        To import instances alone, use: import Control.Applicative()
    [7 of 9] Compiling WaiAppStatic.Storage.Embedded ( WaiAppStatic/Storage/Embedded.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/WaiAppStatic/Storage/Embedded.o )
    [8 of 9] Compiling Network.Wai.Application.Static ( Network/Wai/Application/Static.hs, .stack-work/dist/i386-linux/Cabal-1.24.0.0/build/Network/Wai/Application/Static.o )
    <command line>: can't load .so/.DLL for: /root/.stack/snapshots/i386-linux/lts-7.1/8.0.1/lib/i386-linux-ghc-8.0.1/random-1.1-54KmMHXjttlERYcr1mvsAe/libHSrandom-1.1-54KmMHXjttlERYcr1mvsAe-ghc8.0.1.so (/root/.stack/snapshots/i386-linux/lts-7.1/8.0.1/lib/i386-linux-ghc-8.0.1/random-1.1-54KmMHXjttlERYcr1mvsAe/libHSrandom-1.1-54KmMHXjttlERYcr1mvsAe-ghc8.0.1.so: undefined symbol: timezm1zi6zi0zi1_DataziTimeziClockziCTimespec_getCTimespec1_closure)
root@AR:/usr/local#
 
解决办法:
 很简单:
rm -rf /root/.stack/snapshots/i386-linux/*
( rm -rf /root/.stack/snapshots/x86_64-linux/*)
再次运行stack install wai-app-static就不会遇错了。