yujitach / MenuMeters

my fork of MenuMeters by http://www.ragingmenace.com/software/menumeters/
GNU General Public License v2.0
3.02k stars 223 forks source link

2.1.6 broke build on macOS <= 10.15 #271

Closed Tatsh closed 3 years ago

Tatsh commented 3 years ago

https://trac.macports.org/ticket/63969

:info:destroot work/yujitach-MenuMeters-81dfe10/PrefPane/MenuMetersPref.m:173:15: error: property 'toolbarStyle' not found on object of type 'NSWindow *'
:info:destroot                 self.window.toolbarStyle = NSWindowToolbarStylePreference;
:info:destroot                             ^
:info:destroot work/yujitach-MenuMeters-81dfe10/PrefPane/MenuMetersPref.m:173:30: error: use of undeclared identifier 'NSWindowToolbarStylePreference'
:info:destroot                 self.window.toolbarStyle = NSWindowToolbarStylePreference;
:info:destroot                                            ^
:info:destroot work/yujitach-MenuMeters-81dfe10/PrefPane/MenuMetersPref.m:207:25: error: no known class method for selector 'imageWithSystemSymbolName:accessibilityDescription:'
:info:destroot                 item.image = [NSImage imageWithSystemSymbolName:itemIdent accessibilityDescription:@""];
:info:destroot                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:destroot 3 errors generated.

Are the @available() usages correct for these? Full log of build on 10.14: https://build.macports.org/builders/ports-10.14_x86_64-builder/builds/106094/steps/install-port/logs/stdio

yujitach commented 3 years ago

They are all guarded by @available(macOS 10.16,*), see https://github.com/yujitach/MenuMeters/blob/9107aa9ba589d67af5ed18b36bbd1301c044f490/PrefPane/MenuMetersPref.m#L169-L179 and https://github.com/yujitach/MenuMeters/blob/9107aa9ba589d67af5ed18b36bbd1301c044f490/PrefPane/MenuMetersPref.m#L206-L208 .

There are many other @available clauses for 10.15, 11, etc, so I don't understand why they cause failures on a 10.14 bot.

Tatsh commented 3 years ago

I think it's because when this builds against an old SDK, the method is non-existent so it makes sense for the compiler to complain. The @available stuff is for runtime but must be built on an SDK that is at least the highest version specified in all @available clauses in the project. So now the project requires at least SDK 10.16/11 to build.

Would you consider using compile-time macros instead? e.g.:

#if (__MAC_OS_X_VERSION_MAX_ALLOWED < 101600)

The code already has some of these, such as the #ifdef ELCAPITAN usages.

yujitach commented 3 years ago

The code when compiled on the latest OS is confirmed to run on Sierra (as a certain user wrote to me a couple of days ago.) Could you instead use a bot running a more recent macOS?

Tatsh commented 3 years ago

The binaries that MacPorts distributes to users get built on bots that mirror the users' own machines: macOS version + matching Xcode version + matching SDK version. Only the 10.14 bots with this set up produce the binaries for 10.14 users.

yujitach commented 3 years ago

I see. I'm happy to merge a pull request if you prepare one. I can't guarantee that I always combine @available and #if (__MAC_OS_X_VERSION_MAX_ALLOWED) correctly, given my limited time to maintain this.

Tatsh commented 3 years ago

Okay. I will try to get that to you soon.