"لا يمكن أن لا قعت 4 بايت نقل" على الترجمة
-
10-07-2019 - |
سؤال
وانا ذاهب من خلال العالم الحقيقي هاسكل ، وصلت إلى على سبيل المثال:
-- 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
وأنا باستخدام GHC 6.10.4 على نظام التشغيل Mac OS 10.6 (سنو ليوبارد).
المحلول
وكنت أعاني من مشاكل مماثلة جمع أي شيء تقريبا في سنو ليوبارد. وكان الحل وجدت لاستبدال محتويات /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
ولكن لا أستطيع أن أتذكر ...
و(لقد وجدت أصلا هذا في مكان ما على الشبكة الدولية، ولكن لا أتذكر أين. ولم تأخذ مني بعض الوقت أيضا.)
نصائح أخرى
هل قمت بتحديث لسنو ليوبارد في الآونة الأخيرة؟ وأعتقد أن هذا يحدث عندما كنت في محاولة لاستخدام قابل للتنفيذ في سنو ليوبارد الذي تم بناؤه باستخدام ليوبارد.
لا تنتمي إلى StackOverflow