エラーの症状:
stack install cryptoniteで以下のようなエラーが発生。% stack install cryptonite -- While building custom Setup.hs for package cryptonite-0.24 using: /Users/xxx/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always" Process exited with code: ExitFailure 1 Logs have been written to: /Users/kurokawa/.stack/script/lts-10.4/.stack-work/logs/cryptonite-0.24.log Configuring cryptonite-0.24... Preprocessing library for cryptonite-0.24.. Building library for cryptonite-0.24.. [ 1 of 120] Compiling Crypto.Cipher.DES.Primitive ( Crypto/Cipher/DES/Primitive.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Crypto/Cipher/DES/Primitive.o ) ... snip ... [120 of 120] Compiling Crypto.Tutorial ( Crypto/Tutorial.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Crypto/Tutorial.o ) /private/var/folders/3f/7fg601f92_33t43jhn2p0v0w0000gn/T/stack47334/cryptonite-0.24/cbits/cryptonite_rdrand.c:89:0: error: no such instruction: `rdrand %r8' | 89 | asm volatile ("rdrand %0; setc %1" : "=r" (*buffer), "=qm" (err)); | ^ /private/var/folders/3f/7fg601f92_33t43jhn2p0v0w0000gn/T/stack47334/cryptonite-0.24/cbits/cryptonite_rdrand.c:89:0: error: no such instruction: `rdrand %r8' | 89 | asm volatile ("rdrand %0; setc %1" : "=r" (*buffer), "=qm" (err)); | ^ /private/var/folders/3f/7fg601f92_33t43jhn2p0v0w0000gn/T/stack47334/cryptonite-0.24/cbits/cryptonite_rdrand.c:89:0: error: no such instruction: `rdrand %r8' | 89 | asm volatile ("rdrand %0; setc %1" : "=r" (*buffer), "=qm" (err)); | ^ `gcc' failed in phase `Assembler'. (Exit code: 1)
原因:
ビルド環境のbinutil (or gcc)でrdrandインストラクションがサポートされていないと、このエラーが発生する。解決方法:
cryptoniteのデフォルトはrdrandインストラクションを利用する設定になっているため、-support_rdrandを指定してrdrand利用コードを無効化する。% stack install cryptonite --flag cryptonite:-support_rdrand cryptonite-0.24: configure cryptonite-0.24: build cryptonite-0.24: copy/register--flag cryptonite:-support_rdrandは、crptoniteパッケージのビルド処理において-support_rdrandフラグを適用することを意味する。
cabalをを利用 している環境では、以下の指定で同様の効果が得られるはず(未確認)。
% cabal configure --flag='-support_rdrand' OR % cabal install --constraint="cryptonite -support_rdrand"
using Kindle Points on Amazon
返信削除