Re: macOS building issues after dc9eba0760dedcd3d042a408e715b38ac2222aa3

"Chun Tian (binghe)" <[email protected]> Tue, 13 Feb 2024 10:35:15 +1100
Newsgroups gmane.lisp.gcl.devel
Organization The Australian National University
Message-ID <[email protected]>
Greetings,

Please find in attach three log files. My GCC (clang) information is the
following (Note that it's impossible to get more info like 'gcc -v' with
a real GCC compiler):

binghe@binghe-mac7:~/Lisp/gcl/gcl$ gcc -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.3.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

The "configure.log" is generated by the following commands in GCL
working directory (with the unmodified 'master', commit id: 22c93c4c)

export C_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib

./configure --prefix=/usr/local \
      --disable-notify \
      --disable-statsysbfd \
      --disable-ansi \
      --enable-custreloc \
      --enable-emacsdir=/opt/local/share/emacs/site-lisp/gcl \
      --enable-infodir=/opt/local/share/info \
      --enable-readline \
      --disable-gprof \
      --without-x \
      --disable-xgcl \
      --disable-tcltk \
      --enable-dynsysgmp \
      --enable-debug > configure.log

Then I found there's another "config.log" with more information (about
my building environment), so I attached it too. (The file is 4MB big, so
I compressed it by bzip2).

Then I call make and redirected all std and error outputs to "make.log":

binghe@binghe-mac7:~/Lisp/gcl/gcl$ make >& make.log

The building process stopped at the previous mentioned linking issue
"symbol not found in flat namespace '_Cnil_body'".

Unfortunately, I can't see any special compiler warnings about the
fixnum/ufixnum issue.  More importantly, the previous observed crash
disappeared, even without your proposed code changes! (I think this
means the crashing is sensitive to particular memory layout, or due to
memory leaking, thus not always reproducible.)

Hope this helps...

P.S. I think I can provide you a remote access to a macOS Sonoma virtual
machine that you can connect to its desktop by VNC. (We can talk more
about this in private communications.)

Chun

On 13/02/24 00:43, Camm Maguire wrote:
> Greetings!
> 
> "Chun Tian (binghe)" <[email protected]> writes:
> 
>> Greetings, and thanks always for your kind help.
>>
>> With your fixes of replacing (ufixnum) to (fixnum) in the two vs_push
>> lines in gbc.c, now with the default optimizations (i.e. no more -O0)
>> the building process doesn't crash any more! I hope this patch, if it's
>> indeed reasonable, can be made official and also on GCL 2.6.14 branch. 
>> And let me know if you still want to see the compilation warnings of
>> gbc.c, either before or after this changes.
>>
> 
> Yes to both, i.e. I will commit this patch, and please give me the
> compiler output on the original files.  In fact, I would like to see the
> entire configure and make output on the existing commit to the point of
> crash posted if you do not mind.
> 
> 
>> Now I directly reached the issue mentioned in the other email, i.e. when
>> executing "saved_pre_gcl", the following unrecoverable error happens:
>>
>> symbol not found in flat namespace '_Cnil_body'
>>
>> There are a lot of compilation warnings talking about function
>> declaration without prototypes:
>>> In file included from read.d:28:
>>> In file included from ../h/include.h:127:
>>> ../h/../h/att_ext.h:68:8: warning: a function declaration without a
>> prototype is deprecated in all versions of C and is treated as a
>> zero-parameter prototype in C2x, conflicting with a previous declaration
>> [-Wdeprecated-non-prototype]
>>> double big_to_double();
>>>         ^
>>> ../h/../h/compprotos.h:6:8: note: conflicting prototype is here
>>> double big_to_double(object);
>>>         ^
>>
> 
> Much but perhaps not all of this can be cleaned up.  The compiler output
> requested above should help here.
> 
> 
>> I can guess the following reasons:
>>
>> 1. When you call "gcc" (actually clang) on C code with "*.d" extension
>> names, clang wrongly recognized the input code as C++, and then has
>> followed C++ standards to treat symbol names.
> 
> This is not the case, as .d is pre-processed into .c before passing to
> the C compiler.
> 
> 
>> 2. Under C++ environment assumptions, the prototype declarations without
>> arguments have been wrongly treated as different (C++) functions.
>>
> 
> This may be the case.  What I suspect is that linking a -no-pie raw
> executable might imply some different standard than that implied by
> compiling a conventional shared library.
> 
> What is the current gcc status for you?
> 
> Take care,
>
configure.log (text/plain, 8.9 KB)
checking for gawk... gawk
checking build system type... x86_64-apple-darwin23.3.0
checking host system type... x86_64-apple-darwin23.3.0
host=x86_64-apple-darwin23.3.0
use=386-macosx
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for CFLAG -fsigned-char... yes
checking for CFLAG -pipe... yes
checking for CFLAG -fcommon... yes
checking for CFLAG -fno-builtin-malloc... yes
checking for CFLAG -fno-builtin-free... yes
checking for CFLAG -fno-PIE... yes
checking for CFLAG -fno-pie... yes
checking for CFLAG -fno-PIC... yes
checking for CFLAG -fno-pic... yes
checking for CFLAG -Wall... yes
checking for CFLAG -Wno-builtin-requires-header... yes
checking for CFLAG -Wno-empty-body... yes
checking for CFLAG -Wno-self-assign... yes
checking for CFLAG -Wno-unused-but-set-variable... yes
checking for LDFLAG -no-pie... no
checking for inline semantics... new
checking for clang... yes
checking for CFLAG -Wno-incomplete-setjmp-declaration... yes
checking for LDFLAG -Wl,-no_pie... yes
checking for CFLAG -m64... yes
checking for LDFLAG -m64... yes
checking for LDFLAG -Wl,-headerpad,72... yes
checking for gawk... (cached) gawk
checking for CFLAG -g... yes
checking for makeinfo... makeinfo
checking system version (for dynamic loading)... Darwin-23.3.0
checking for malloc/malloc.h... yes
checking for struct _malloc_zone_t.memalign... yes
checking for setjmp.h... yes
checking sizeof jmp_buf... 148
checking for unistd.h... (cached) yes
checking for sysconf in -lc... yes
checking _SC_CLK_TCK... 0
checking for gmp.h... yes
checking for __gmpz_init in -lgmp... yes
checking for external gmp version... good
checking for leading underscore in object symbols... "yes"
checking for size of gmp limbs... 8
checking _SHORT_LIMB... no
checking _LONG_LONG_LIMB... no
checking for GNU ld option -Map... no
checking for dlopen in -ldl... yes
checking for xdr_double... yes
checking __builtin_clzl... yes
checking __builtin_ctzl... yes
checking __builtin___clear_cache... yes
checking size of long... 8
checking size of short... 2
checking size of int... 4
checking size of char... 1
checking for math.h... yes
checking for complex.h... yes
checking for byte order... little
checking for word order... little
checking for pagewidth... 12
checking for required object alignment... 8
checking for C extension variable alignment... __attribute__ ((aligned (8)))
checking for C extension noreturn function attribute... __attribute__ ((noreturn))
checking sizeof struct contblock... 16
checking for sbrk... yes
emulating sbrk for mac
checking CSTACK_DIRECTION... -1
checking finding CSTACK_ALIGNMENT... 16
checking CSTACK_ADDRESS... 0x7ff7bfffffff
checking cstack bits... 47
checking NEG_CSTACK_ADDRESS... no
checking finding default linker script... got it
checking output_arch... not found
configure: trying to adjust text start
configure: min log text start 62
configure: max log text start 0
checking our linker script... none found or not needed
checking mem top... 0x8000000000000000
checking finding upper mem half range... 0x4000000000000000
checking sizeof long long int... no
checking for dirent.h... yes
checking for d_type... yes
checking for getcwd... yes
checking for getwd... yes
checking for rename... yes
checking for uname... yes
checking for gettimeofday... yes
checking for readlinkat... yes
checking for sys/ioctl.h... yes
checking for elf.h... no
checking for elf_abi.h... no
checking for sys/sockio.h... yes
checking for BSDgettimeofday... no
checking for gettimeofday... (cached) yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for gettimeofday declaration... present
checking for sin in -lm... yes
checking for main in -lmingwex... no
checking for buggy maximum sscanf length... none
checking for values.h... no
checking for float.h... yes
checking for isnormal... yes
checking for isfinite... yes
checking for sockets... checking for connect... yes
checking for gethostbyname... yes
checking for readline/readline.h... yes
checking for rl_initialize in -lreadline... yes
checking for el_getc in -lreadline... no
checking for rl_completion_matches in -lreadline... yes
checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_FUNCTION... no
checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_RL_COMPENTRY_FUNC_T... yes
checking RL_READLINE_NAME_TYPE_CHAR... no
checking RL_READLINE_NAME_TYPE_CONST_CHAR... yes
checking For network code for nsocket.c... yes
checking check for listen using fcntl... yes
checking for profil... no
checking for setenv... yes
checking for _cleanup... yes
checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... O_NONBLOCK
checking check for SV_ONSTACK... yes
checking check for SIGSYS... yes
checking check for SIGEMT... yes
checking for sigaltstack... yes
checking for feenableexcept... no
checking for dis-asm.h... no
checking for asm/sigcontext.h... no
checking for asm/signal.h... no
checking for sigcontext...... sigcontext NOT of signal.h
checking for sigcontext...... no sigcontext found
checking for emacs... /opt/local/bin/emacs
checking emacs site lisp directory... /opt/local/share/emacs/site-lisp/gcl/
checking emacs default.el... /opt/local/share/emacs/site-lisp/gcl//default.el
checking emacs info/dir... /opt/local/share/info/
Builtin TK not requested
checking for tcl/tk... not found
checking for sys/mman.h... yes
checking for mprotect... yes
checking for alloca.h... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
configure: creating ./config.status
config.status: creating makedefc
config.status: creating windows/gcl.iss
config.status: creating windows/sysdir.bat
config.status: creating windows/install.lsp
config.status: creating h/gclincl.h
makedefc

# begin makedefs

# use=386-macosx

# for main link of raw_gcl
LIBS=   -ldl  -lm  -lgmp -lreadline

# root for the installation, eg /usr/local
# This would cause make install to create /usr/local/bin/gcl and
# /usr/local/lib/gcl-2-??/* with some basic files.
prefix=/usr/local

# where to place the info files
INFO_DIR=/opt/local/share/info/

# where to put emacs lisp files.
EMACS_SITE_LISP=/opt/local/share/emacs/site-lisp/gcl/

# the default.el file
EMACS_DEFAULT_EL=/opt/local/share/emacs/site-lisp/gcl//default.el

# numerous TCL/TK variables culled from the tkConfig.sh and tclConfig.sh
# if these are found.
TK_CONFIG_PREFIX=unknown
TK_LIBRARY=
TCL_LIBRARY=
TK_XINCLUDES=
TK_INCLUDE=
TCL_INCLUDE=
TK_LIB_SPEC=
TK_BUILD_LIB_SPEC=
TK_XLIBSW=
TK_XINCLUDES=
TCL_LIB_SPEC=
TCL_DL_LIBS=
TCL_LIBS=
TK_LIBS=@TK_LIBS@
TCL_STUB_LIBS=@TCL_STUB_LIBS@
TCL_DEFS=@TCL_DEFS@
TK_DEFS=@TK_DEFS@

PRELINK_CHECK=

NOTIFY=no
CC=gcc
GCL_CC=gcc 
CPP=gcc -E
CFLAGS=-fsigned-char -pipe -fcommon -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC -fno-pic -Wall -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign -Wno-unused-but-set-variable -Wno-incomplete-setjmp-declaration -m64 -g -g     -I$(GCLDIR)/o
LDFLAGS=-Wl,-no_pie -m64 -Wl,-headerpad,72
FINAL_CFLAGS=-fsigned-char -pipe -fcommon -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC -fno-pic -Wall -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign -Wno-unused-but-set-variable -Wno-incomplete-setjmp-declaration -m64 -g -g    
NIFLAGS=-fsigned-char -pipe -fcommon -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC -fno-pic -Wall -Wno-builtin-requires-header -Wno-empty-body -Wno-self-assign -Wno-unused-but-set-variable -Wno-incomplete-setjmp-declaration -m64 -g -g     -I$(GCLDIR)/o
O3FLAGS=
O2FLAGS=

RL_OBJS=gcl_readline

RL_LIB=

MAKEINFO=makeinfo

FLISP=saved_gcl
SYSTEM=gcl
BUILD_BFD=
GMPDIR=
GPROF=
PARGCLDIR=
X_LIBS=
X_CFLAGS=

PROCESSOR_FLAGS=@PROCESSOR_FLAGS@

EXTRA_LOBJS=
LEADING_UNDERSCORE=1
GNU_LD=
AWK=gawk
LIBBFD=
LIBIBERTY=
PATHNAME_BUG=@PATHNAME_BUG@
add-defs1 386-macosx
using 386-macosx.defs
 if the 'unknown' directories exist you may provide
a second argument to ./add-defs of a local directory where things might be,
or edit ./add-defs so that it can find them.   Otherwise just continue
and the portions with unknown will not be compiled.
make.log.bz2 (application/x-bzip2, 72.6 KB) - not displayed
config.log (text/plain, 144.2 KB) - not displayed
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEES+aY+4laoC0TwmVKFUkg2jrYR8gFAmXKqzMACgkQFUkg2jrY
R8iguBAAijV6nIFdx9vG5EytHIYGH8+mRzrzJoNYY8e8bGvpu4McW4Bdz8TvMgXI
HE9eaFr8EkIPKIsKwqPZrmZreOCyZOgkstrGLr3xE6SfHfWRS/ZrkRTC/bys/wNR
mof82WdEh+MT6JOixJd5IdU3w0yrwPdQQ+MDsDFHVmjVYZf6Tx0LXl2sHnkiE4Wo
Dt0O/vaiqKjX/6gIPcxqw40hCeJAnGNPlVaepSR70LTwJHgOLL+SfhONqI1n3Oy1
CG1SNxtoPA85Fg5SMHydmltAcfStgYJ10b87TZB8LVJ8VU4JeW/vqfjI1sOtFCCi
fONCQdtd3LWl/BOdvRGJmKRKg92HYhggqWaUCMwnbCHzTB9/BJqB+ytN9eR85vfT
SiRS9DGWJu06BuFaqBzrY3QZ+LfNA9Hd4YbdGIHnzly1cOeDRLgG+ShyE4VoMJkj
bVUtOo0rlRic0OVcOmdiYcJoLC95vG24SFb59gsRHqq/tAhFREKPFCcsjPyFzIjG
fR9td/JuEPqBO1qVG4ijU8tXPba6LeB4I1c0SJNNwgtGATOzhfl8gnDfTGIrolcu
zQvRkzrtEaSd6vqVrsW03ZvFjAgnikN+Yt0H2PIOASbdaUfKmUXmPcEYlooWOILs
115CM1gkcmeMP97/ekANnovj0FzQbirB/8BtJDpIQHZrKmvoYxg=
=glGq
-----END PGP SIGNATURE-----