Android/Termux: etc fails to compile because `getpwent` declarations are unavailable
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Bắt đầu với việc phát hiện getpwent trong extconf.rb và các lệnh gọi setpwent/getpwent trong etc.c. Tái hiện lỗi bằng gem install etc --no-document trên Android/Termux, sau đó xác minh rằng việc phát hiện tính năng khớp với các khai báo có sẵn cho Android API đã được cấu hình. Hoàn thành nghĩa là gem biên dịch thành công hoặc chỉ vô hiệu hóa chức năng bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- C
- Star
- 33
- Fork
- 16
- Merge trung bình
- 1 giờ 37 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/etc
-
JRuby support Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA/k8s-device-plugin#2061 · 1 bình luận ·
-
task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vsanthanam/JBird#429 ·