macOS - SVN 833/4: Fatal Compiler errors with latest Xcode

Linux geeks and Mac OS hipsters unite! A board for discussion of Supermodel on non-Windows platforms.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

macOS - SVN 833/4: Fatal Compiler errors with latest Xcode

Postby TheOldDragon » Tue Dec 01, 2020 6:40 am

Just tried buidiing SVN 833 from source on macOS Catalina [x86-64, 10.15.6] and received the following fatal compiler error:

Code: Select all
Compiling              : Src/CPU/68K/Musashi/m68kcpu.c -> obj/m68kcpu.o
In file included from Src/CPU/68K/Musashi/m68kcpu.c:70:
Src/CPU/68K/Musashi/m68kcpu.h:1902:11: error: implicit declaration of function 'M68KIRQCallback' is
      invalid in C99 [-Werror,-Wimplicit-function-declaration]
        vector = m68ki_int_ack(int_level);
                 ^
Src/CPU/68K/Musashi/m68kcpu.h:449:28: note: expanded from macro 'm68ki_int_ack'
                #define m68ki_int_ack(A) M68K_INT_ACK_CALLBACK(A)
                                         ^
Src/CPU/68K/Musashi/m68kconf.h:100:37: note: expanded from macro 'M68K_INT_ACK_CALLBACK'
#define M68K_INT_ACK_CALLBACK(A)    M68KIRQCallback(A)
                                    ^
1 error generated.
make: *** [obj/m68kcpu.o] Error 1


I'm using Makefile.OSX
Compiler info:
Code: Select all
% cc --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


Update:
Just tried it on a different Mac, that has an older version of clang [xxx.0.32.2 vs xxx.0.32.27] [and Catalina 10.15.5]
I was able to build and run Supermodel on this machine successfully, so looks like the errors are only showing up on the very latest versions of Apple's build tools...

Code: Select all
cc --version
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Last edited by TheOldDragon on Thu Dec 03, 2020 10:10 pm, edited 3 times in total.
TheOldDragon
 
Posts: 62
Joined: Sat May 30, 2020 5:39 am

Re: macOS - SVN 833 - Fatal Compiler errors with latest Appl

Postby TheOldDragon » Thu Dec 03, 2020 9:56 pm

UPDATE: I was able to avoid the problem by declaring the "m68ki_int_ack()" function early in "m68kcpu.h"

i.e. I added the following to line 81 of "Src/CPU/68K/Musashi/m68kcpu.h":
Code: Select all
uint m68ki_int_ack(uint);


This fixed the compiler errors and everything built cleanly on macOS 10.5.7 Catalina and 11.01 [Big Sur] on an x86-64 Mac.

I now have an "Apple Silicon" M1 Mac mini, and after getting the latest SDL2 framework to build ARM64 native from source, I was able to get an ARM64 native version of Supermodel building and running too.. :D :D .
It runs really nicely...the CPU is crazy fast. Even the x86-64 version under Rosetta 2 was running > 60 fps in-game @1080p in Scud Race Plus.

Note: I have to use -legacy3d to get graphics display properly on both x86-64 and ARM64; otherwise it has display issues and/or crashes, but that's the same on some Linux's too...
Code: Select all
% ./supermodel-svn-834-m1 ./Roms/scudplus.zip -print-gl-info                                  Supermodel: A Sega Model 3 Arcade Emulator (Version 0.3a-WIP)
Copyright 2011-2020 by Bart Trzynadlowski, Nik Henson, Ian Curtis,
                       Harry Tuttle, and Spindizzi

OpenGL information:

  Vendor                   : Apple
  Renderer                 : Apple M1
  Version                  : 2.1 Metal - 70.12.7
  Shading Language Version : 1.20
  Maximum Vertex Array Size: 1048575 vertices
  Maximum Texture Size     : 16384 texels
  Maximum Vertex Attributes: 16
  Maximum Vertex Uniforms  : 4096
  Maximum Texture Img Units: 16
Last edited by TheOldDragon on Sat Dec 05, 2020 9:36 am, edited 1 time in total.
TheOldDragon
 
Posts: 62
Joined: Sat May 30, 2020 5:39 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby Ian » Fri Dec 04, 2020 11:34 am

What issues do you get with the new renderer?

>Src/CPU/68K/Musashi/m68kcpu.h:1902:11: error: implicit declaration of function 'M68KIRQCallback' is

This should be fixed in the actual source. It spits out a warning with my compiler.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby TheOldDragon » Fri Dec 04, 2020 4:28 pm

Ian wrote:What issues do you get with the new renderer?

>Src/CPU/68K/Musashi/m68kcpu.h:1902:11: error: implicit declaration of function 'M68KIRQCallback' is

This should be fixed in the actual source. It spits out a warning with my compiler.

For the implicit declaration, the code gave compiler warnings on macOS/Xcode up through 10.15.5, but compiler errors with 10.15.6 and beyond [clang versions in my original post].
The Musahi code in Supermodel looks like it's derived from v 3.3 - the github repository for Musahi is at v4.6...
[As a test, I switched out the Mushai folder with the latest GitHub code, and it did not have this specific error, but no idea what other issues it would bring, so I didn't pursue it further once I came up with the minor fix above...].

For new renderer, it outputs errors at game startup, and the game graphics are broken / incomplete, and sometimes crashes [segmentation fault].
See attached image and code below output below ro an example.
I have seen similar broken graphics when running Supermodel on various Linux distros / GPU combinations...

Code: Select all
% ./supermodel-svn-834 ./Roms/scudplus.zip -show-fps -res=1280,720 -wide-screen         
Supermodel: A Sega Model 3 Arcade Emulator (Version 0.3a-WIP)
Copyright 2011-2020 by Bart Trzynadlowski, Nik Henson, Ian Curtis,
                       Harry Tuttle, and Spindizzi

    Title:          Scud Race Plus (Revision A)
    ROM Set:        scudplus
    Developer:      Sega
    Year:           1997
    Stepping:       1.5
    Extra Hardware: Digital Sound Board (Type DSB1), Drive Board, Net Board

ERROR: 0:110: Invalid call of undeclared identifier 'texture2DLod'
ERROR: 0:111: Invalid call of undeclared identifier 'texture2DLod'
ERROR: 0:112: Invalid call of undeclared identifier 'texture2DLod'
ERROR: 0:113: Invalid call of undeclared identifier 'texture2DLod'
ERROR: 0:116: Use of undeclared identifier 'p0q0'
ERROR: 0:116: Use of undeclared identifier 'p1q0'
ERROR: 0:116: Use of undeclared identifier 'p1q0'
ERROR: 0:116: Use of undeclared identifier 'p0q0'
ERROR: 0:117: Use of undeclared identifier 'p0q0'
ERROR: 0:117: Use of undeclared identifier 'p0q1'
ERROR: 0:117: Use of undeclared identifier 'p0q1'
ERROR: 0:117: Use of undeclared identifier 'p0q0'
ERROR: 0:119: Use of undeclared identifier 'p1q0'
ERROR: 0:119: Use of undeclared identifier 'p0q0'
ERROR: 0:119: Use of undeclared identifier 'p0q0'
ERROR: 0:119: Use of undeclared identifier 'p1q0'
ERROR: 0:120: Use of undeclared identifier 'p1q0'
ERROR: 0:120: Use of undeclared identifier 'p1q1'
ERROR: 0:120: Use of undeclared identifier 'p1q1'
ERROR: 0:120: Use of undeclared identifier 'p1q0'
ERROR: 0:122: Use of undeclared identifier 'p0q1'
ERROR: 0:122: Use of undeclared identifier 'p0q0'
ERROR: 0:122: Use of undeclared identifier 'p0q0'
ERROR: 0:122: Use of undeclared identifier 'p0q1'
ERROR: 0:123: Use of undeclared identifier 'p0q1'
ERROR: 0:123: Use of undeclared identifier 'p1q1'
ERROR: 0:123: Use of undeclared identifier 'p1q1'
ERROR: 0:123: Use of undeclared identifier 'p0q1'
ERROR: 0:125: Use of undeclared identifier 'p1q1'
ERROR: 0:125: Use of undeclared identifier 'p0q1'
ERROR: 0:125: Use of undeclared identifier 'p0q1'
ERROR: 0:125: Use of undeclared identifier 'p1q1'
ERROR: 0:126: Use of undeclared identifier 'p1q1'
ERROR: 0:126: Use of undeclared identifier 'p1q0'
ERROR: 0:126: Use of undeclared identifier 'p1q0'
ERROR: 0:126: Use of undeclared identifier 'p1q1'
ERROR: 0:130: Use of undeclared identifier 'p0q0'
ERROR: 0:130: Use of undeclared identifier 'p1q0'
ERROR: 0:131: Use of undeclared identifier 'p0q1'
ERROR: 0:131: Use of undeclared identifier 'p1q1'
ERROR: 0:133: Use of undeclared identifier 'pInterp_q0'
ERROR: 0:133: Use of undeclared identifier 'pInterp_q1'

ERROR: One or more attached shaders not successfully compiled
Attachments
scud-race-new3d-macos.jpg
scud-race-new3d-macos.jpg (63.34 KiB) Viewed 570 times
TheOldDragon
 
Posts: 62
Joined: Sat May 30, 2020 5:39 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby Ian » Fri Dec 04, 2020 4:59 pm

I've seen this error a few times now and the answer is always the same. These drivers are missing functions which are a core part of the opengl spec.

Maybe we can find some sort of work around.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby Spindizzi » Sat Dec 05, 2020 2:17 am

my own experience, but nothing to do with apple machine, I know absolutly nothing about them :/

I also got these errors on an old computer, I was totally unable to launch Supermodel on it unless I use legacy3d engine (driver ? opengl version ? hardware limited ?)
Same on my linux vm due to the emulated graphic card inside the vm
but there is a little workaround for this one:

edit in Src\Graphics\New3D\R3DShaderTriangles.h
line 6
and line 64
#version 120 to #version 140
and line 171-174
change texture2DLod to textureLod

not sure if it will help on apple machine...

and please, do not update Musashi code in Supermodel
Bart and I, have looked at this months ago
sadly, it breaks totally the netboard, due to some changes in irq management
despite the patch was ready to commit, this is why I didn't post any changes about Musashi in Supermodel :(
this was not really interresting to update because the main changes concern fpu/mmu/68040/68030. In Supermodel only 68000 cpu is needed.
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby Ian » Sat Dec 05, 2020 7:33 am

The problem with apple is they don't support compatibility opengl contexts. In windows you just create an opengl context and you get opengl 4.6 support with all the legacy functions included. On apple in order to support gl3+ you have to create a core context window which will specifically have all the legacy stuff removed. This means in supermodel the 2d layers will stop working and the gun crosshairs without being updated.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby TheOldDragon » Sat Dec 05, 2020 8:44 am

Spindizzi wrote:my own experience, but nothing to do with apple machine, I know absolutly nothing about them :/

I also got these errors on an old computer, I was totally unable to launch Supermodel on it unless I use legacy3d engine (driver ? opengl version ? hardware limited ?)
Same on my linux vm due to the emulated graphic card inside the vm
but there is a little workaround for this one:

edit in Src\Graphics\New3D\R3DShaderTriangles.h
line 6
and line 64
#version 120 to #version 140
and line 171-174
change texture2DLod to textureLod

not sure if it will help on apple machine...


I made the changes.. On an Ice Lake MacBook Air it eliminates some of the errors on launch, but the graphical output is still broken; looks like the 1.40 OpenGL functionally is not supported in Apple's OpenGL implementation*.

Code: Select all
    Extra Hardware: Digital Sound Board (Type DSB1), Drive Board, Net Board

ERROR: 0:3: '' :  version '140' is not supported

ERROR: 0:3: '' :  version '140' is not supported

ERROR: One or more attached shaders not successfully compiled


Here's the output of -print-gl-info
Code: Select all
OpenGL information:

  Vendor                   : Intel Inc.
  Renderer                 : Intel(R) Iris(TM) Plus Graphics OpenGL Engine
  Version                  : 2.1 INTEL-16.0.49
  Shading Language Version : 1.20
  Maximum Vertex Array Size: 1048575 vertices
  Maximum Texture Size     : 16384 texels
  Maximum Vertex Attributes: 16
  Maximum Vertex Uniforms  : 4096
  Maximum Texture Img Units: 16


*Apple's out of date OpenGL implementation is notorious; they deprecated it in favor of Metal years ago... For cross platform applications targeting macOS, Vulkan is the way to go, as there's the open source MoltenVK [Vulkan->Metal translation] framework.

If it helps either / both of you, and can [over time] go back through my Linux machines and test with a combination of drivers / Mesa version / GPUs to see the results...
I have Ubuntu 20.04 and 20.10, some with development Mesa versions, and various GPUs ...
Last edited by TheOldDragon on Sat Dec 05, 2020 11:22 am, edited 3 times in total.
TheOldDragon
 
Posts: 62
Joined: Sat May 30, 2020 5:39 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby TheOldDragon » Sat Dec 05, 2020 8:50 am

Spindizzi wrote:and please, do not update Musashi code in Supermodel
Bart and I, have looked at this months ago
sadly, it breaks totally the netboard, due to some changes in irq management
despite the patch was ready to commit, this is why I didn't post any changes about Musashi in Supermodel :(
this was not really interresting to update because the main changes concern fpu/mmu/68040/68030. In Supermodel only 68000 cpu is needed.


Understood. I just tried it in tracking down the potential fix/work around.

The only change I needed to make was explicitly declaring the "m68ki_int_ack()" function early in "m68kcpu.h".

I added the following to line 81 of "Src/CPU/68K/Musashi/m68kcpu.h":
Code: Select all
uint m68ki_int_ack(uint);


Not sure if that's the best place for it?
Are you OK with someone making that update?
TheOldDragon
 
Posts: 62
Joined: Sat May 30, 2020 5:39 am

Re: macOS - SVN 833/4: Fatal Compiler errors with latest Xco

Postby cglev » Sat Dec 05, 2020 1:13 pm

Try changing the texture2DLod to texture2D ive had the same issue multiple times and textureLod didnt work for me but texture2D did
cglev
 
Posts: 7
Joined: Sat Sep 12, 2020 7:51 am

Next

Return to Alternative Fashion

Who is online

Users browsing this forum: No registered users and 1 guest

cron