虚無庵

徒然なるままに

今日の ruby build 2023-06-28

毎日 ruby をビルドしよう

hamadarb.connpass.com

最近 Ruby Parser とかに興味が出てきたが、何をどこから手を付ければいいのか分からなかったので Hamada.rb に参加して S.H. さんに相談させてもらった。

色々お話した

  • 何をしたいのかゴールを定めよう
  • 完璧を目指さず、ざっと流して 5 割程度の理解で進めよう
    • 分からなくなったらまた戻る
  • やれる事からやろう

ruby をビルドしてみた

S.H. さんの勧めで「ruby を毎日ビルドしてみると、たまに警告が出るのでそれを修正してみるのもいいかも」と言われた。

最近 Lrama をよく触っていたので ruby のビルドはそこそこやっていた。

が、警告なんざに遭遇したことがないので「またまたぁ〜w」と言いながらビルドしたらまさかの警告が出た。

compiling ../ruby/parser_st.c
In file included from ../ruby/parser_st.c:151:
../ruby/st.c:1722:1: warning: ‘unsigned-integer-overflow’ attribute directive ignored [-Wattributes]
 1722 | NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_step(st_index_t h, st_index_t k));
      | ^~~~~~~~~~~
../ruby/st.c:1723:1: warning: ‘unsigned-integer-overflow’ attribute directive ignored [-Wattributes]
 1723 | NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_finish(st_index_t h));
      | ^~~~~~~~~~~
../ruby/st.c:1724:1: warning: ‘unsigned-integer-overflow’ attribute directive ignored [-Wattributes]
 1724 | NO_SANITIZE("unsigned-integer-overflow", extern st_index_t st_hash(const void *ptr, size_t len, st_index_t h));
      | ^~~~~~~~~~~
../ruby/st.c:1929:1: warning: ‘unsigned-integer-overflow’ attribute directive ignored [-Wattributes]
 1929 | NO_SANITIZE("unsigned-integer-overflow", extern st_index_t st_hash_uint(st_index_t h, st_index_t i));
      | ^~~~~~~~~~~
../ruby/st.c:2030:1: warning: ‘unsigned-integer-overflow’ attribute directive ignored [-Wattributes]
 2030 | NO_SANITIZE("unsigned-integer-overflow", PUREFUNC(static st_index_t strcasehash(st_data_t)));
      | ^~~~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
S.H. さんの調査方法を見せてもらった

S.H. さんの画面を共有してもらって、警告が出る原因と解決案の導き方を見せてもらった。

このブログに書けるほど理解できなかった。ので、記録として残せない。

PR を作った

ひとまず S.H. さんに調査していただいた結果をもとに PR を作った。

するとなかださんからコメントがあり、代替案を提案された。

なかださんのパッチを適用してみたが、警告が抑制されず、またふり出しに戻る。

NO_SANITIZE の定義がよろしくないということで、rubyソースコード内で他に NO_SANITIZE を定義しているところがないか調べてみたらあった

なんで見様見真似で再度コメントを返してみた。

そんなわけで

昨日から ruby のビルドを毎日してみることにした。そこから何か分かるかもしれない。