Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#99 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, c, ruby

Direzione di ricerca

Inizia con il rilevamento di getpwent in extconf.rb e le chiamate a setpwent/getpwent in etc.c. Riproduci il problema con gem install etc --no-document su Android/Termux, quindi verifica che il rilevamento delle funzionalità corrisponda alle dichiarazioni disponibili per l'API Android configurata. Il lavoro è completato quando il gem viene compilato correttamente o disabilita solo la funzionalità interessata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C
Stelle
33
Fork
16
Merge medio
1h 37m
PR unite (30g)
3

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/etc

Tutte le issue di ruby/etc

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.