Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmlhコマンドを実行するとBus Errorが発生する #69

Open
kurokawh opened this issue Nov 9, 2018 · 7 comments
Open

mmlhコマンドを実行するとBus Errorが発生する #69

kurokawh opened this issue Nov 9, 2018 · 7 comments

Comments

@kurokawh
Copy link

kurokawh commented Nov 9, 2018

古いmac(El Capitan 10.11.6)環境、かつ、ports環境なので他の方は大丈夫なのかもしれませんが…。

自分の環境でmmlhコマンドを実行するとBus error、mmlh show 1を実行するとSegmentation faultになります。
以下、実行結果のコピペです。

[mac:/Users/kurokawa/git/makeMistakesToLearnHaskell]% stack --version
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0
[mac:/git/makeMistakesToLearnHaskell]% stack exec -- ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3
[mac:/git/makeMistakesToLearnHaskell]% mmlh
# Make Mistakes to Learn Haskell!

## Contents
Bus error
[mac:/git/makeMistakesToLearnHaskell]% mmlh show 1
Segmentation fault
[mac:/makeMistakesToLearnHaskell]% git log -n 1
commit f42e7a838139dbcbd91eb316cef5424f4794219c
Merge: 517d77f f3b90d9
Author: Yuji Yamamoto <[email protected]>
Date:   Fri Nov 9 23:22:37 2018 +0900

    Merge pull request #65 from haskell-jp/options-test
    
    Fix regression by #62

@kurokawh
Copy link
Author

kurokawh commented Nov 9, 2018

ghci上ではBus errorは発生しないようです。

[mac:/Users/kurokawa/git/makeMistakesToLearnHaskell]% stack repl
Using main module: 1. Package `makeMistakesToLearnHaskell' component exe:mmlh with main-is file: /Users/kurokawa/git/makeMistakesToLearnHaskell/app/Main.hs

* * * * * * * *
Warning: There are cabal settings for this project which may prevent GHCi from loading your code properly.
In some cases it can also load some projects which would otherwise fail to build.

-XCPP will be used, but it can cause issues with multiline strings.
See https://downloads.haskell.org/~ghc/7.10.2/docs/html/users_guide/options-phases.html#cpp-string-gaps
It is specified for:
    makeMistakesToLearnHaskell:lib
But not for: 
    makeMistakesToLearnHaskell:exe:mmlh

-XOverloadedStrings will be used, but it can cause type ambiguity in code not usually compiled with it.
It is specified for:
    makeMistakesToLearnHaskell:lib
But not for: 
    makeMistakesToLearnHaskell:exe:mmlh

To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.

It isn't yet possible to load multiple packages into GHCi in all cases - see
https://ghc.haskell.org/trac/ghc/ticket/10827
* * * * * * * *

The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: makeMistakesToLearnHaskell
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
[ 1 of 21] Compiling Paths_makeMistakesToLearnHaskell ( /Users/kurokawa/git/makeMistakesToLearnHaskell/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/autogen/Paths_makeMistakesToLearnHaskell.hs, interpreted )
[ 2 of 21] Compiling Education.MakeMistakesToLearnHaskell.Text ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Text.hs, interpreted )
[ 3 of 21] Compiling Education.MakeMistakesToLearnHaskell.Evaluator.Types ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Evaluator/Types.hs, interpreted )
[ 4 of 21] Compiling Education.MakeMistakesToLearnHaskell.Evaluator.Regex ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Evaluator/Regex.hs, interpreted )
[ 5 of 21] Compiling Education.MakeMistakesToLearnHaskell.Env ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Env.hs, interpreted )
[ 6 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Types ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Types.hs, interpreted )
[ 7 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.FormatMessage ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/FormatMessage.hs, interpreted )
[ 8 of 21] Compiling Education.MakeMistakesToLearnHaskell.Evaluator.RunHaskell ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Evaluator/RunHaskell.hs, interpreted )
[ 9 of 21] Compiling Education.MakeMistakesToLearnHaskell.Error ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Error.hs, interpreted )
[10 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Record ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Record.hs, interpreted )
[11 of 21] Compiling Education.MakeMistakesToLearnHaskell.Diagnosis ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Diagnosis.hs, interpreted )
[12 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Core ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Core.hs, interpreted )
[13 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex05 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex05.hs, interpreted )
[14 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex04 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex04.hs, interpreted )
[15 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex03 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex03.hs, interpreted )
[16 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex02_5 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex02_5.hs, interpreted )
[17 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex02 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex02.hs, interpreted )
[18 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise.Ex01 ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise/Ex01.hs, interpreted )
[19 of 21] Compiling Education.MakeMistakesToLearnHaskell.Exercise ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell/Exercise.hs, interpreted )
[20 of 21] Compiling Education.MakeMistakesToLearnHaskell ( /Users/kurokawa/git/makeMistakesToLearnHaskell/src/Education/MakeMistakesToLearnHaskell.hs, interpreted )
[21 of 21] Compiling Main             ( /Users/kurokawa/git/makeMistakesToLearnHaskell/app/Main.hs, interpreted )
Ok, 21 modules loaded.
Loaded GHCi configuration from /private/var/folders/3f/7fg601f92_33t43jhn2p0v0w0000gn/T/haskell-stack-ghci/20e5ac93/ghci-script
*Main Education.MakeMistakesToLearnHaskell Education.MakeMistakesToLearnHaskell.Diagnosis Education.MakeMistakesToLearnHaskell.Env Education.MakeMistakesToLearnHaskell.Error Education.MakeMistakesToLearnHaskell.Evaluator.Regex Education.MakeMistakesToLearnHaskell.Evaluator.RunHaskell Education.MakeMistakesToLearnHaskell.Evaluator.Types Education.MakeMistakesToLearnHaskell.Exercise Education.MakeMistakesToLearnHaskell.Exercise.Core Education.MakeMistakesToLearnHaskell.Exercise.Ex01 Education.MakeMistakesToLearnHaskell.Exercise.Ex02 Education.MakeMistakesToLearnHaskell.Exercise.Ex02_5 Education.MakeMistakesToLearnHaskell.Exercise.Ex03 Education.MakeMistakesToLearnHaskell.Exercise.Ex04 Education.MakeMistakesToLearnHaskell.Exercise.Ex05 Education.MakeMistakesToLearnHaskell.Exercise.FormatMessage Education.MakeMistakesToLearnHaskell.Exercise.Record Education.MakeMistakesToLearnHaskell.Exercise.Types Education.MakeMistakesToLearnHaskell.Text> Main.main
# Make Mistakes to Learn Haskell!

## Contents
- 1: Hello, world!
- 2: 数値の計算・表示
- 2.5: 計算アプリケーションを作る(概要)
- 3: 複数の命令を並べる
- 4: 入力の取得
- 5: 型注釈をつける・入力を数値に変換する

Run `mmlh show <the exercise number>` to try the exercise.
*Main Education.MakeMistakesToLearnHaskell Education.MakeMistakesToLearnHaskell.Diagnosis Education.MakeMistakesToLearnHaskell.Env Education.MakeMistakesToLearnHaskell.Error Education.MakeMistakesToLearnHaskell.Evaluator.Regex Education.MakeMistakesToLearnHaskell.Evaluator.RunHaskell Education.MakeMistakesToLearnHaskell.Evaluator.Types Education.MakeMistakesToLearnHaskell.Exercise Education.MakeMistakesToLearnHaskell.Exercise.Core Education.MakeMistakesToLearnHaskell.Exercise.Ex01 Education.MakeMistakesToLearnHaskell.Exercise.Ex02 Education.MakeMistakesToLearnHaskell.Exercise.Ex02_5 Education.MakeMistakesToLearnHaskell.Exercise.Ex03 Education.MakeMistakesToLearnHaskell.Exercise.Ex04 Education.MakeMistakesToLearnHaskell.Exercise.Ex05 Education.MakeMistakesToLearnHaskell.Exercise.FormatMessage Education.MakeMistakesToLearnHaskell.Exercise.Record Education.MakeMistakesToLearnHaskell.Exercise.Types Education.MakeMistakesToLearnHaskell.Text> 

@waddlaw
Copy link
Contributor

waddlaw commented Nov 9, 2018

@kurokawh 報告ありがとうございます。

以下のコマンドの出力結果は、それぞれどうなりますか?

$ stack exec -- mmlh show 1

$ ghc --version

@igrep
Copy link
Member

igrep commented Nov 9, 2018

mmlh show --terminal 1
の場合どうなるかも気になります

@kurokawh
Copy link
Author

試してみました。
@waddlaw

[mac:/Users/kurokawa/git/makeMistakesToLearnHaskell]% stack exec -- mmlh show 1
Segmentation fault
[mac:/Users/kurokawa/git/makeMistakesToLearnHaskell]% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.2

@igrep

[mac:/Users/kurokawa/git/makeMistakesToLearnHaskell]% mmlh show --terminal 1
Segmentation fault

@waddlaw
Copy link
Contributor

waddlaw commented Nov 10, 2018

@kurokawh ありがとうございます!

たぶんですが、mmlh がバックエンドで呼び出す GHC のバージョン問題なんじゃないかと思います。

#34 で提案されているように、GHCのバージョンを取得してバリデーションした方が良いかもしれないですね。

@igrep
Copy link
Member

igrep commented Nov 10, 2018

いや、mmlh showはバックエンドでrunhaskell呼ばないので、それ以前の問題じゃないかな。。。
ビルドする時点で最新版のGHCであってほしいので。。。

@waddlaw
Copy link
Contributor

waddlaw commented Nov 10, 2018

なるほど。以下のバージョンとエラーメッセージの感じで GHC 7.10.2 が問題として関係してそうかなと思いましたが、確かに mmlh show で壊れているとなると何でだろう・・・。

% stack exec -- ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3

% stack repl
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help

% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants