문제

나는 겪고있다 현실 세계 하스켈, 예를 들어 왔습니다.

-- 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를 사용하고 있습니다.

도움이 되었습니까?

해결책

스노우 레오파드에서 거의 모든 것을 컴파일하는 비슷한 문제가있었습니다. 내가 찾은 해결책은 /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로 업데이트 했습니까? 레오파드를 사용하여 제작 된 스노우 레오파드에서 실행 파일을 사용하려고 할 때 이것이 발생한다고 생각합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top