Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Android/Termux: etc fails to compile because `getpwent` declarations are unavailable

オープン
#99 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, c, ruby

調査の方向性

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):

  1. Compile successfully when these functions are available for the target android api; or
  2. 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/etc のほかの issue

ruby/etc の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。