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

stack overflow on WSL #323

Closed
kmyk opened this issue Feb 29, 2020 · 8 comments · Fixed by #324
Closed

stack overflow on WSL #323

kmyk opened this issue Feb 29, 2020 · 8 comments · Fixed by #324

Comments

@kmyk
Copy link
Contributor

kmyk commented Feb 29, 2020

WSL では ulimit -s unlimited できないので、いくつかの問題の入出力が生成できません。

'['/home/maru/library-checker-problems/datastructure/vertex_add_path_sum/sol/correct']' died with <Signals.SIGSEGV: 11>.

— ゾンビ (@.___n___z) February 28, 2020

ulimit -s unlimited について
-bash: ulimit: stack size: cannot modify limit: Invalid argument
というエラーが出るので飛ばしたのですがこれが原因?

— ゾンビ (@.___n___z) February 28, 2020

私も困っててでも「これは環境側が悪いしな……」で放置してたけど、他にも困ってる人がいるので issue にしておきます。

選択肢:

  1. 諦める
    1. WSL 側が解決するのを待つ ulimit and stack size microsoft/WSL#633
  2. 諦めない
    1. Library Checker 側の correct.cpp を再帰から std::stack などを使うものに書き換える
    2. Library Checker 側の correct.cpp で stack pivot する (inline asm で rsp を書き換えるやつ) (実装例: https://kmyk.github.io/competitive-programming-library/library/hack/stack_pivot.hpp.html)
@yosupo06
Copy link
Owner

2 iii. stack pivotしてから'./correct'にforkすることで、correct.cppの変更なしで動くかも?(ほんまか)

@kmyk
Copy link
Contributor Author

kmyk commented Feb 29, 2020

stack pivot してから fork するやつ、ほんまかって感じだけど気になるので試します

@yosupo06
Copy link
Owner

2 iv. 手元がWSLか判別してWSLならコンパイルコマンドに-fsplit-stackを足す

@yosupo06
Copy link
Owner

Windowsでも一応動かせるようにはしときたい = WSLぐらいは対処しときたい = コントリビュートするためにubuntu / os xを用意させるのはこのプロジェクトの理念から外れる気がする ので、2 諦めない の方向性で考えてます

@kmyk
Copy link
Contributor Author

kmyk commented Feb 29, 2020

-fsplit-stack したら vertex_add_path_sum が動きました

@yosupo06
Copy link
Owner

良かった〜 動いたなら多分一番コスパがいい解決策なんで、これで行きます(clangで動かない気がするとかgccもちゃんとサポートしてるのかとか色々怪しいが)

@kmyk
Copy link
Contributor Author

kmyk commented Feb 29, 2020

WSL (正確なバージョン不明) 上の Ubuntu 18.04 の g++clang++ の両方では動きました。Ubuntu 16.04 とかだと分からないけどたぶん Python が古くて generate.py 自体が動かないので忘れてよさそう

@kmyk
Copy link
Contributor Author

kmyk commented Feb 29, 2020

stack pivot してから普通に execve してもだめだった

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

Successfully merging a pull request may close this issue.

2 participants