Re: libobjc2 2.2.1 segfaulting on aarch64 on Debian 13
Andreas Fink via Discussion list for the GNUstep programming environment <[email protected]> Wed, 26 Nov 2025 08:25:13 +0100
| Newsgroups | gmane.comp.lib.gnustep.general |
|---|---|
| Message-ID | <[email protected]> |
to answer my own point. The issue was caused by a older runtime build of
gnustep-base which was still lingering around.
When linking with -lgnustep-base the problem occured. Without
-lgnustep-base,it didnt.
Maybe it would be smart to ignore the library or put up a more
descriptive error than just segfaulting.
On 25.11.2025 04:53, Andreas Fink via Discussion list for the GNUstep
programming environment wrote:
>
> Hello
>
> I am porting my code to Debian13 after running sucessfully running for
> years under Debian 11 and 12.
>
> So I compiled the whole gnustep stack with not much hassle. When I try
> to compile my own code however, it fails already at ./configure
>
> And it seems to be that ./configure runs a simple test to see if its
> cross compiling or not where it fails.
>
> It boils down to this command line
>
> clang -o conftest -fPIC -DLINUX -D_XOPEN_SOURCE=700 -D_POSIX_SOURCE
> -D_DEFAULT_SOURCE -fobjc-arc -MMD -MP -DGNUSTEP
> -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNUSTEP_RUNTIME=1
> -D_NONFRAGILE_ABI=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing
> -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread
> -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -I //include -fblocks
> -fobjc-runtime=gnustep-2.2 -fblocks
> -fconstant-string-class=NSConstantString -I.
> -I/Users/afink/GNUstep/Library/Headers -I/usr/local/include
> -I/usr/include -DHAVE_OPENSSL=1 -pthread -fexceptions -rdynamic
> -fobjc-runtime=gnustep-2.2 -fblocks
> -L/Users/afink/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib
> -lgnustep-base -lpthread -l:libobjc.so.4.6 -lm -lssl -lcrypto
> conftest.c -ldl -ldl
>
> a simple program in conftest.c:
>
> int main() { return 0; }
>
> compiling works but running produces a SIGSEGV.
>
> LLDB points to this line in the code
>
> (lldb) run
> Process 99524 launched: '/Users/afink/development/git/ulib/conftest'
> (aarch64)
> Process 99524 stopped
> * thread #1, name = 'conftest', stop reason = signal SIGSEGV: address
> not mapped to object (fault address: 0x0)
> frame #0: 0x0000fffff7859088
> libobjc.so.4.6`upgradePropertyList(l=0x0000fffff6e80402) at
> legacy.c:328:11
> 325 }
> 326 size_t data_size = l->count * sizeof(struct objc_property);
> 327 struct objc_property_list *n = calloc(1, sizeof(struct
> objc_property_list) + data_size);
> -> 328 n->count = l->count;
> 329 n->size = sizeof(struct objc_property);
> 330 for (int i=0 ; i<l->count ; i++)
> 331 {
>
>
> sizeof(struct objc_property_list) = 16
>
> sizeof(struct objc_property) = 40;
>
> (lldb) print *l
> (objc_property_list_gsv1) {
> count = 712114218
> next = 0x304036314900383a
> properties = {}
> }
>
> so calloc fails with 712114218 * 40 * 16 bytes = 455GB...
>
> something is clearly not initialized
>
> Backtrace is this:
>
> frame #0: 0x0000fffff7859088
> libobjc.so.4.6`upgradePropertyList(l=0x0000fffff6e80402) at
> legacy.c:328:11
> frame #1: 0x0000fffff7858ecc
> libobjc.so.4.6`objc_upgrade_class(oldClass=<unavailable>) at
> legacy.c:357:20
> * frame #2: 0x0000fffff78528cc
> libobjc.so.4.6`__objc_exec_class(module=<unavailable>) at loader.c:352:19
> frame #3: 0x0000fffff7fc1b4c
> ld-linux-aarch64.so.1`___lldb_unnamed_symbol61 + 236
> frame #4: 0x0000fffff7fc1c60
> ld-linux-aarch64.so.1`___lldb_unnamed_symbol62 + 120
> frame #5: 0x0000fffff7fd8360
> ld-linux-aarch64.so.1`___lldb_unnamed_symbol236 + 96
>
> 349 // Load the classes from this module
> 350 for (unsigned short i=0 ; i<symbols->class_count ; i++)
> 351 {
> -> 352 objc_load_class(objc_upgrade_class(symbols->definitions[defs++]));
> 353 }
>
>
> These is what ccmake reports
>
> BUILD_STATIC_LIBOBJC ON
> CMAKE_BUILD_TYPE RelWithDebInfo
> CMAKE_INSTALL_PREFIX /usr
> CPACK_GENERATOR TGZ
> CPACK_STRIP_FILES ON
> DEBUG_ARC_COMPAT OFF
> EMBEDDED_BLOCKS_RUNTIME ON
> ENABLE_OBJCXX ON
> ENABLE_TRACING OFF
> FETCHCONTENT_BASE_DIR
> /Users/afink/development/gnustep_build/libobjc2/build/_deps
> FETCHCONTENT_FULLY_DISCONNECTE OFF
> FETCHCONTENT_QUIET ON
> FETCHCONTENT_UPDATES_DISCONNEC OFF
> GNUSTEP_CONFIG /usr/bin/gnustep-config
> GNUSTEP_INSTALL_TYPE SYSTEM
> INCLUDE_DIRECTORY objc
> LEGACY_COMPAT OFF
> LIBOBJC_NAME objc
> M_LIBRARY /usr/lib/aarch64-linux-gnu/libm.so
> OLDABI_COMPAT ON
> STRICT_APPLE_COMPATIBILITY OFF
> TESTS OFF
> TYPE_DEPENDENT_DISPATCH ON
> tsl-robin-map_DIR /usr/share/cmake/tsl-robin-map
>
> I tried with OLDABI_COMPAT OFF and then it breaks at
>
> * thread #1, name = 'conftest', stop reason = signal SIGSEGV: address
> not mapped to object (fault address: 0x0)
> frame #0: 0x0000fffff785e774 libobjc.so.4.6`selector_lookup(char
> const*, char const*) [inlined]
> tsl::rh::power_of_two_growth_policy<2ul>::bucket_for_hash(this=0x0000000000000000,
> hash=18399730721004063734) const at robin_growth_policy.h:125:19
> 122 * If bucket_count() is 0, it must always return 0.
> 123 */
> 124 std::size_t bucket_for_hash(std::size_t hash) const
> noexcept {
> -> 125 return hash & m_mask;
> 126 }
> 127
> 128 /**
>
>
> libobjc was built with the following command line
>
> export CC="/usr/bin/clang"
> export CXX="/usr/bin/clang++"
> export PREFIX="/"
> export
> PATH="/usr/GNUstep/System/Tools:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
> export
> PKG_CONFIG_PATH="/usr/lib/pkgconfig/:/usr/local/lib/pkgconfig/"
> export RUNTIME_VERSION="gnustep-2.0"
> export OBJCFLAGS="-fblocks"
> export CFLAGS="-I ${PREFIX}/include"
> export GNUSTEP_INSTALLATION_DOMAIN="SYSTEM"
>
> cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
> -DBUILD_STATIC_LIBOBJC=1 -DCMAKE_C_COMPILER=${CC}
> -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_INSTALL_PREFIX=/usr
>
> I tried with clang17,18,19 with same results
>
> anyone have an idea whats going rouge here?
>
>
>