tom-seddon / b2

BBC Micro emulator for Windows, OS X, and Linux
113 stars 12 forks source link

Unknown gcc CPU errors on macOS 14.2.1 #320

Closed RaymondLuxuryYacht closed 2 months ago

RaymondLuxuryYacht commented 7 months ago

Command-line build on M2 Mac running Sonoma fails with ninja producing following output:

FAILED: src/shared/CMakeFiles/shared_lib.dir/c/debug.c.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DBUILD_TYPE_RelWithDebInfo=1 -D_GNU_SOURCE -I/Users/steven/Repos/b2/src/shared/h -Werror=implicit-function-declaration -std=c1x -O2 -g -DNDEBUG -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=10.9   -Wall -Wuninitialized -Winit-self -pedantic -Wsign-conversion -Wunused-result -Wno-invalid-offsetof -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=return-type -Wno-pragma-pack -Wsign-compare -Wsign-conversion -Wsometimes-uninitialized -Wno-overlength-strings -Wunused-parameter -MD -MT src/shared/CMakeFiles/shared_lib.dir/c/debug.c.o -MF src/shared/CMakeFiles/shared_lib.dir/c/debug.c.o.d -o src/shared/CMakeFiles/shared_lib.dir/c/debug.c.o -c /Users/steven/Repos/b2/src/shared/c/debug.c
In file included from /Users/steven/Repos/b2/src/shared/c/debug.c:1:
/Users/steven/Repos/b2/src/shared/h/shared/system.h:70:2: error: Unknown gcc CPU
#error Unknown gcc CPU
 ^
/Users/steven/Repos/b2/src/shared/h/shared/system.h:104:2: error: Unknown endianness
#error Unknown endianness
 ^
/Users/steven/Repos/b2/src/shared/h/shared/system.h:226:2: error: BREAK - unknown CPU
#error BREAK - unknown CPU
 ^
3 errors generated.

The same 3 errors occur building src/6502/CMakeFiles/6502_gen.dir/6502_gen.cpp.o

Toolchain:

I'm a novice with Ninja and CMake but happy to help troubleshoot.

tom-seddon commented 7 months ago

You could try the wip/master branch: https://github.com/tom-seddon/b2/tree/wip/master - that has (amongst other things...) a fix for building AArch64 Raspberry Pi, hopefully covering Apple Silicon as well. (See commit cb8e45e699853db328193520478e05ad20f3e21f.) This is untested by me, though it's based on a PR I received a while ago - I'd be very interested to hear how you get on. (I will be getting a fancy new Mac at some point, but I don't have one yet.)

popey commented 6 months ago

Good news everyone. I had an idle moment on my M1 MacBook Air running Ubuntu Asahi and tried the wip/master branch. Works fine.

image

tom-seddon commented 6 months ago

Ah, excellent... thank you for trying it! I'll add a note about this to the docs.

@RaymondLuxuryYacht have you had a chance to try this? No problem if not, I will be sorting out some testing on Apple Silicon macOS eventually, one way or another.

(Hopefully it works, meaning I can get the CI system to build a mixed architecture binary for Intel+Apple Silicon, and Apple Silicon users can get a native binary without having to build it themselves!)

popey commented 6 months ago

Oh, my M1 laptop dual-boots macOS, too; I can test it there, too, if that helps? Assuming I can figure out how to build this WIP branch there :D

tom-seddon commented 6 months ago

Thanks for the offer - yes, I'd be interested to hear how you get on! Fingers crossed, it should just be a question of following the macOS-specific build instructions: https://github.com/tom-seddon/b2/blob/wip/master/doc/Building.md - please report back if you run into any problems. The build instructions are supposed to be up to date, and they look like they are, but I'll try to figure out what I missed if you find otherwise...

(You can treat macOS as if it's a Unix, and build with ninja/cc, or build using Xcode. Both paths are regularly used; the CI system builds as it Unix-style (as that's easier for automation), and I build it myself using Xcode (as I like having a debugger).)

popey commented 6 months ago

I had a quick go, and fell over at the part where it looks for the various ffmpeg libraries (libavcodec and friends). I haven't done much development on this, so I may be missing something. I do have xcode, added macports and install the latest ffmpeg 4.4.4_6. But make init_xcode fails. I tried restarting the terminal in case paths weren't setup as I only just installed macports and thus ffmpeg, but no luck. Any ideas welcome.

Last login: Sun Mar 17 01:14:28 on ttys007
alan@Alans-MacBook-Air ~ % cd Development/tom-seddon/b2
alan@Alans-MacBook-Air b2 % make init_xcode
rm -Rf "build/Xcode"
mkdir -p "build/Xcode"
cd "build/Xcode" && cmake -G Xcode  -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 ../..
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "0.29.2")
-- Found CURL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libcurl.tbd (found suitable version "8.4.0", minimum required is "7") found components: HTTP
-- libcurl found:
-- Looking for a OBJC compiler
-- Looking for a OBJC compiler - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Performing Test CHECK_CPU_ARCHITECTURE_X86
-- Performing Test CHECK_CPU_ARCHITECTURE_X86 - Failed
-- Performing Test CHECK_CPU_ARCHITECTURE_X64
-- Performing Test CHECK_CPU_ARCHITECTURE_X64 - Failed
-- Performing Test CHECK_CPU_ARCHITECTURE_ARM32
-- Performing Test CHECK_CPU_ARCHITECTURE_ARM32 - Failed
-- Performing Test CHECK_CPU_ARCHITECTURE_ARM64
-- Performing Test CHECK_CPU_ARCHITECTURE_ARM64 - Success
-- Performing Test CHECK_CPU_ARCHITECTURE_LOONGARCH64
-- Performing Test CHECK_CPU_ARCHITECTURE_LOONGARCH64 - Failed
-- Performing Test HAVE_GCC_WALL
-- Performing Test HAVE_GCC_WALL - Success
-- Performing Test HAVE_GCC_NO_STRICT_ALIASING
-- Performing Test HAVE_GCC_NO_STRICT_ALIASING - Success
-- Performing Test HAVE_GCC_WDECLARATION_AFTER_STATEMENT
-- Performing Test HAVE_GCC_WDECLARATION_AFTER_STATEMENT - Success
-- Performing Test HAVE_GCC_ATOMICS
-- Performing Test HAVE_GCC_ATOMICS - Success
-- Performing Test HAVE_GCC_FVISIBILITY
-- Performing Test HAVE_GCC_FVISIBILITY - Success
-- Performing Test HAVE_GCC_WSHADOW
-- Performing Test HAVE_GCC_WSHADOW - Success
-- Performing Test HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS
-- Performing Test HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS - Success
-- Performing Test HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS - Success
-- Looking for immintrin.h
-- Looking for immintrin.h - not found
-- Performing Test HAVE_ALTIVEC_H_HDR
-- Performing Test HAVE_ALTIVEC_H_HDR - Failed
-- Performing Test CPU_SUPPORTS_ALTIVEC
-- Performing Test CPU_SUPPORTS_ALTIVEC - Failed
-- Looking for ctype.h
-- Looking for ctype.h - found
-- Looking for float.h
-- Looking for float.h - found
-- Looking for iconv.h
-- Looking for iconv.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for limits.h
-- Looking for limits.h - found
-- Looking for malloc.h
-- Looking for malloc.h - not found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for stdarg.h
-- Looking for stdarg.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdio.h
-- Looking for stdio.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for wchar.h
-- Looking for wchar.h - found
-- Looking for linux/input.h
-- Looking for linux/input.h - not found
-- Looking for 7 include files stddef.h, ..., float.h
-- Looking for 7 include files stddef.h, ..., float.h - found
-- Looking for M_PI
-- Looking for M_PI - found
-- Performing Test HAVE_MPROTECT
-- Performing Test HAVE_MPROTECT - Success
-- Looking for strtod
-- Looking for strtod - found
-- Looking for malloc
-- Looking for malloc - found
-- Looking for calloc
-- Looking for calloc - found
-- Looking for realloc
-- Looking for realloc - found
-- Looking for free
-- Looking for free - found
-- Looking for getenv
-- Looking for getenv - found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for putenv
-- Looking for putenv - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for bsearch
-- Looking for bsearch - found
-- Looking for qsort
-- Looking for qsort - found
-- Looking for abs
-- Looking for abs - found
-- Looking for bcopy
-- Looking for bcopy - found
-- Looking for memset
-- Looking for memset - found
-- Looking for memcpy
-- Looking for memcpy - found
-- Looking for memmove
-- Looking for memmove - found
-- Looking for memcmp
-- Looking for memcmp - found
-- Looking for strlen
-- Looking for strlen - found
-- Looking for strlcpy
-- Looking for strlcpy - found
-- Looking for strlcat
-- Looking for strlcat - found
-- Looking for _strrev
-- Looking for _strrev - not found
-- Looking for _strupr
-- Looking for _strupr - not found
-- Looking for _strlwr
-- Looking for _strlwr - not found
-- Looking for index
-- Looking for index - found
-- Looking for rindex
-- Looking for rindex - found
-- Looking for strchr
-- Looking for strchr - found
-- Looking for strrchr
-- Looking for strrchr - found
-- Looking for strstr
-- Looking for strstr - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for itoa
-- Looking for itoa - not found
-- Looking for _ltoa
-- Looking for _ltoa - not found
-- Looking for _uitoa
-- Looking for _uitoa - not found
-- Looking for _ultoa
-- Looking for _ultoa - not found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for strtoul
-- Looking for strtoul - found
-- Looking for _i64toa
-- Looking for _i64toa - not found
-- Looking for _ui64toa
-- Looking for _ui64toa - not found
-- Looking for strtoll
-- Looking for strtoll - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for atoi
-- Looking for atoi - found
-- Looking for atof
-- Looking for atof - found
-- Looking for strcmp
-- Looking for strcmp - found
-- Looking for strncmp
-- Looking for strncmp - found
-- Looking for _stricmp
-- Looking for _stricmp - not found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for _strnicmp
-- Looking for _strnicmp - not found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strcasestr
-- Looking for strcasestr - found
-- Looking for wcscmp
-- Looking for wcscmp - found
-- Looking for _wcsdup
-- Looking for _wcsdup - not found
-- Looking for wcsdup
-- Looking for wcsdup - found
-- Looking for wcslcat
-- Looking for wcslcat - found
-- Looking for wcslcpy
-- Looking for wcslcpy - found
-- Looking for wcslen
-- Looking for wcslen - found
-- Looking for wcsncmp
-- Looking for wcsncmp - found
-- Looking for wcsstr
-- Looking for wcsstr - found
-- Looking for wcscasecmp
-- Looking for wcscasecmp - found
-- Looking for _wcsicmp
-- Looking for _wcsicmp - not found
-- Looking for wcsncasecmp
-- Looking for wcsncasecmp - found
-- Looking for _wcsnicmp
-- Looking for _wcsnicmp - not found
-- Looking for sscanf
-- Looking for sscanf - found
-- Looking for vsscanf
-- Looking for vsscanf - found
-- Looking for vsnprintf
-- Looking for vsnprintf - found
-- Looking for fopen64
-- Looking for fopen64 - not found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for fseeko64
-- Looking for fseeko64 - not found
-- Looking for _Exit
-- Looking for _Exit - found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for setjmp
-- Looking for setjmp - found
-- Looking for nanosleep
-- Looking for nanosleep - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for sysctlbyname
-- Looking for sysctlbyname - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Looking for elf_aux_info
-- Looking for elf_aux_info - not found
-- Looking for poll
-- Looking for poll - found
-- Looking for pow in m
-- Looking for pow in m - found
-- Looking for atan
-- Looking for atan - found
-- Looking for atan2
-- Looking for atan2 - found
-- Looking for atanf
-- Looking for atanf - found
-- Looking for atan2f
-- Looking for atan2f - found
-- Looking for ceil
-- Looking for ceil - found
-- Looking for ceilf
-- Looking for ceilf - found
-- Looking for copysign
-- Looking for copysign - found
-- Looking for copysignf
-- Looking for copysignf - found
-- Looking for cos
-- Looking for cos - found
-- Looking for cosf
-- Looking for cosf - found
-- Looking for exp
-- Looking for exp - found
-- Looking for expf
-- Looking for expf - found
-- Looking for fabs
-- Looking for fabs - found
-- Looking for fabsf
-- Looking for fabsf - found
-- Looking for floor
-- Looking for floor - found
-- Looking for floorf
-- Looking for floorf - found
-- Looking for fmod
-- Looking for fmod - found
-- Looking for fmodf
-- Looking for fmodf - found
-- Looking for log
-- Looking for log - found
-- Looking for logf
-- Looking for logf - found
-- Looking for log10
-- Looking for log10 - found
-- Looking for log10f
-- Looking for log10f - found
-- Looking for lround
-- Looking for lround - found
-- Looking for lroundf
-- Looking for lroundf - found
-- Looking for pow
-- Looking for pow - found
-- Looking for powf
-- Looking for powf - found
-- Looking for round
-- Looking for round - found
-- Looking for roundf
-- Looking for roundf - found
-- Looking for scalbn
-- Looking for scalbn - found
-- Looking for scalbnf
-- Looking for scalbnf - found
-- Looking for sin
-- Looking for sin - found
-- Looking for sinf
-- Looking for sinf - found
-- Looking for sqrt
-- Looking for sqrt - found
-- Looking for sqrtf
-- Looking for sqrtf - found
-- Looking for tan
-- Looking for tan - found
-- Looking for tanf
-- Looking for tanf - found
-- Looking for acos
-- Looking for acos - found
-- Looking for acosf
-- Looking for acosf - found
-- Looking for asin
-- Looking for asin - found
-- Looking for asinf
-- Looking for asinf - found
-- Looking for trunc
-- Looking for trunc - found
-- Looking for truncf
-- Looking for truncf - found
-- Looking for iconv_open in iconv
-- Looking for iconv_open in iconv - found
-- Performing Test HAVE_SA_SIGACTION
-- Performing Test HAVE_SA_SIGACTION - Success
-- Looking for dlopen
-- Looking for dlopen - found
-- Performing Test HAVE_O_CLOEXEC
-- Performing Test HAVE_O_CLOEXEC - Success
-- Performing Test HAVE_FRAMEWORK_GAMECONTROLLER
-- Performing Test HAVE_FRAMEWORK_GAMECONTROLLER - Success
-- Performing Test HAVE_FRAMEWORK_COREHAPTICS
-- Performing Test HAVE_FRAMEWORK_COREHAPTICS - Success
-- Performing Test HAVE_FRAMEWORK_METAL
-- Performing Test HAVE_FRAMEWORK_METAL - Success
-- Performing Test HAVE_PTHREADS
-- Performing Test HAVE_PTHREADS - Success
-- Performing Test HAVE_RECURSIVE_MUTEXES
-- Performing Test HAVE_RECURSIVE_MUTEXES - Success
-- Performing Test HAVE_PTHREADS_SEM
-- Performing Test HAVE_PTHREADS_SEM - Success
-- Performing Test HAVE_SEM_TIMEDWAIT
-- Performing Test HAVE_SEM_TIMEDWAIT - Failed
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for include file pthread_np.h
-- Looking for include file pthread_np.h - not found
-- Performing Test HAVE_PTHREAD_SETNAME_NP
-- Performing Test HAVE_PTHREAD_SETNAME_NP - Success
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-146)")
CMake Deprecation Warning at submodules/SDL_official/CMakeLists.txt:3172 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

--
-- SDL2 was configured with the following options:
--
-- Platform: Darwin-23.3.0
-- 64-bit:   TRUE
-- Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Revision: SDL-release-2.28.0-55-ge8b6edd5a
--
-- Subsystems:
--   Atomic:    ON
--   Audio: ON
--   Video: ON
--   Render:    ON
--   Events:    ON
--   Joystick:  ON
--   Haptic:    ON
--   Hidapi:    ON
--   Power: ON
--   Threads:   ON
--   Timers:    ON
--   File:  ON
--   Loadso:    ON
--   CPUinfo:   ON
--   Filesystem:    ON
--   Sensor:    ON
--   Locale:    ON
--   Misc:  ON
--
-- Options:
--   SDL2_DISABLE_INSTALL        (Wanted: ON): OFF
--   SDL2_DISABLE_SDL2MAIN       (Wanted: OFF): OFF
--   SDL2_DISABLE_UNINSTALL      (Wanted: OFF): OFF
--   SDL_3DNOW                   (Wanted: OFF): OFF
--   SDL_ALSA                    (Wanted: OFF): OFF
--   SDL_ALSA_SHARED             (Wanted: OFF): OFF
--   SDL_ALTIVEC                 (Wanted: ON): OFF
--   SDL_ARMNEON                 (Wanted: OFF): OFF
--   SDL_ARMSIMD                 (Wanted: OFF): OFF
--   SDL_ARTS                    (Wanted: OFF): OFF
--   SDL_ARTS_SHARED             (Wanted: OFF): OFF
--   SDL_ASAN                    (Wanted: OFF): OFF
--   SDL_ASSEMBLY                (Wanted: ON): ON
--   SDL_ASSERTIONS              (Wanted: auto): auto
--   SDL_BACKGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_CCACHE                  (Wanted: ON): OFF
--   SDL_CLOCK_GETTIME           (Wanted: OFF): OFF
--   SDL_COCOA                   (Wanted: ON): ON
--   SDL_DBUS                    (Wanted: OFF): OFF
--   SDL_DIRECTFB                (Wanted: OFF): OFF
--   SDL_DIRECTFB_SHARED         (Wanted: OFF): OFF
--   SDL_DIRECTX                 (Wanted: OFF): OFF
--   SDL_DISKAUDIO               (Wanted: ON): ON
--   SDL_DUMMYAUDIO              (Wanted: ON): ON
--   SDL_DUMMYVIDEO              (Wanted: ON): ON
--   SDL_ESD                     (Wanted: OFF): OFF
--   SDL_ESD_SHARED              (Wanted: OFF): OFF
--   SDL_FOREGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_FUSIONSOUND             (Wanted: OFF): OFF
--   SDL_FUSIONSOUND_SHARED      (Wanted: OFF): OFF
--   SDL_GCC_ATOMICS             (Wanted: ON): ON
--   SDL_HIDAPI                  (Wanted: ON): ON
--   SDL_HIDAPI_JOYSTICK         (Wanted: ON): ON
--   SDL_HIDAPI_LIBUSB           (Wanted: OFF): OFF
--   SDL_IBUS                    (Wanted: OFF): OFF
--   SDL_INSTALL_TESTS           (Wanted: OFF): OFF
--   SDL_JACK                    (Wanted: OFF): OFF
--   SDL_JACK_SHARED             (Wanted: OFF): OFF
--   SDL_KMSDRM                  (Wanted: OFF): OFF
--   SDL_KMSDRM_SHARED           (Wanted: OFF): OFF
--   SDL_LASX                    (Wanted: OFF): OFF
--   SDL_LIBC                    (Wanted: ON): ON
--   SDL_LIBSAMPLERATE           (Wanted: OFF): OFF
--   SDL_LIBSAMPLERATE_SHARED    (Wanted: OFF): OFF
--   SDL_LIBUDEV                 (Wanted: ON): OFF
--   SDL_LSX                     (Wanted: OFF): OFF
--   SDL_METAL                   (Wanted: ON): ON
--   SDL_MMX                     (Wanted: OFF): OFF
--   SDL_NAS                     (Wanted: OFF): OFF
--   SDL_NAS_SHARED              (Wanted: OFF): OFF
--   SDL_OFFSCREEN               (Wanted: ON): ON
--   SDL_OPENGL                  (Wanted: ON): ON
--   SDL_OPENGLES                (Wanted: ON): ON
--   SDL_OSS                     (Wanted: OFF): OFF
--   SDL_PIPEWIRE                (Wanted: OFF): OFF
--   SDL_PIPEWIRE_SHARED         (Wanted: OFF): OFF
--   SDL_PTHREADS                (Wanted: ON): ON
--   SDL_PTHREADS_SEM            (Wanted: ON): ON
--   SDL_PULSEAUDIO              (Wanted: OFF): OFF
--   SDL_PULSEAUDIO_SHARED       (Wanted: OFF): OFF
--   SDL_RENDER_D3D              (Wanted: OFF): OFF
--   SDL_RENDER_METAL            (Wanted: ON): ON
--   SDL_RPATH                   (Wanted: OFF): OFF
--   SDL_RPI                     (Wanted: OFF): OFF
--   SDL_SNDIO                   (Wanted: OFF): OFF
--   SDL_SNDIO_SHARED            (Wanted: OFF): OFF
--   SDL_SSE                     (Wanted: OFF): OFF
--   SDL_SSE2                    (Wanted: OFF): OFF
--   SDL_SSE3                    (Wanted: OFF): OFF
--   SDL_SSEMATH                 (Wanted: OFF): OFF
--   SDL_STATIC_PIC              (Wanted: OFF): OFF
--   SDL_SYSTEM_ICONV            (Wanted: ON): ON
--   SDL_TESTS                   (Wanted: OFF): OFF
--   SDL_VENDOR_INFO             (Wanted: ): OFF
--   SDL_VIRTUAL_JOYSTICK        (Wanted: ON): ON
--   SDL_VIVANTE                 (Wanted: OFF): OFF
--   SDL_VULKAN                  (Wanted: ON): ON
--   SDL_WASAPI                  (Wanted: OFF): OFF
--   SDL_WAYLAND                 (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR        (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR_SHARED (Wanted: OFF): OFF
--   SDL_WAYLAND_QT_TOUCH        (Wanted: OFF): OFF
--   SDL_WAYLAND_SHARED          (Wanted: OFF): OFF
--   SDL_X11                     (Wanted: OFF): OFF
--   SDL_X11_SHARED              (Wanted: OFF): OFF
--   SDL_X11_XCURSOR             (Wanted: OFF): OFF
--   SDL_X11_XDBE                (Wanted: OFF): OFF
--   SDL_X11_XFIXES              (Wanted: OFF): OFF
--   SDL_X11_XINPUT              (Wanted: OFF): OFF
--   SDL_X11_XRANDR              (Wanted: OFF): OFF
--   SDL_X11_XSCRNSAVER          (Wanted: OFF): OFF
--   SDL_X11_XSHAPE              (Wanted: OFF): OFF
--   SDL_XINPUT                  (Wanted: OFF): OFF
--
--  CFLAGS:         -idirafter "/Users/alan/Development/tom-seddon/b2/submodules/SDL_official/src/video/khronos"
--  EXTRA_CFLAGS:   -Wall -fno-strict-aliasing -Wdeclaration-after-statement -fvisibility=hidden -Wshadow -Wno-unused-local-typedefs -D_THREAD_SAFE
--  EXTRA_LDFLAGS: -Wl,-framework,CoreVideo;-Wl,-framework,Cocoa;-Wl,-framework,IOKit;-Wl,-framework,ForceFeedback;-Wl,-framework,Carbon;-Wl,-framework,CoreAudio;-Wl,-framework,AudioToolbox;-Wl,-framework,AVFoundation;-Wl,-framework,Foundation;-Wl,-weak_framework,GameController;-Wl,-weak_framework,Metal;-Wl,-weak_framework,QuartzCore;-Wl,-weak_framework,CoreHaptics -Wl,-compatibility_version,2901.0.0;-Wl,-current_version,2901.0.0
--  EXTRA_LIBS:    m;iconv
--
--  Build Shared Library: OFF
--  Build Static Library: ON
--  Build Static Library with Position Independent Code: OFF
--
-- If something was not detected, although the libraries
-- were installed, then make sure you have set the
-- CFLAGS and LDFLAGS environment variables correctly.
--
-- Performing Test HAVE_SDL_SOFTSTRETCHLINEAR
-- Performing Test HAVE_SDL_SOFTSTRETCHLINEAR - Failed
-- SDL_SoftStretchLinear exists: ``''
-- Checking for modules 'libavcodec;libavformat;libavutil;libswresample;libswscale'
--   No package 'libavcodec' found
--   No package 'libavformat' found
--   No package 'libavutil' found
--   No package 'libswresample' found
--   No package 'libswscale' found
CMake Warning at CMakeLists.txt:284 (message):
  Unsupported libavcodec major version - need 58

CMake Warning at CMakeLists.txt:289 (message):
  Unsupported libavformat major version - need 58

CMake Warning at CMakeLists.txt:294 (message):
  Unsupported libavutil major version - need 56

CMake Warning at CMakeLists.txt:299 (message):
  Unsupported libswreasmple major version - need 3

CMake Warning at CMakeLists.txt:304 (message):
  Unsupported libswscale major version - need 5

CMake Warning at CMakeLists.txt:314 (message):
  FFmpeg 4 required specifically - video writing not available

CMake Error at CMakeLists.txt:335 (add_subdirectory):
  The source directory

    /Users/alan/Development/tom-seddon/b2/submodules/libuv

  does not contain a CMakeLists.txt file.

CMake Error at submodules/CMakeLists.txt:156 (add_subdirectory):
  The source directory

    /Users/alan/Development/tom-seddon/b2/submodules/macdylibbundler

  does not contain a CMakeLists.txt file.

CMake Deprecation Warning at src/6502/t/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at src/shared/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Deprecation Warning at src/shared/t/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks/OpenGL.framework
-- Configuring incomplete, errors occurred!
make: *** [init_xcode] Error 1
tom-seddon commented 6 months ago

Did you clone with --recursive, or do git submodule init/git submodule update after cloning? If not, the git invocations to use are here: https://github.com/tom-seddon/b2/blob/master/doc/Building.md. That's the usual cause of empty submodules folders:

CMake Error at CMakeLists.txt:335 (add_subdirectory):
  The source directory

    /Users/alan/Development/tom-seddon/b2/submodules/libuv

  does not contain a CMakeLists.txt file.

(If you did: something's gone wrong! But I'm not sure what...)

Something that page doesn't mention is that you also need to do git submodule update after switching branches. A note about this will make its way to the main branch eventually.

tom-seddon commented 6 months ago

BTW, while looking at the cmake output: I also have a longstanding issue about how b2 should support more than just one (now outdated) version of the ffmpeg libs: https://github.com/tom-seddon/b2/issues/209 - from memory, the API changed just enough to be annoying

popey commented 6 months ago

I did, yes, but it barfed part way through with some kind of network error (there's a lot to clone! :D ). I thought I fixed that, but clearly not, I guess. Sorry for the noise. I just checked and the submodules/libuv is empty. I did indeed previously do as you suggested in the Building.md (submodule init and update), and there was no output, so I assumed all was good.

I've moved that folder aside and re-cloned. Now it's progressing better. Thanks!


-- Configuring done (324.7s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/alan/Development/b2/build/Xcode
tom-seddon commented 6 months ago

Thanks - I'll add a note about that to the readme as well. (I'd have assumed one of the commands would have noticed the problem, but... clearly not. I've found git submodules to work fairly well, but there do seem to be a lot of rather opaque failure modes. Which are probably all fixable, but I've always gone for the re-clone option!)

popey commented 6 months ago

Sorry, I appear to be too dense to operate macOS :D

I get this when I try to Product -> Build it.

Screenshot 2024-03-17 at 19 51 08
tom-seddon commented 6 months ago

It's very likely this will be something to do with using the very latest Xcode/clang - I can't upgrade to this, as I'm stuck a few versions behind due to my outdated 9 year old Macbook Pro.

A build log would be useful, if you can get one? - though I'm not sure offhand how you do that on Xcode. I'll try to figure this out on my Mac now, which will also serve as a quick test that wip/master is genuinely building as intended same as on Windows...

popey commented 6 months ago

Hopefully this is the log you need? Build test_VIA_I1_BTape_2024-03-17T17-38-30.txt

tom-seddon commented 6 months ago

It is, thanks! I've tried this now in macOS and it built ok locally. Have you done a git submodule update after switching branch to wip/master? If not, that should hopefully fix it. (There's nothing currently about this in the docs, but I've added a note which will make its way into the master branch eventually. Apologies, I've been using git submodules for years now, so all the ways in which they don't actually work very well are second nature at this point. I forgot about this particular annoyance.)

If you did, try doing git submodule update --force - which should hopefully prod git into redoing the update.

The error log refers to ImGuiKey being defined on line 176 of imgui.h, but for the submodule revision in wip/master, it should be defined on line 179 (and it's a C++ typed enum, so there should be no issue): https://github.com/tom-seddon/imgui/blob/8add6bcb9f5752d53f55f2bfc959238500bc0390/imgui.h#L179

Line 176 is expected for the submodule revision in master (and it is indeed there a simple typedef for an int): https://github.com/tom-seddon/imgui/blob/23a38ac33ba99c0935018af942b924da587631b4/imgui.h#L176

popey commented 6 months ago

You are right, my mistake. It builds! Build b2_2024-03-17T20-50-45.txt

image

tom-seddon commented 6 months ago

Excellent, looking good. I suspect the 1705.421x speed indicator is not right - that should be impossible! Does the emulated BBC seem to be running at roughly 1x real speed? If it is, I'll add a GitHub issue for fixing the readout, and then try to figure out how to generate a multi-architecture binary!

popey commented 6 months ago

Yes, I did a side-by-side comparison of a simple BASIC for loop to 1000, with my Linux desktop (which reports [0.992x] and they finished at the same time.

Also, if you happen to get it building in :star2: the cloud :star2: I'd be happy to test it on my Mac here too.

tom-seddon commented 6 months ago

Lovely, thank you. Bit mystified why the readout is wrong even though the speed is correct, but I'll get to it eventually...

I'll try to get this sorted out this week. My old Xcode is still new enough to build a universal binary so hopefully most of the build fiddling can be done locally.

tom-seddon commented 6 months ago

(I'll be posting my findings as I go.)

Regarding CI, it seems AppVeyor only has x64 macOS agents, but you can cross-compile for Apple Silicon on x64, so this is no barrier in principle.

Producing a macOS universal binary means all the dependencies have to be universal binaries too. b2 mostly builds its own dependencies on macOS, so mostly no problem here. But I've found a couple of exceptions so far.

Firstly, libcurl: source supplied in the repo so the Windows version can build it, but for macOS it tries to link with the system copy. I'd assumed this would find the appropriate copy that comes with macOS, but actually it will find the MacPorts version by preference - which I only realised when it failed to link the arm64 build with MacPorts's x64 libcurl. So I had to fix this to ignore MacPorts folders when looking for libcurl.

(I could get MacPorts to install universal libcurl, but I think I'd rather have b2 link with the system copy.)

Next, ffmpeg: this has always been a bit untidy on macOS, because ffmpeg is only a temporary measure until I sort out some code that can write videos using AVFoundation. But in theory I can install universal ffmpeg with MacPorts, and it will work... probably? So I set MacPorts doing this a while ago, but it's still not finished. Current status: compiling Python, from scratch I assume, on my 9 year old dual core laptop. To be continued.

tom-seddon commented 6 months ago

This probably means getting a universal ffmpeg on the CI system is going to be an issue. Homebrew (preinstalled on the AppVeyor agents) doesn't suport universal binaries; I could install MacPorts, but if it's going to spend hours compiling literally everything then I'm not sure I'm keen. As well as making iteration painful, it's a little rude to AppVeyor.

The CI setup already produces a 10.9-friendly build, that doesn't link with ffmpeg (from memory, Homebrew's ffmpeg only works on 11.0 or better) - I could make it do an Apple Silicon-friendly version along the same lines. This would mean a 3rd build I assume as Apple Silicon means targeting 11.0 or better. I'm not keen on this either, but in theory it's only a temporary measure, and once I get the AVFoundation code done then the dependency on ffmpeg disappears and it can all work a bit more nicely. (Apple Silicon users always have the option of running the x64 version under Rosetta if they're desparate.)

popey commented 6 months ago

Have you considered GitHub actions as an alternative to AppVeyor?

They have native M1 runners.

https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

tom-seddon commented 6 months ago

(I didn't get any time for this last week)

Have you considered GitHub actions as an alternative to AppVeyor?

I'd previously looked at this, I think when the Travis CI dropped their free tier and I had to rethink the CI setup. The monthly minute limits gave me pause at the time, and I didn't investigate because it was easier to just move to AppVeyor. Because of a long story, I was already using that for one of the platforms.

But, seems the time limits don't actually apply to free repos! (https://github.com/orgs/community/discussions/70492) So, ok, this sounds like it would be worth doing... looks like the Mac VMs have Homebrew, and the Linux VMs are Ubuntu 22, same as AppVeyor.

tom-seddon commented 6 months ago

I've added an issue about moving the CI setup to GitHub Actions: https://github.com/tom-seddon/b2/issues/325

egrath commented 5 months ago

I can also confirm that the wip/master branch builds with Xcode 15.3 into native arm64. I used the following steps:

git clone --recursive https://github.com/tom-seddon/b2.git
cd b2
git branch wip/master
git submodule update --force
make init_osx
cd build/Xcode
xcodebuild -scheme b2 -configuration Final

which results in a working src/b2/Final/b2.app. However, there seems to be some issues:

  1. The message window in the middle of the window does not disappear. Even when you clear the messages, a empty frame is visible:

image

After clearing the messages: (note the small frame in the middle of the screen):

image

  1. The shown speed in the title bar is wrong and maxes out to the maximum your machine can archieve, even though the emulated machine runs at the correct speed (tested with ClockSP5)
tom-seddon commented 5 months ago

I've pushed a fix to the wip/master branch that will hopefully fix the time-related problems when building for Apple Silicon.

tom-seddon commented 2 months ago

Additional success report: https://www.stardot.org.uk/forums/viewtopic.php?p=430056#p430056

Also some perf figures for running under Rosetta, which sound good enough to be getting on with (pending a fix for https://github.com/tom-seddon/b2/issues/325).