clckwrksの続き

今回ようやく上の画像までたどり着けます。

iconvのfile was built for unsupported file format which is not the architecture being linked (i386)のwarningは"+universal"を付けてやればいいぽいので、

sudo port install gd2 +universal                                             
sudo port install file +universal

で気を取り直して

clckwrks/clckwrks-plugin-media $ cabal install
...
Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/clckwrks-plugin-media-0.2.2/lib
Registering clckwrks-plugin-media-0.2.2...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html

次はclckwrks-plugin-bugsディレクトリでcabal install

~/Documents/.../clckwrks/clckwrks-plugin-bugs $ cabal install                  
Resolving dependencies...
Linking ./dist/setup/setup ...
Undefined symbols:
  "_iconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_close)
  "_iconv", referenced from:
      _hs_iconv in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding5_info, _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding3_info , _hs_iconv_close )
  "_iconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_open)
ld: symbol(s) not found
collect2: ld returned 1 exit status
cabal: Error: some packages failed to install:
clckwrks-plugin-bugs-0.2.4 failed during the configure step. The exception
was:
ExitFailure 1

iconv_openがないようです。GHC 6.12.2 on Mac OS X from GHC-6.12.2-i386.pkg fails with "Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.1.a(iconv.o)を見るに/usr/libと/opt/local/libにlibiconv.dylibというファイルがあって、後者には_iconv_openというシンボルがないので、LIBRARY_PATHを/usr/libにしてやります。

suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks-plugin-bugs
~/Documents/.../clckwrks/clckwrks-plugin-bugs $ export LIBRARY_PATH=/usr/lib 
suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks/clckwrks-plugin-bugs
~/Documents/.../clckwrks/clckwrks-plugin-bugs $ cabal install               
Resolving dependencies...
Linking ./dist/setup/setup ...
Configuring clckwrks-plugin-bugs-0.2.4...
Building clckwrks-plugin-bugs-0.2.4...
Preprocessing library clckwrks-plugin-bugs-0.2.4...
[ 1 of 14] Compiling Paths_clckwrks_plugin_bugs ( dist/build/autogen/Paths_clckwrks_plugin_bugs.hs, dist/build/Paths_clckwrks_plugin_bugs.o )
[ 2 of 14] Compiling Clckwrks.Bugs.Types ( Clckwrks/Bugs/Types.hs, dist/build/Clckwrks/Bugs/Types.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package magic-1.0.8 ... <command line>: can't load .so/.DLL for: libmagic.dylib (dlopen(libmagic.dylib, 9): image not found)
cabal: Error: some packages failed to install:
clckwrks-plugin-bugs-0.2.4 failed during the building phase. The exception
was:
ExitFailure 1

でもこれだと/opt/local/libにいれたlibmagic.dylibをさがせないので

export LIBRARY_PATH=/usr/lib:/opt/local/lib

してやります。

Documentation created: dist/doc/html/clckwrks-plugin-bugs/index.html
Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/clckwrks-plugin-bugs-0.2.4/lib
Registering clckwrks-plugin-bugs-0.2.4...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html

clckworks-plugin-bugsをインストールできました。

次はclckwrks-theme-clckwrksです

~/Documents/.../clckwrks/clckwrks-theme-clckwrks $ cabal install                              
Resolving dependencies...
In order, the following will be installed:
clckwrks-theme-clckwrks-0.1.18 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
[1 of 1] Compiling Main             ( Setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Undefined symbols:
  "_iconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_close)
  "_locale_charset", referenced from:
      _localeEncoding in libHSbase-4.5.0.0.a(PrelIOUtils.o)
  "_iconv", referenced from:
      _hs_iconv in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding5_info, _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding3_info , _hs_iconv_close )
  "_iconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.5.0.0.a(iconv.o)
     (maybe you meant: _hs_iconv_open)
ld: symbol(s) not found
collect2: ld returned 1 exit status
cabal: Error: some packages failed to install:
clckwrks-theme-clckwrks-0.1.18 failed during the configure step. The exception
was:
ExitFailure 1

export LIBRARY_PATH=/usr/libしてやると動きました。

~/Documents/.../clckwrks/clckwrks-theme-clckwrks $ cabal install               
Resolving dependencies...
In order, the following will be installed:
clckwrks-theme-clckwrks-0.1.18
Linking ./dist/setup/setup ...
Configuring clckwrks-theme-clckwrks-0.1.18...
Building clckwrks-theme-clckwrks-0.1.18...
Preprocessing library clckwrks-theme-clckwrks-0.1.18...
[1 of 5] Compiling Paths_clckwrks_theme_clckwrks ( dist/build/autogen/Paths_clckwrks_theme_clckwrks.hs, dist/build/Paths_clckwrks_theme_clckwrks.o )
[2 of 5] Compiling Theme.Template   ( Theme/Template.hs, dist/build/Theme/Template.o )
[3 of 5] Compiling Theme.Home       ( Theme/Home.hs, dist/build/Theme/Home.o )
[4 of 5] Compiling Theme.Page       ( Theme/Page.hs, dist/build/Theme/Page.o )
[5 of 5] Compiling Theme.Blog       ( Theme/Blog.hs, dist/build/Theme/Blog.o )
[1 of 5] Compiling Paths_clckwrks_theme_clckwrks ( dist/build/autogen/Paths_clckwrks_theme_clckwrks.hs, dist/build/Paths_clckwrks_theme_clckwrks.p_o )
[2 of 5] Compiling Theme.Template   ( Theme/Template.hs, dist/build/Theme/Template.p_o )
[3 of 5] Compiling Theme.Home       ( Theme/Home.hs, dist/build/Theme/Home.p_o )
[4 of 5] Compiling Theme.Page       ( Theme/Page.hs, dist/build/Theme/Page.p_o )
[5 of 5] Compiling Theme.Blog       ( Theme/Blog.hs, dist/build/Theme/Blog.p_o )
Registering clckwrks-theme-clckwrks-0.1.18...
Running Haddock for clckwrks-theme-clckwrks-0.1.18...
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: rts-1.0
Preprocessing library clckwrks-theme-clckwrks-0.1.18...
Haddock coverage:
   0% (  0 /  4) in 'Paths_clckwrks_theme_clckwrks'
   0% (  0 /  3) in 'Theme.Template'
   0% (  0 /  3) in 'Theme.Home'
   0% (  0 /  2) in 'Theme.Page'
   0% (  0 /  4) in 'Theme.Blog'
Documentation created: dist/doc/html/clckwrks-theme-clckwrks/index.html
Installing library in
/Users/suztomo/Library/Haskell/ghc-7.4.1/lib/clckwrks-theme-clckwrks-0.1.18/lib
Registering clckwrks-theme-clckwrks-0.1.18...
Updating documentation index /Users/suztomo/Library/Haskell/doc/index.html


このあとやっぱりiconvのエラーがでたので

extra-lib-dirs: /usr/lib /opt/local/lib

という行をgd-3000.7.3とmagic-1.0.8のcabalファイルに追加したあとcabal installを行い、clckwrksのサブディレクトリでももう一度cabal clean; cabal install --force-reinstallsをしたらちゃんと入りました。

clckwrks-dot-com-serverコマンド

このコマンドを実行するとサーバが動くらしい。

 $ clckwrks-dot-com-server --http-port 8000 --jstree-path=./jstree --json2-path=./json2 --jquery-path=./jquery       
Static Server Started.
clckwrks-dot-com-server: user error (Pattern match failure in do expression at Clckwrks/Page/Types.hs:152:8-18)

Page/Types.hsを見てみるとnextUUIDの取得に失敗している様子。

150 initialFeedConfig :: IO FeedConfig
151 initialFeedConfig =
152     do (Just uuid) <- nextUUID
153        return $ FeedConfig { feedUUID       = uuid
154                            , feedTitle      = fromString "Untitled Feed"
155                            , feedLink       = fromString ""
156                            , feedAuthorName = fromString "Anonymous"
157                            }

ためしにghciでやってみると

Prelude Data.UUID.V1> nextUUID
Nothing

やっぱりnextUUIDがnothingを返しています。 どうやらmaccatcherのSystem.Info.MAC.Fetchがifconfigのパースに失敗しているようです。書き換えてやりましょう。

fetchNICs                   ::  IO [(String, MAC)]
fetchNICs                    =  parser <$> i_config

とあるところを

fetchNICs                   ::  IO [(String, MAC)]
fetchNICs                    =  return [("en0", read "00:1f:5b:d7:01:e5") ] -- parser <$> i_config

としましょう。やっつけになってきましたね。cabal installで自分のMacにだけこの設定を反映してmaccatcherをインストールし、clckwrks-dot-comディレクトリもcabal install --force-reinstallsしてやりましょう。

~/Documents/.../clckwrks/clckwrks $ ls
Makefile                _darcs                  clckwrks-dot-com        clckwrks-plugin-media   jquery
README.html             clckwrks                clckwrks-plugin-bugs    clckwrks-theme-basic    json2
README.md               clckwrks-cli            clckwrks-plugin-ircbot  clckwrks-theme-clckwrks jstree
suztomo@SuzBookPro.local ~/Documents/LanguageStudy/Haskell/clckwrks/clckwrks
~/Documents/.../clckwrks/clckwrks $ clckwrks-dot-com-server --http-port 8000 --jstree-path=./jstree --json2-path=./json2 --jquery-path=./jquery
Static Server Started.
Listening on port 8000

動きました!


下にスクロールすると。。

"Invalid PageId 8" と表示されていますが、これはまだこのページが存在しないということです。http://www.clckwrks.com/C/ViewPage/3のページに従ってアカウントを作って、下のコマンドでアカウントを管理者に昇格させてあげましょう。

clckwrks-cli _state/profileData_socket
Just (ProfileData {dataFor = UserId {unUserId = 1}, username = "suztomo", email = Nothing, roles = fromList [Administrator,Visitor], attributes = fromList []})

"clckwrks-cli setAdmin 1"とかじゃないんですね。


そのあとは管理画面からページを8個つくってやれば、上に表示されているInvalid PageIdは消えます。