Generated init function names might start with a digit, causing CC to recognize them as numbers
Trying to compile Lem/SDL2, I encounter an error with a generated identifier being recognized as a number:
make LISP=ecl sdl2
...
; Loading "lem-sdl2"
............An error occurred during initialization:
Error code 1 when executing
(EXT:RUN-PROGRAM "gcc" ("-I." "-I/usr/include/" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-march=x86-64" "-mtune=generic" "-O2" "-pipe"
"-fno-plt" "-fexceptions" "-Wp,-D_FORTIFY_SOURCE=3" "-Wformat" "-Werror=format-security"
"-fstack-clash-protection" "-fcf-protection" "-fno-omit-frame-pointer" "-mno-omit-leaf-frame-pointer" "-g"
"-ffile-prefix-map=/build/ecl/src=/usr/src/debug/ecl" "-flto=auto" "-fcommon" "-ffat-lto-objects" "-fPIC"
"-D_THREAD_SAFE" "-Dlinux" "-O2" "-c" "/tmp/ecliniteVCg0z.c" "-o" "/tmp/ecliniteVCg0z.o")):
/tmp/ecliniteVCg0z.c:10:30: error: invalid suffix ‘lNspc5IY59HH_h1Q2hg71’ on integer constant
10 | extern ECL_CPP_TAG void 0lNspc5IY59HH_h1Q2hg71(cl_object);
| ^~~~~~~~~~~~~~~~~~~~~~
/tmp/ecliniteVCg0z.c:10:30: error: expected identifier or ‘(’ before numeric constant
/tmp/ecliniteVCg0z.c: In function ‘init_fas_CODE’:
/tmp/ecliniteVCg0z.c:49:34: error: invalid suffix ‘lNspc5IY59HH_h1Q2hg71’ on integer constant
49 | ecl_init_module(current, 0lNspc5IY59HH_h1Q2hg71);
| ^~~~~~~~~~~~~~~~~~~~~~.
make: *** [Makefile:11: sdl2] Error 1
The path I traced is:
-
+lisp-program-init+in src/cmp/cmpbackend-cxx/cmpbackend-cxx.lsp -
builderin src/cmp/cmpbackend-cxx/cmpbackend-cxx.lsp -
guess-init-namein src/cmp/cmpname.lsp -
compute-init-namein src/cmp/cmpname.lsp -
init-function-namein src/cmp/cmpname.lsp- When called without PREFIX argument, it injects the S argument verbatim:
(init-function-name "0" :prefix "")
;; => "0"
Which might be the source of this problem. But I have no idea how empty prefix even ends up there and can't come up with a fix myself. I'm not even sure it's this exact path that's wrong. So feel free to ignore.
ECL version 24.5.10, as packaged by Arch Linux.
VERSION "24.5.10"
VCS-ID "UNKNOWN"
OS "Linux"
OS-VERSION "6.14.6-arch1-1"
MACHINE-TYPE "x86_64"
FEATURES (:PACKAGE-LOCKS :QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P
:ASDF-UNICODE :WALKER :CDR-6 :GRAY-STREAMS-MODULE :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN
:ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :COMPLEX-FLOAT :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS
:CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS :BOEHM-GC :ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS
:IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14 :PREFIXED-API :FFI :X86_64 :COMMON :ECL)