Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build in Apple Silicon under macOS Monterey #259

Open
rickyzhang82 opened this issue Jun 17, 2022 · 8 comments
Open

Failed to build in Apple Silicon under macOS Monterey #259

rickyzhang82 opened this issue Jun 17, 2022 · 8 comments

Comments

@rickyzhang82
Copy link
Contributor

I got my Mac Studio today. Finally I could build BII under Apple Silicon with the latest Mac OS.

However, I failed to build the master branch 6393d14.

The first roadblock is outdated autoconf. It seem low hang fruits to fix (or simply ignore) all warnings by running autoupdate on configure.ac and *.m4 files. Running configure seems to look happy.

Then the actual build got stuck in slip. I have no clues why slirp was included in the build by default. I thought slirp is not 64bit ready. Therefore, it was excluded.

Maybe configure was broken in Apple Silicon?! But I did a BII build in AARCH 64 under Linux. It works.

Question:

  1. Do we want to update autoconf script?
  2. Anyone working on Apple Silicon?
[Ricky@ms:Unix](upstream-dev)$ NO_CONFIGURE=1 ./autogen.sh
 + Running aclocal: done.
 + Running autoheader: done.
 + Running autoconf: configure.ac:7: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:7: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:7: the top level
configure.ac:208: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:208: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:208: the top level
configure.ac:309: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:309: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
...
configure.ac:1751: gcc_AC_C_FLOAT_FORMAT is expanded from...
configure.ac:1834: the top level
done.
[Ricky@ms:Unix](upstream-dev)$ ./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon --with-sdl2
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 for sys/time.h... yes
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking build system type... aarch64-apple-darwin21.5.0
checking host system type... aarch64-apple-darwin21.5.0
checking target system type... aarch64-apple-darwin21.5.0
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 whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking for grep that handles long lines and -e... /opt/local/bin/ggrep
checking for egrep... /opt/local/bin/ggrep -E
checking for mon... yes
checking for tgetent in -lncurses... yes
checking for readline in -lreadline... yes
checking for sem_init in -lposix4... no
checking for timer_create in -lrt... no
checking for shm_open in -lrt... no
checking for cos in -lm... yes
checking for sdl2-config... /opt/local/bin/sdl2-config
checking for library containing pthread_create... none required
checking for pthread_cond_init... yes
checking for pthread_cancel... yes
checking for pthread_testcancel... yes
checking for pthread_mutexattr_setprotocol... yes
checking for pthread_mutexattr_settype... yes
checking for pthread_mutexattr_setpshared... yes
checking for sem_init... yes
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pkg-config... (cached) /opt/local/bin/pkg-config
checking pkg-config is at least version 0.7... yes
checking for GTK+ - version >= 1.3.15... yes (version 2.24.33)
checking for esd-config... no
checking for ESD - version >= 0.2.8... no
*** The esd-config script installed by ESD could not be found
*** If ESD was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the ESD_CONFIG environment variable to the
*** full path to esd-config.
configure: WARNING: Could not find ESD, disabling ESD support.
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for egrep... (cached) /opt/local/bin/ggrep -E
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for fcntl.h... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for sys/mman.h... yes
checking for mach/mach.h... yes
checking for readline.h... no
checking for history.h... no
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for sys/socket.h... yes
checking for sys/ioctl.h... yes
checking for sys/filio.h... yes
checking for sys/bitypes.h... no
checking for sys/wait.h... yes
checking for sys/poll.h... yes
checking for sys/select.h... yes
checking for arpa/inet.h... yes
checking for linux/if.h... no
checking for linux/if_tun.h... no
checking for net/if.h... yes
checking for net/if_tun.h... no
checking for AvailabilityMacros.h... yes
checking for IOKit/storage/IOBlockStorageDevice.h... yes
checking for sys/stropts.h... no
checking for stropts.h... no
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of float... 4
checking size of double... 8
checking size of long double... 8
checking size of void *... 8
checking for off_t... yes
checking for loff_t... no
checking for caddr_t... yes
checking for size_t... yes
checking return type of signal handlers... void
checking whether struct tm is in sys/time.h or time.h... time.h
checking for socklen_t... yes
checking for strdup... yes
checking for strerror... yes
checking for cfmakeraw... yes
checking for clock_gettime... yes
checking for timer_create... no
checking for sigaction... yes
checking for signal... yes
checking for mmap... yes
checking for mprotect... yes
checking for munmap... yes
checking for vm_allocate... yes
checking for vm_deallocate... yes
checking for vm_protect... yes
checking for poll... yes
checking for inet_aton... yes
checking for mach_task_self... yes
checking for task_self... no
checking for strings.h... (cached) yes
checking for login.h... no
checking for sys/bsdtty.h... no
checking for sys/stat.h... (cached) yes
checking for util.h... yes
checking for pty.h... no
checking for library containing openpty... none required
checking for _getpty... no
checking for openpty... yes
checking for vhangup... no
checking for strlcpy... yes
checking for "/dev/ptc"... no
checking FIONBIO vs. O_NONBLOCK for non-blocking I/O... O_NONBLOCK
checking whether compiler supports byte bit-fields... yes
checking whether compiler supports framework AppKit... yes
checking whether compiler supports framework Carbon... yes
checking whether compiler supports framework IOKit... yes
checking whether compiler supports framework CoreFoundation... yes
checking for vde_close in -lvdeplug... no
checking whether __LP64__ is defined... yes
checking whether TUN/TAP is supported... no
checking whether vm_protect works... yes
checking whether __PAGEZERO can be Low Memory area 0x0000-0x2000... no
checking whether we can map Low Memory area 0x0000-0x2000... no
checking whether signal handlers need to be reinstalled... no
checking whether sigaction handlers need to be reinstalled... no
checking whether your system supports Mach exceptions... no
checking whether your system supports Windows exceptions... no
checking whether your system supports extended signal handlers via asm... no
checking whether your system supports extended signal handlers... no
checking whether we then have a subterfuge for your system... no
checking whether we can skip instruction in SIGSEGV handler... no
checking for true... /usr/bin/true
checking whether linker script is usable... yes
checking for the addressing mode to use... memory banks
checking for GAS .p2align feature... yes
checking for GCC 2.7 or higher... yes
checking for GCC 3.0 or higher... yes
checking for ICC... no
checking whether GCC supports constants merging... yes
checking whether GCC supports store motion... yes
checking whether the compiler supports -fno-strict-aliasing... yes
checking whether the compiler supports -mdynamic-no-pic... yes
checking floating point format... IEEE (little-endian)
checking for ieee754.h... no
checking for ieeefp.h... no
checking for floatingpoint.h... no
checking for nan.h... no
checking for isnanl... no
checking for isinfl... no
checking for logl... yes
checking for log10l... yes
checking for expl... yes
checking for powl... yes
checking for fabsl... yes
checking for sqrtl... yes
checking for sinl... yes
checking for cosl... yes
checking for tanl... yes
checking for sinhl... yes
checking for coshl... yes
checking for tanhl... yes
checking for asinl... yes
checking for acosl... yes
checking for atanl... yes
checking for asinhl... yes
checking for acoshl... yes
checking for atanhl... yes
checking for floorl... yes
checking for ceill... yes
checking for atanh... yes
checking for isnan... yes
checking for isinf... yes
checking for finite... no
checking for isnormal... no
checking for signbit... no
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING:  'Makefile.in' seems to ignore the --datarootdir setting
config.status: creating config.h
config.status: config.h is unchanged

Basilisk II configuration summary:

Mac OS X GUI ........................... : no
Mac OS X Sound ......................... : no
SDL support ............................ : video audio
SDL major-version ...................... : 2
BINCUE support ......................... : no
LIBVHD support ......................... : no
VDE support ............................ : no
XFree86 DGA support .................... : no
XFree86 VidMode support ................ : no
fbdev DGA support ...................... : no
Enable video on SEGV signals ........... : no
ESD sound support ...................... : no
GTK user interface ..................... : gtk2
mon debugger support ................... : yes
Running m68k code natively ............. : no
Use JIT compiler ....................... : no
JIT debug mode ......................... : no
Floating-Point emulation core .......... : IEEE fpu core
Assembly optimizations ................. : none
Addressing mode ........................ : memory banks
Bad memory access recovery type ........ :

Configuration done. Now type "make" (or "gmake").
[Ricky@ms:Unix](upstream-dev)$
[Ricky@ms:Unix](upstream-dev)$ make
g++ -I../MacOSX -I./../include -I./. -I. -I./../CrossPlatform -I./../uae_cpu -I./../slirp -DHAVE_CONFIG_H  -DOS_darwin -DFPU_IEEE -D_REENTRANT -DDATADIR=\"/usr/local/share/BasiliskII\" -g -O2 -I../../../cxmon/src -I../../../cxmon/src/disass -I/opt/local/include/SDL2 -D_THREAD_SAFE -fno-merge-constants -fno-gcse-sm -mdynamic-no-pic -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/atk-1.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include -c ./../main.cpp -o obj/main.o
clang: warning: optimization flag '-fno-merge-constants' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-fno-gcse-sm' is not supported [-Wignored-optimization-argument]
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:649:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__debug:21:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:490:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/search.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/iterator_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/incrementable_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/concepts:133:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/invoke.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/weak_result_type.h:16:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:421:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:490:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/search.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/iterator_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/incrementable_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/concepts:134:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:22:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:85:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:490:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/search.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/iterator_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/incrementable_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/concepts:134:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:23:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/new:95:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:490:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/search.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/iterator_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/incrementable_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/concepts:134:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:214:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/cmp.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:121:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:490:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/search.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/iterator_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/incrementable_traits.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/concepts:134:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:26:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:228:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:495:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/bind_front.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/perfect_forward.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:164:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:582:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__thread/poll_with_backoff.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/chrono:833:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:587:
./../slirp/version:1:1: error: unknown type name 'qemu'
qemu 0.9.0 (2007/02/05)
^
./../slirp/version:1:6: error: expected unqualified-id
qemu 0.9.0 (2007/02/05)
     ^
In file included from ./../main.cpp:31:
In file included from ./../include/audio.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:275:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:590:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:457:44: error: use of undeclared identifier '__error'
   while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
                                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/errno.h:81:17: note: expanded from macro 'errno'
#define errno (*__error())
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [obj/main.o] Error 1
[Ricky@ms:Unix](upstream-dev)$
@rickyzhang82
Copy link
Contributor Author

rickyzhang82 commented Jun 18, 2022

I figured out the first compiling issue. There is a file macemu/BasiliskII/src/slirp/VERSION which happens to be in the include header path.

I thought AFPS is case sensitive. Why it can't differentiate the file version vs VERSION in slirp folder? It is strange.

UPDATE:

  1. I checked AFPS can be either case sensitive or case insensitive. Out of the box, it chose case insensitive. My Intel iMac also use case insensitive. The issue didn't surface in Intel iMac until Mac OS SDK upgrades from Catalina to Monterey.
  2. The workaround is to rename macemu/BasiliskII/src/slirp/VERSION to macemu/BasiliskII/src/slirp/VERSION.txt
[Ricky@ms:Unix](upstream-dev)$ vim /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef
  1 // -*- C++ -*-
  2 //===--------------------------- cstddef ----------------------------------===//
  3 //
  4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5 // See https://llvm.org/LICENSE.txt for license information.
  6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7 //
  8 //===----------------------------------------------------------------------===//
  9
 10 #ifndef _LIBCPP_CSTDDEF
 11 #define _LIBCPP_CSTDDEF
 12
 13 /*
 14     cstddef synopsis
 15
 16 Macros:
 17
 18     offsetof(type,member-designator)
 19     NULL
 20
 21 namespace std
 22 {
 23
 24 Types:
 25
 26     ptrdiff_t
 27     size_t
 28     max_align_t // C++11
 29     nullptr_t
 30     byte // C++17
 31
 32 }  // std
 33
 34 */
 35
 36 #include <__config>
 37 #include <version>

@rickyzhang82
Copy link
Contributor Author

This is a new compilation road block.

[Ricky@ms:Unix](upstream-dev)$ make
g++ -I../MacOSX -I./../include -I./. -I. -I./../CrossPlatform -I./../uae_cpu -I./../slirp -DHAVE_CONFIG_H  -DOS_darwin -DFPU_IEEE -D_REENTRANT -DDATADIR=\"/usr/local/share/BasiliskII\" -g -O2 -I../../../cxmon/src -I../../../cxmon/src/disass -I/opt/local/include/SDL2 -D_THREAD_SAFE -fno-merge-constants -fno-gcse-sm -mdynamic-no-pic -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/atk-1.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include -c ./../CrossPlatform/sigsegv.cpp -o obj/sigsegv.o
clang: warning: optimization flag '-fno-merge-constants' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-fno-gcse-sm' is not supported [-Wignored-optimization-argument]
./../CrossPlatform/sigsegv.cpp:2619:30: error: unknown type name 'SIGSEGV_FAULT_HANDLER_ARGLIST'
static bool handle_badaccess(SIGSEGV_FAULT_HANDLER_ARGLIST_1)
                             ^
./../CrossPlatform/sigsegv.cpp:2522:41: note: expanded from macro 'SIGSEGV_FAULT_HANDLER_ARGLIST_1'
#define SIGSEGV_FAULT_HANDLER_ARGLIST_1 SIGSEGV_FAULT_HANDLER_ARGLIST
                                        ^
./../CrossPlatform/sigsegv.cpp:2622:31: error: use of undeclared identifier 'SIGSEGV_FAULT_ADDRESS'
        SI.addr = (sigsegv_address_t)SIGSEGV_FAULT_ADDRESS_FAST;
                                     ^
./../CrossPlatform/sigsegv.cpp:2513:37: note: expanded from macro 'SIGSEGV_FAULT_ADDRESS_FAST'
#define SIGSEGV_FAULT_ADDRESS_FAST              SIGSEGV_FAULT_ADDRESS
                                                ^
./../CrossPlatform/sigsegv.cpp:2632:10: warning: enumeration value 'SIGSEGV_RETURN_SKIP_INSTRUCTION' not handled in switch [-Wswitch]
        switch (SIGSEGV_FAULT_HANDLER_INVOKE(SIP)) {
                ^
./../CrossPlatform/sigsegv.cpp:2525:41: note: expanded from macro 'SIGSEGV_FAULT_HANDLER_INVOKE'
#define SIGSEGV_FAULT_HANDLER_INVOKE(P) sigsegv_fault_handler(P)
                                        ^
./../CrossPlatform/sigsegv.cpp:2632:10: note: add missing switch cases
        switch (SIGSEGV_FAULT_HANDLER_INVOKE(SIP)) {
                ^
./../CrossPlatform/sigsegv.cpp:2525:41: note: expanded from macro 'SIGSEGV_FAULT_HANDLER_INVOKE'
#define SIGSEGV_FAULT_HANDLER_INVOKE(P) sigsegv_fault_handler(P)
                                        ^
1 warning and 2 errors generated.
make: *** [obj/sigsegv.o] Error 1

In config.h, Apple Silicon undef SIGSEGV handler. I need to dig further what this is.

/* Define if we can ignore the fault (instruction skipping in SIGSEGV
   handler). */
/* #undef HAVE_SIGSEGV_SKIP_INSTRUCTION */

@kanjitalk755
Copy link

Refer my fork.
You can now build BII with autoconf on Apple Silicon.

@rickyzhang82
Copy link
Contributor Author

@kanjitalk755
Sweet. I will give a try this weekend.

@rickyzhang82
Copy link
Contributor Author

Hi @kanjitalk755,

I deep dive into AARCH64 assembly and Mac OS mach exception mechanism.

Your AARCH64 change may not be an ideal solution in AARCH64.

	_STRUCT_ARM_THREAD_STATE64 *ts = (_STRUCT_ARM_THREAD_STATE64 *)regs;
	if (!ts->__pc) return false;
	ts->__pc += 4;
	return true;

I ported a mach exception example code from Mr Sing's Mac OS X internal book to AARCH64. I used the same approach when BAD ACCESS Exception is thrown, do PC+=4. If the exception happens after any AARCH64 branch instruction like BLR, BR and etc, you are unlikely to recover by do PC+=4.

Here is the test case. My comments on this issue.

There is no easy solution to this kind of the problem. I think if we can notify the guest OS and let them handle it gracefully, it would be much better than skip an instruction.

Any thoughts?

@kanjitalk755
Copy link

Certainly, it cannot be handled when the branch destination is an execution prohibited page.
Such case exist in theory, but did it appear during BII/SS execution?

There is no easy solution to this kind of the problem. I think if we can notify the guest OS and let them handle it gracefully, it would be much better than skip an instruction.

Instead of relying on host-side exception handler, you may need to implement the guest hardware strictly so that the guest OS handles it properly.

@rickyzhang82
Copy link
Contributor Author

Good question. The generated C codes in cpuemu.cpp that emulates 68k assembly may or may not have branch instruction. I will investigate it.

For the exception handler, I will bring up cmon to see why. But sometimes it is hard to figure out. I will just let it go. In my physical MacSE, I saw A bomb for read access violation. Maybe we could drop A bomb like this rather than skip the instruction?

@kanjitalk755
Copy link

I observed writes to invalid addresses in a normal boot sequence of BII/SS.
Adopting bomb instead of skip instruction will prevent a successful boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants