Subject: GNUstep build on Linux fails due to lacking -fobjc-exception flag

From: Daphne Preston-Kendal <[email-masked]>
Date: Wed, 14 Aug 2024 14:17:40 +0200

Emacs 29.4 build from source tarball

Configure command:
./configure --with-ns

configure runs fine, make eventually fails with:
gcc -c  -Demacs  -I. -I. -I../lib -I../lib         -I/usr/include/libxml2                 -MMD -MF deps/nsfont.d -MP     -I/usr/include/p11-kit-1        -g3 -O2 -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -g -ffile-prefix-map=/builddir/gnustep-make-2.9.2=. -fconstant-string-class=NSConstantString -I. -I/home/dpk/GNUstep/Library/Headers -I/usr/include -std=c99  nsfont.m
nsfont.m: In function 'ns_uni_to_glyphs_1':
nsfont.m:1613:9: error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
 1613 |         {
      |         ^

(this is the output from make V=1)

This can be fixed by running ./configure as:

CC="gcc -fobjc-exceptions" ./configure --with-ns
which produces a lot of spurious warnings:
cc1: warning: command-line option '-fobjc-exceptions' is valid for ObjC/ObjC++ but not for C
but with no ill effect – the build successfully completes this way.

Neither OBJC nor OBJCFLAGS has any effect despite this being an
Objective-C file. It seems to compile .m files with CC and CCFLAGS
rather than OBJC and OBJCFLAGS. This might be the root of the issue.

gcc --version:
gcc (GCC) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

uname -a:
Linux voidvm 6.6.43_1 #1 SMP PREEMPT_DYNAMIC Sun Jul 28 03:10:47 UTC 2024 x86_64 GNU/Linux

Running on Void Linux on musl with the following GNUstep packages installed:
gnustep-back-0.31.0_1
gnustep-base-1.30.0_1
gnustep-base-devel-1.30.0_1
gnustep-gui-0.31.1_1
gnustep-gui-devel-0.31.1_1
gnustep-make-2.9.2_1