joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.66k stars 377 forks source link

How to build on mac? #1023

Open mnoga23 opened 5 years ago

mnoga23 commented 5 years ago

How do you guys build it on a mac? Running ./build-macosx just stops abrubtly:

menu_osx.mm:508:17: error: no viable conversion from 'id' to 'NSPoint' (aka 'CGPoint') NSPoint pt = [wnd convertPointToScreen:NSMakePoint(rct.size.width / 2, rct.size.height / 2)]; ^ ~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:20:1: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'id' to 'const CGPoint &' for 1st argument CGPoint { ^ /System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:20:1: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'id' to 'CGPoint &&' for 1st argument 1 warning and 1 error generated. make[3]: [menu_osx.o] Error 1 make[3]: Waiting for unfinished jobs.... make[2]: [all-recursive] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2

Tried High Sierra and Mojave builds with latest XCode.

joncampbell123 commented 5 years ago

That's odd.

The compiler should know that "wnd" is an NSWindow and the return value of convertPointToScreen is an NSPoint.

Are there any other error and/or warning messages before that?

https://github.com/joncampbell123/dosbox-x/blob/master/src/gui/menu_osx.mm#L508

joncampbell123 commented 5 years ago

The compiler in Mac OS X for some reason treats unknown types as an "id" apparently.

mnoga23 commented 5 years ago

Thanks for responding, there are some warnings before that. Full log here: https://pastebin.com/xnwhgq9s For some reason github errors on attachments for me.

joncampbell123 commented 5 years ago

The compiler is wrong,

https://developer.apple.com/documentation/appkit/nswindow/2967182-convertpointtoscreen?language=objc

menu_osx.mm:508:27: warning: instance method '-convertPointToScreen:' not found (return type defaults to 'id') [-Wobjc-method-access] NSPoint pt = [wnd convertPointToScreen:NSMakePoint(rct.size.width / 2, rct.size.height / 2)];

joncampbell123 commented 5 years ago

Unless XCode changed suddenly from a few months ago, that instance method should be valid.

I'll pull out the macbook tonight to see if I get the same error.

Perhaps if I ask OS X to update XCode I'll get the same error.

mnoga23 commented 5 years ago

just to document it; i am using these versions: xcodebuild -version Xcode 10.1 Build version 10B61

xcodebuild -showsdks
iOS SDKs: iOS 12.1 -sdk iphoneos12.1

iOS Simulator SDKs: Simulator - iOS 12.1 -sdk iphonesimulator12.1

macOS SDKs: macOS 10.14 -sdk macosx10.14

tvOS SDKs: tvOS 12.1 -sdk appletvos12.1

tvOS Simulator SDKs: Simulator - tvOS 12.1 -sdk appletvsimulator12.1

watchOS SDKs: watchOS 5.1 -sdk watchos5.1

watchOS Simulator SDKs: Simulator - watchOS 5.1 -sdk watchsimulator5.1

mnoga23 commented 5 years ago

I must be setting up my machine wrong; because i just compiled dosbox master fine on another macbook with Mojave and 10.14 sdk and xcode 10.1. weird if you have any idea what to check on the other one I will appreciate the information.

fxcoudert commented 5 years ago

We (Homebrew) are also seeing this on our CI machines: https://github.com/Homebrew/homebrew-core/pull/38411 on macOS Sierra with Xcode 9.2

fallenoak commented 5 years ago

Not sure why this might have happened in Mojave for @mnoga23 , but it sounds a bit like convertPointToScreen was actually added in Mojave, and not in Sierra. That might explain why @fxcoudert is running into the issue when building for Sierra.

Similar issue in GTK:

This happens to fix issue 1518 because it turns out that contrary to the annotation in the 10.14 NSWindow.h, convertPointToScreen and convertPointFromScreen originate in 10.14, not 10.12.

joncampbell123 commented 5 years ago

Nice. In addition to the sparse and sometimes unhelpful documentation for their API, they also can't get the minimum version numbers right either :(

joncampbell123 commented 5 years ago

Please try the latest commit, see if it helps.

fallenoak commented 5 years ago

@joncampbell123 Pulled and compiled. Works for me on High Sierra (10.13.6).