Android/Termux: etc fails to compile because `getpwent` declarations are unavailable
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
extconf.rb の getpwent 検出と、etc.c の setpwent/getpwent 呼び出しから始めます。Android/Termux で gem install etc --no-document を実行して失敗を再現し、その後、機能検出が設定された Android API で利用可能な宣言と一致していることを確認します。gem のコンパイルに成功するか、影響を受ける機能だけが無効になることを完了条件とします。
索引モデルが issue の本文から書いたものです。
説明
My environment
- OS: Android/Termux
- arch: aarch64
- ruby: 4.0.6
- ruby gems version: 4.0.16
- gem version: etc 1.4.6
- compiler used: clang 21.1.8
- android api: 36
Description
Installing the etc gem is fails while compiling the native extension:
gem install etc
The configuration step reports that getpwent() is available in the output:
checking for getpwent()... yes
However, compilation fails because Android's headers looks like not expose declarations for getpwent() and setpwent():
etc.c:294:5: error: call to undeclared function 'setpwent'
etc.c:295:18: error: call to undeclared function 'getpwent'
error: incompatible integer to pointer conversion
Same problem occurs with older versions of the gem, including 1.4.1 through 1.4.5.
The expected behavior
The extension should either (I think):
- Compile successfully when these functions are available for the target android api; or
- Correctly detect that they are unavailable and disable only the affected functionality.
Current detection appears to report getpwent() as available even though the generated extension cannot compile against the android headers.
Reproduction process
I try to install ruby using Android Termux
gem install etc --no-document
Relevant output:
checking for getpwent()... yes
...
error: call to undeclared function 'setpwent'
error: call to undeclared function 'getpwent'
The declarations in Termux's pwd.h are guarded by Android API availability macros, for example:
struct passwd *getpwent(void) __INTRODUCED_IN(26);
void setpwent(void) __INTRODUCED_IN(26);
The etc extension includes pwd.h when HAVE_GETPWENT is defined, but the declarations are not visible for the API configuration used while compiling Ruby.
This causes a mismatch between the feature detection performed by extconf.rb and the code generated by the extension.
Thanks
- 主要言語
- C
- スター
- 33
- フォーク
- 16
- 平均マージ
- 1時間 37分
- マージ済み PR(30日)
- 3
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby/etc のほかの issue
-
JRuby support オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
似ている issue
-
internal.h中,漏掉了1个定义。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
kovidgoyal/kitty#10516 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zephyrproject-rtos/zephyr#120011 ·