Opened 4 years ago
Last modified 4 years ago
#60819 new defect
sfml fails to build on 10.6.8 due to missing method backingScaleFactor
Reported by: | programmingkidx | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | snowleopard leopard tiger | Cc: | rkitover@…, programmingkidx |
Port: | sfml |
Description
sfml fails to build on Mac OS 10.6.8 because of a missing method called backingScaleFactor. According to this page the method was added in Mac OS 10.7.
Here is the error message:
_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_sfml/sfml/work/SFML-2.4.2/src/SFML/Window/OSX/InputImpl.mm:155:40: warning: instance method '-backingScaleFactor' not found (return type defaults to 'id') [-Wobjc-method-access] :info:build int scale = [[NSScreen mainScreen] backingScaleFactor];
This is caused later:
opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_sfml/sfml/work/SFML-2.4.2/src/SFML/Window/OSX/InputImpl.mm:155:9: error: cannot initialize a variable of type 'int' with an rvalue of type 'id' :info:build int scale = [[NSScreen mainScreen] backingScaleFactor]; :info:build ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Attachments (1)
Change History (10)
comment:1 Changed 4 years ago by programmingkidx
Cc: | programmingkidx added |
---|
Changed 4 years ago by programmingkidx
comment:2 Changed 4 years ago by kencu (Ken)
comment:3 Changed 4 years ago by kencu (Ken)
Cc: | programmingkidx removed |
---|---|
Keywords: | snowleopard leopard tiger added |
Summary: | sfml fails to build due to missing method backingScaleFactor → sfml fails to build on 10.6.8 due to missing method backingScaleFactor |
comment:4 Changed 4 years ago by kencu (Ken)
found this in the old tickets, FYI <https://trac.macports.org/attachment/ticket/43283/patch-backingScaleFactor.diff>
comment:5 Changed 4 years ago by programmingkidx
https://gist.github.com/sangregoriopaolo/3609137
- The solution here was to return 1.0 on Mac OS 10.6 and under. I agree with this solution.
// Support for OSX 10.6 if (![[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) return 1.0f;
comment:6 Changed 4 years ago by kencu (Ken)
How about you try to put together a whole patch, and we'll see how it works. All my investment in you so far is just about ripe to pay off soon :> The idea is to have a patch that will work on all systems all the time, not (ideally) generate warnings, certainly not generate errors, and actually works in testing.
AFAICT backingScaleFactor
is still not defined, right? Probably have to fix that too...or you'll get errors soon when that becomes an error...
You're making progress !
comment:7 Changed 4 years ago by rkitover (Rafael Kitover)
Hi guys, I'm the original port submitter.
If you are going to update the port, could you please bump up the version too, the current release is 2.5.1.
I could do this myself if you prefer.
comment:8 Changed 4 years ago by rkitover (Rafael Kitover)
As regards backingScaleFactor
, I'm somewhat familiar with these APIs.
These are the HiDPI APIs added in 10.7.5 to support the then new "retina" macbook pros.
It should be fairly easy to patch around this stuff, and just set the scale to 1 if the API is not available.
It would be nice to get any patch merged upstream as well.
comment:9 Changed 4 years ago by programmingkidx
Cc: | programmingkidx added |
---|
Now you're running into some slightly harder stuff.
This is caused by advancements to the Apple SDKs over time. You have to either:
#ifdefs
or some#if __MAC_OS_X_VERSION_MAX_ALLOWED__
guards can get you there.This particular error is pretty easy to fix, as the change from the 10.6 SDK is pretty minor and simple to implement. If you go into the macports portfile tree and do a search for that, something like :
and then use your favourite searcher, I like
the_silver_searcher
you might get lucky and find another port that has already patched this, and see what they did.
Or you can type "backingScaleFactor" into the "Search" box at the top right of this screen we're on here, and that will search for other tickets where this was handled.
Or "Google is your Friend" and sometimes there is a hit or two on the web for this.
Sometimes I download the last version of the software that did build on 10.6, and compare the source code to see what changed between the version that built on 10.6 and the version that did not build. That can give you some clues (I got wine working on 10.6.8 that way recently).
But -- never a trivial fix, nobody is likely to help you other than a very few of us, and it will not be fixed particularly quickly.
There is a user trying to automate some of these SDK evolution things, and that might (or might not) work -- we'll see.