コンパイル時に「署名された4バイトの再配置を実行できません」
-
10-07-2019 - |
質問
現実世界のHaskell を調べて、例:
-- file: ch04/InteractWith.hs
-- Save this in a source file, e.g. Interact.hs
import System.Environment (getArgs)
interactWith function inputFile outputFile = do
input <- readFile inputFile
writeFile outputFile (function input)
main = mainWith myFunction
where mainWith function = do
args <- getArgs
case args of
[input,output] -> interactWith function input output
_ -> putStrLn "error: exactly two arguments needed"
-- replace "id" with the name of our function below
myFunction = id
しかし、コンパイルしようとすると( ghc --make InteractWith
)このエラーが発生します:
$ ghc --make InteractWith
[1 of 1] Compiling Main ( InteractWith.hs, InteractWith.o )
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:309:0:
suffix or operands invalid for `push'
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:358:0:
suffix or operands invalid for `push'
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:384:0:
32-bit absolute addressing is not supported for x86-64
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:384:0:
cannot do signed 4 byte relocation
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:387:0:
32-bit absolute addressing is not supported for x86-64
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:387:0:
cannot do signed 4 byte relocation
Mac OS 10.6(Snow Leopard)でGHC 6.10.4を使用しています。
解決
私はSnow Leopardでほとんど何でもコンパイルする際に同様の問題を抱えていました。私が見つけた解決策は、 / usr / bin / ghc
(実際には単なるシェルスクリプトです)の内容を次のものに置き換えることでした:
#!/bin/sh
exec /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/ghc -B/Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/. -optc-m32 -opta-m32 -optl-m32 -dynload wrapped ${1+"$@"}
実際には -optc-m32 -opta-m32 -optl-m32
を追加しただけだと思いますが、思い出せません...
(私はもともとこれをインターネット上のどこかで見つけましたが、どこにいるか覚えていません。しばらくかかりました。)
他のヒント
最近Snow Leopardにアップデートしましたか?これは、Leopardを使用して構築されたSnow Leopardで実行可能ファイルを使用しようとしているときに発生すると思います。
所属していません StackOverflow