B2 won't build on Mac

discuss bbc micro and electron emulators (including mame) here!
Post Reply
User avatar
maniacminer
Posts: 1279
Joined: Thu Sep 21, 2017 2:59 am
Location: Cambridge / Singapore
Contact:

B2 won't build on Mac

Post by maniacminer »

I was trying to get B2 to build on an Apple Silicon M3 and I get a strange pile of errors, mainly to do with compiler rules:

Code: Select all

mac/hid.c:163:23: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
        struct input_report *rpt = dev->input_reports;
                              ^
        
How do I turn this off? My other Macs build this without error and I haven't changed anything apart from upgrading to MacOS Sonoma 14.2.
Big Model B Econet,Master 512,Electron,A3000,A540,Atom,Unilab 3-Chip Plus,6502,Z80,65C816,80186,32016,Matchbox,ARM7TDMI,Master 10/100,PiCoPro,Teletext,Music500,PiSCSI,Challenger3,Gotek,VideoNuLA,GoSDC,GoMMC,Integra-B,RGB2HDMIv4,Epson LQ-850 (for the win!)
User avatar
Diminished
Posts: 1235
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: B2 won't build on Mac

Post by Diminished »

Looks like you need to pass -Wno-declaration-after-statement to the compiler somehow. I'm not sure how b2's build system works, but the CFLAGS environment variable is usually one way this can be done. If you're using Xcode, it'll be a project setting for the target somewhere.
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: B2 won't build on Mac

Post by Rich Talbot-Watkins »

Seems more that the problem is that C99 needs to be enabled. I assume this is a third-party library.
tom_seddon
Posts: 889
Joined: Tue Aug 30, 2005 12:42 am
Contact:

Re: B2 won't build on Mac

Post by tom_seddon »

It looks like this is some new warning introduced in recent versions of clang. But I don't understand why/how -Werror is switched on! Neither b2 nor SDL (which is the problem library here) build with -Werror. I don't really know how to use Xcode in any detail, but I think this is controlled here:

1. View > Navigators > Project
2. Click "b2" in the left hand tree view thingy
3. Go to the Build Settings bit
4. Search for "errors" using the search thingy

What's the value you get for "Treat Warnings as Errors"? If it's set to Yes, let me know, though I'm not sure yet how to get cmake to switch this off by default! You could try tweaking it and seeing if that helps.

Apologies for this not working; my Mac is too old for the latest macOS, so I don't have any good way of testing this configuration. This suggests I should at least try to set the CI system up to build with a newer version.

--Tom
Post Reply

Return to “8-bit acorn emulators”