& # 8220; impossibile eseguire il trasferimento di 4 byte con segno & # 8221; in fase di compilazione

StackOverflow https://stackoverflow.com/questions/1822397

Domanda

Sto esaminando Haskell nel mondo reale e sono arrivato al esempio:

-- 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

Ma quando provo a compilarlo ( ghc --make InteractWith ) ottengo questo errore:

$ 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

Sto usando GHC 6.10.4 su Mac OS 10.6 (Snow Leopard).

È stato utile?

Soluzione

Avevo problemi simili durante la compilazione di quasi tutto in Snow Leopard. La soluzione che ho trovato è stata quella di sostituire il contenuto di / usr / bin / ghc (che in realtà è solo uno script di shell) con il seguente:

#!/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+"$@"}

Penso che in realtà stia solo aggiungendo -optc-m32 -opta-m32 -optl-m32 ma non ricordo ...

(Inizialmente l'ho trovato da qualche parte su Internet, ma non ricordo dove. Mi ci è voluto anche un po 'di tempo.)

Altri suggerimenti

Hai aggiornato a Snow Leopard di recente? Credo che ciò accada quando si tenta di utilizzare un eseguibile in Snow Leopard che è stato creato utilizzando Leopard.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top