stackのclockのビルドで大ハマリした話
ghc-modを入れようとしたらclockのビルドに失敗してハマったのでメモ。
ビルドエラー
ghc-modのところでclockのビルドに失敗した的なメッセージが出たので単体でビルドした結果がこちら。
[naoki@X58A-UD3R ~/WorkDir/haskell] $ stack install clock clock-0.7.2: configure clock-0.7.2: build -- While building package clock-0.7.2 using: /home/naoki/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_m PHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/ Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 Logs have been written to: /home/naoki/.stack/global-project/.stack-work/logs /clock-0.7.2.log Configuring clock-0.7.2... Building clock-0.7.2... Preprocessing library clock-0.7.2... /tmp/stack18925/clock-0.7.2/Clock.hsc:44:0: 警告: "hsc_alignment" が再定義さ れました /tmp/stack18925/clock-0.7.2/In file included from .stack-work/dist/x86_64-lin ux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make.c:1:0: /home/naoki/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2 /template-hsc.h:88:0: 備考: ここが以前の宣言がある位置です #define hsc_alignment(t...) \ /usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/ System/Clock_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object。 -fPIC を付けて再コンパイルしてください。 /usr/bin/ld: 最終リンクに失敗しました: 出力に対応するセクションがありません collect2: エラー: ld はステータス 1 で終了しました linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/Syste m/Clock_hsc_make.o failed (exit code 1) command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1. 24.2.0/build/System/Clock_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/C abal-1.24.2.0/build/System/Clock_hsc_utils.o -o .stack-work/dist/x86_64-linux-tin fo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make -fno-PIE -fno-stack-protecto r -L/home/naoki/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2 /base-4.9.1.0 -Wl,-R,/home/naoki/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8. 0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/naoki/.stack/programs/x86_64-linux/ghc-tin fo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/naoki/.stack/progr ams/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp - L/home/naoki/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/gh c-prim-0.5.0.0 -Wl,-R,/home/naoki/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8 .0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/naoki/.stack/programs/x86_64-linux/gh c-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/naoki/.stack/programs/x86_64- linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread
全然意味がわからん。
結局
ncursesのレガシパッケージが必要とのこと。(ncurses5-compatible)
別のところで「ncurses-full入れれば一発やで」と書いてあったので自分はそっちを使った。
またもやエラー
ところが、今度はncurses-fullがうまく入らない。
1[naoki@X58A-UD3R ~/WorkDir/haskell] $ yaourt -S ncurses5-compat-libs ==> AUR から ncurses5-compat-libs の PKGBUILD をダウンロード... x .SRCINFO x .gitignore x PKGBUILD izznogooood commented on 2017-09-05 19:28 gpg --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB bhimberg commented on 2017-09-06 11:35 This may help some, please comment/correct if I missed something. For whatever reason, my .gnupg directory was not quite right. I would get an erro r: $ gpg --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB gpg: keyserver receive failed: Cannot assign requested address I moved my $HOME/.gnupg directory to .gnupg.bak and ran the following: dirmngr --debug-level guru This recreated the .gnupg directory and fixed whatever was causing 'Cannot assign requested address'. I think it may be related to useradd or something along thos e lines: root was able to import keys fine, just not this particular user. Maybe I missed a step in the installation guide? elicacio commented on 2017-10-02 17:55 Hello guys, I was able to install the package following the tip of this link https://forum.ma njaro.org/t/error-trying-to-install-ncurses/19354/2 run the following command: gpg --keyserver keys.gnupg.net --recv-keys 702353E0F7E48EDB after: yaourt -S ncurses5-compat-libs zor1984qq commented on 2017-10-23 10:20 Thx it works now. abdo commented on 2017-10-28 18:33 This packages does not build. The linker fails with a missing symbol. I do not fu lly understand what happened, but looking at the PKGBUILD in core I managed to fi x it by adding --with-termlib=tinfo --with-ticlib=tic on the ./configure command line, and removing the symlink to libtinfo.so.5 (because it already exists) from package(). ncurses5-compat-libs 6.0+20170902-1 (2017-09-04 06:22) ( サポートがないパッケージ: 潜在的に危険です ! ) ==> PKGBUILD を編集しますか ? [Y/n] ("A" で中止) ==> ---------------------------------- ==> n ==> ncurses5-compat-libs の依存パッケージ: - glibc (既にインストールされています) - gcc-libs (既にインストールされています) - sh (既にインストールされています) ==> ncurses5-compat-libs のビルドを続行しますか ? [Y/n] ==> ---------------------------------------- ==> ==> パッケージのビルドとインストール ==> パッケージを作成: ncurses5-compat-libs 6.0+20170902-1 (2017年 12月 4日 月曜 日 21:23:17 JST) ==> ランタイムの依存関係を確認... ==> ビルドタイムの依存関係を確認... ==> ソースを取得... -> ダウンロード ncurses-6.0-20170902.tgz... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3244k 100 3244k 0 0 216k 0 0:00:15 0:00:15 --:--:-- 125k -> ダウンロード ncurses-6.0-20170902.tgz.asc... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 267 100 267 0 0 267 0 0:00:01 --:--:-- 0:00:01 575 ==> source で md5sums ファイルを検証... ncurses-6.0-20170902.tgz ... 成功 ncurses-6.0-20170902.tgz.asc ... スキップ ==> gpg でソースファイルの署名を検証... ncurses-6.0-20170902.tgz ... 失敗 (不明な公開鍵 702353E0F7E48EDB) ==> エラー: PGP 鍵を検証できませんでした! ==> エラー: Makepkg は ncurses5-compat-libs をビルドできませんでした。 ==> ncurses5-compat-libs のビルドを再開しますか ? [y/N] ==> ---------------------------------------- ==> N
「PGP鍵が検証できない」とさ。これはお決まりのパターン。鍵をインポートすればいい。
[naoki@X58A-UD3R ~] $ gpg --keyserver http://pgp.mit.edu --recv-keys 702353E0F7E48EDB gpg: 有効なOpenPGPデータが見つかりません。 gpg: 処理数の合計: 0
???
鍵が見つからないということらしい。
最終的に
結論から言うと、鍵サーバーが違った。
[naoki@X58A-UD3R ~] $ gpg --keyserver keys.gnupg.net --recv-keys 702353E0F7E48EDB gpg: key 702353E0F7E48EDB: 鍵がないため142個の署名は検査しません gpg: /home/naoki/.gnupg/trustdb.gpg: 信用データベースができました gpg: 鍵702353E0F7E48EDB: 公開鍵"Thomas Dickey <dickey@invisible-island.net>"をインポートしました gpg: 究極的に信用する鍵が見つかりません gpg: 処理数の合計: 1 gpg: インポート: 1
アホらしいこと極まりない。
あとはトントン拍子でうまく行った。
$ yaourt -S ncurses-full $ stack install clock
おわり。