From: "albertus (Dominik Alberski) via ruby-core" Date: 2026-10-01T18:20:46+00:00 Subject: [ruby-core:126905] [Ruby Bug#22401] addr2line.c does not build when crt_externs.h is absent (iOS SDK) Issue #22401 has been reported by albertus (Dominik Alberski). ---------------------------------------- Bug #22401: addr2line.c does not build when crt_externs.h is absent (iOS SDK) https://bugs.ruby-lang.org/issues/22401 * Author: albertus (Dominik Alberski) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Ruby version: master (4.0.7) addr2line.c includes unconditionally. The build fails on Darwin targets where that header is absent. The public iOS SDK does not ship crt_externs.h. ## Steps to reproduce Configure Ruby for a Darwin target without crt_externs.h, then run make. One example is a cross-compile for armv7-apple-ios6.0 against the iOS 6.1 SDK: ``` SDK=/path/to/iPhoneOS6.1.sdk CC="clang -target armv7-apple-ios6.0 -isysroot $SDK" \ CPP="clang -target armv7-apple-ios6.0 -isysroot $SDK -E" \ ../ruby/configure --host=armv7-apple-darwin10 --build=aarch64-apple-darwin25 make ``` ## Actual result ``` addr2line.c:84:11: fatal error: 'crt_externs.h' file not found 1 error generated. ``` ## Expected result addr2line.c compiles. ## Cause Three other files already handle this case: hash.c, eval_intern.h and missing/setproctitle.c. They check HAVE_CRT_EXTERNS_H. When the header is absent, they include missing/crt_externs.h instead. configure.ac sets that macro for darwin targets. addr2line.c was missed. addr2line.c also calls _NSGetMachExecuteHeader(). Only the macOS crt_externs.h declares that function, so a fallback header alone is not sufficient. The fix must also declare the function locally, with the same __LP64__ distinction that crt_externs.h uses. The symbol itself exists in libSystem/dyld on iOS too. ## Proposed fix Branch: https://github.com/DominikAlberski/ruby/tree/fix/addr2line-crt-externs-fallback macOS behavior does not change. On macOS HAVE_CRT_EXTERNS_H is defined, so the includes and the declarations stay the same. I verified this by preprocessing both versions with HAVE_CRT_EXTERNS_H defined. The output is identical, apart from the __LINE__ numbers that the added lines shift. A test is not possible for this change. The code path is a compile-time header fallback, and macOS builds do not take it. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/