Native extension compilation fails on newer GCC versions: missing #include <stdbool.h>
Environment
- OS: Arch Linux (but likely affects other distros with newer compilers)
- GCC version: 15.2.1
- Ruby version: 3.4.4
- eth gem version: latest
Issue
The gem fails to install with compilation errors related to unknown type bool. The mkmf.log shows: error: unknown type name 'bool' and suggests: "it is probably fixable by adding #include <stdbool.h>"
Root Cause
The native C extensions don't explicitly include <stdbool.h> but use the bool type. Newer GCC versions (10+) are stricter about explicit header includes and don't auto-include standard headers that weren't explicitly requested.
Workaround
The gem can be installed successfully with:
gem install eth -- --with-cppflags="-include stdbool.h"
Proposed Solution
Add #include <stdbool.h> to the relevant C extension source files that use the bool type. This would ensure compatibility across different compiler versions and follow C99 best practices.
Impact
This affects users on systems with modern compilers (GCC 10+, recent Clang versions) and prevents standard gem installation without workarounds.
Comments
I used AI to diagnosis/write this issue, i would love to write a pull request but im afraid im not very efficient in C... I hope this helps other people and the maintainers. Thank you for making and sharing this great gem <3
Thanks for reporting. The eth gem is 100% Ruby, so unless you share logs, I won't be able to tell where this message is coming from but most likely keccak.rb or RbSecp256k1.
Can you share the full log?
Im sorry it was an issue on my end, i had to install the necessary build-essentials to compile 👍