kanjitalk755 / macemu

Basilisk II and SheepShaver Macintosh emulators
349 stars 53 forks source link

Build failures on ARM machines running Xcode 14-15 #189

Closed emendelson closed 9 months ago

emendelson commented 10 months ago

I can build current macemu code on an Intel Mac running Monterey and Xcode 14.2, but when I try to build the same code on Sonoma (on an ARM Mac), running Xcode 15.0.1, the SheepShaver build command-line fails with this error:

** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution Preprocess\ Info.plist /Users/edward/Desktop/macemu-master/SheepShaver/src/MacOSX/build/SheepShaver_Xcode8.build/Release/SheepShaver.build/Script-08CD3F3214B665E1009CA2A2.sh (in target 'SheepShaver' from project 'SheepShaver_Xcode8')
(1 failure)

And the BasiliskII command-line fails with this:

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/edward/Desktop/macemu-master/BasiliskII/src/MacOSX/build/uae_cpu_2021.build/Release/uae_cpu_arm64.build/Objects-normal/arm64/newcpu.o /Users/edward/Desktop/macemu-master/BasiliskII/src/uae_cpu_2021/newcpu.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'uae_cpu_arm64' from project 'uae_cpu_2021')
    CompileC /Users/edward/Desktop/macemu-master/BasiliskII/src/MacOSX/build/uae_cpu_2021.build/Release/uae_cpu_arm64.build/Objects-normal/arm64/fpu_mpfr.o /Users/edward/Desktop/macemu-master/BasiliskII/src/uae_cpu_2021/fpu/fpu_mpfr.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'uae_cpu_arm64' from project 'uae_cpu_2021')
(2 failures)
emendelson commented 10 months ago

The build also fails on an ARM system running Monterey with Xcode 14.0, though it succeeds on Intel/Monterey with 14.0

The build also fails under Xcode 14.3.1 under Ventura (ARM).

But it succeeds under Xcode 13.2.1 under Big Sur (ARM). I don't see the pattern here...

(I don't have an Intel machine that runs Ventura or Sonoma, unfortunately.)

kanjitalk755 commented 10 months ago

SheepShaver: Fixed.

BasiliskII: Didn't reproduced. Since the error is related to MPFR, re-install GMP and MPFR, then try again.

RonaldPR commented 9 months ago

I couldn't reproduce the build issue with BasiliskII either. Yesterday, before the fix for SheepShaver, BasiliskII build succeeded smoothly on my M1 iMac with macOS 14.1.2 and Xcode 15.0.1.

emendelson commented 9 months ago

You are right about BasiliskII; I reinstalled GMP and MPFR and built successfully.

But I still get this error with SheepShaver, using the current code, downloaded via Git:

warning: Run script build phase 'Preprocess Info.plist' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'SheepShaver' from project 'SheepShaver_Xcode8')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'SheepShaver' from project 'SheepShaver_Xcode8')
** BUILD FAILED **

The following build commands failed:
    CompileC /Users/edward/Library/CloudStorage/Dropbox/macemu/SheepShaver/src/MacOSX/build/SheepShaver_Xcode8.build/Release/kpx_cpu.build/Objects-normal/arm64/sheepshaver_glue.o /Users/edward/Library/CloudStorage/Dropbox/macemu/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'kpx_cpu' from project 'SheepShaver_Xcode8')
(1 failure)

I must be doing something wrong, but I can't guess what it is. Sonoma 14.1.2, ARM Mac, Xcode 15.0.1.

EDIT: When I try to build kpx_cpu in Xcode, I get this error:

/Library/Frameworks/SDL2.framework/Headers/SDL_events.h:31:10 'SDL2/SDL_stdinc.h' file not found

But I have SDL2 2.28.5 iinstalled in /Library/Frameworks: /Library/Frameworks/SDL2.framework/Versions/A/Headers/SDL_stdinc.h

RonaldPR commented 9 months ago

Building SheepShaver from the latest code also fails here:

The following build commands failed:
    CompileC /Users/ronald/Desktop/macemu-master/SheepShaver/src/MacOSX/build/SheepShaver_Xcode8.build/Release/kpx_cpu.build/Objects-normal/x86_64/sheepshaver_glue.o /Users/ronald/Desktop/macemu-master/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'kpx_cpu' from project 'SheepShaver_Xcode8')
(1 failure)

There was also this warning (related to the fix for hard cursor in full screen?)

/Users/ronald/Desktop/macemu-master/SheepShaver/src/Unix/sysdeps.h:307:9: warning: 
      implicit conversion loses integer precision: 'long' to 'int'
      [-Wshorten-64-to-32]
        return ret;
        ~~~~~~ ^~~

M1 iMac, macOS 14.1.2, Xcode 15.0.1, SDL2 2.28.5.

kanjitalk755 commented 9 months ago

Fixed.

emendelson commented 9 months ago

Yes. Thank you!!

EdoardoLaGreca commented 4 months ago

I get a similar error while compiling SheepShaver on MacOS 14.5 running on a MacBook Air M2. My Xcode version is 15.4.

The following build commands failed:
    CompileC /Users/edo/vm/emu/macemu/SheepShaver/src/MacOSX/build/SheepShaver_Xcode8.build/Release/kpx_cpu.build/Objects-normal/x86_64/sheepshaver_glue.o /Users/edo/vm/emu/macemu/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'kpx_cpu' from project 'SheepShaver_Xcode8')
(1 failure)
kanjitalk755 commented 4 months ago

The OS and Xcode versions are the same, but doesn't reproduced.

EdoardoLaGreca commented 4 months ago

I removed the cloned repo, cloned it again, installed sdl2 (also gmp and mpfr, just in case) from Homebrew. I noticed that the error is still there when I run xcodebuild, so I investigated further and I noticed the following error:

/Users/edo/vm/emu/macemu/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp:50:10: fatal error: 
      'SDL_events.h' file not found
#include <SDL_events.h>
         ^~~~~~~~~~~~~~
16 warnings and 1 error generated.

I checked the files installed with the package sdl2 (command: brew ls sdl2). SDL_events.h has been installed, but it was installed in /opt/homebrew/Cellar/sdl2/2.30.3/include/SDL2/.

My guess is that Xcode does not search for include files in that path, so it should be added in the Xcode project. Could you please add it?

RonaldPR commented 4 months ago

Do not use homebrew to install needed additional files. Use the instruction provided by kanjitalk755 here.

Also gmp and mpfr (needed for BasiliskII, not for SheepShaver) will not work correctly when installed through homebrew.

SDL2.framework should be installed in /Library/Frameworks/

SDL2-2.30.3.dmg kan be downloaded from https://github.com/libsdl-org/SDL/releases/tag/release-2.30.3