Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General issue for other problems with xcode 10 / macos 10.14 #6149

Closed
arturoc opened this issue Oct 7, 2018 · 44 comments
Closed

General issue for other problems with xcode 10 / macos 10.14 #6149

arturoc opened this issue Oct 7, 2018 · 44 comments

Comments

@arturoc
Copy link
Member

arturoc commented Oct 7, 2018

Opening this since more stuff comes up and not sure it even belongs on a new issue or it's all related:

https://forum.openframeworks.cc/t/ofimage-issue-in-xcode/30628

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

I was describing this odd behavior here (and seeing similar crashes on xcode 10):

#6142

basically many OF objects constructors are not getting called :( If you use legacy build on xcode 10 this particular problem goes away. I see weirder compile things happening too like changes to ofApp.h not triggering rebuilds of ofApp.cpp and other header related issues.

With the legacy build system we still have issues with window needing to be moved and the plist permissions for things like camera.

At the moment I'm looking at ways of forcing legacy build system via xcode project workspace settings.

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

here's reference to the window needs moving issue (for sdl)

https://www.syntaxbomb.com/index.php?topic=4927.0
https://github.com/blitz-research/monkey2/commits/develop

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

vsync on mojave
glfw/glfw#1337

@arturoc
Copy link
Member Author

arturoc commented Oct 7, 2018

wonder if we should do a quick release with theo's changes + legacy build enabled in projects until we figure out how to fix using new builds

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

discussion of mojave move window bug on glfw
glfw/glfw#1346

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

@arturoc yes I am looking at the legacy thing now but couldn't find a way to automate it through project generator yet...

with the legacy build and xcode 10 you still have the white screen on startup problem (maybe can be fixed with a quick move window hack). on xcode 9.4.1 on mojave we don't seem to have that problem but I want to test a little more.

@ofZach
Copy link
Contributor

ofZach commented Oct 7, 2018

also to make matters worse, xcode in 9.4.1 + mojave doesn't seem to load the plist properly so permissions for things like camera usage breaks there. If you open the app outside of xcode (ie, a build .app) plist works.

I think the ideal mojave build system is xcode 10 + legacy build + window hack + plist with alot of permissions set. looking at how to make that happen.

@ofZach
Copy link
Contributor

ofZach commented Oct 8, 2018

vertical sync issues described here #6146 just linking to make sure there's an account for all the mojave issues

@ghost
Copy link

ghost commented Oct 10, 2018

I would suggest you guys keep both OpenGL and Metal for Mac users, on future releases:

  • perhaps that may require to maintain two separate instances of OpenFrameworks
  • it may be worth to enhance maximum compatibility
  • perhaps that may require to extend the stack
  • keeping some tool to bridge the same binary output between OpenGL and Metal

@ofTheo
Copy link
Member

ofTheo commented Oct 10, 2018

@ofZach

Looking at the faiface/pixel issue, it looks like updating the NSOpenGLContext fixes the issue.

for OF in ofApp::setup( That would be something like this:

    ofAppGLFWWindow * ptr = (ofAppGLFWWindow *)ofGetWindowPtr();
    NSOpenGLContext * context = (NSOpenGLContext *)ptr->getNSGLContext();
    [context update];

with these headers included and the ofApp.cpp set to C++ / Obj C++

#include "GLFW/glfw3.h"
#include <Cocoa/Cocoa.h>

if you want to try at the very end of ofAppGLFWWindow::setup it would just be:

#ifdef TARGET_OSX
    NSOpenGLContext * context = (NSOpenGLContext *)getNSGLContext();
    [context update];
#endif

if that works it could fix all the window/gl issues people are noting?

@ofTheo
Copy link
Member

ofTheo commented Oct 12, 2018

ping @kylemcdonald @ofZach
do you think you could try the above quickly and see if it fixes the vsync and no drawing issues?

If it does I can put in a PR.
I just have no way to test right now.

@ofZach
Copy link
Contributor

ofZach commented Oct 12, 2018

just a note that putting this in setup on xcode 10 w/ legacy build doesn't fix the first frame issue

@ofZach
Copy link
Contributor

ofZach commented Oct 12, 2018

in update this works:

if (ofGetFrameNum() < 2){
ofAppGLFWWindow * ptr = (ofAppGLFWWindow *)ofGetWindowPtr();
NSOpenGLContext * context = (NSOpenGLContext *)ptr->getNSGLContext();
[context update];
}

but not ofGetFrameNum() < 1.... it seems like you have to wait a few frames for this to work

@ofTheo
Copy link
Member

ofTheo commented Oct 12, 2018

Thanks @ofZach ! That blows, but is helpful to know!

I think I saw something in the glfw posts that the update call has to happen during or after a buffer swap or something. I'll see if there is something else we can do to make sure ofApp::setup has a proper context to work with.

@ofZach
Copy link
Contributor

ofZach commented Oct 23, 2018

@ofTheo some more info on the rendering at launch bug here:

https://stackoverflow.com/questions/52938516/opengl-not-rendering-on-macos-mojave

and glfw fix

glfw/glfw#1334

@jvcleave
Copy link
Member

Couple of issues I have ran into recently:

Xcode doesn't recognize changes in header files.
This is more of a development headache and might not effect OF that much but something to be aware of.

In troubleshooting the above I tried switching to Legacy Build however I then can no longer clean the project

dqkvgbbw4aa3rru

error message thinks I am using the new system however I confirmed it was switched to legacy and had restarted Xcode

I've also see just simple stuff causing crashes (pushing strings into vectors). clean/switch build system sometimes fixes it.

@ofTheo
Copy link
Member

ofTheo commented Nov 7, 2018

So I think the render / glfw bug is fixed in their master branch. I am going to update apothecary to try and pull that branch.

@ofTheo
Copy link
Member

ofTheo commented Nov 7, 2018

This is the PR for apothecary to pull from the latest glfw which has 10.14 fixes.
openframeworks/apothecary#121

@ofTheo
Copy link
Member

ofTheo commented Nov 7, 2018

@arturoc @ofZach I think the patch-release branch should be ready for 10.14 apothecary master has 10.14 glfw fixes and the plist is merged in.

Is it possible to build a rc zip for testing?

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

So I just built a zip from the patch-release branch for testing.
It should work now in mojave without using the legacy build system.

Might be good to check the ascii video example for the camera permissions which should now be in there. GLFW and rendering is the big unknown, but the current glfw should be included which has a fix for rendering in mojave.

Will share on the forum too.
https://openframeworks.cc/versions/mojave/of_v0.10.0-mojave_osx_release.zip

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

@ofTheo here some notes on this --

  • have to use legacy otherwise there are weird compile issues. basic OF objects crash as their constructor doesn't get called using the new build system :( legacy works fine but there's something off with the new build system.
  • permissions look good for camera (testing other apps now)
  • glfw draws on launch
  • vertical sync still a problem
  • compiling OF is happening behind the scenes and kind of takes a while, it might be nice if we have a message (not sure how easy or possible that is) to let people know.

I'll dig further into how we can force legacy -- I found specific files that do this may need to tweak things at the PG level.

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

also a weird thing about the new build system is that changes to the ofApp.h file don't seem to be recognized. for example, I can type this into the the h file and it still compiles.

screen shot 2018-11-09 at 6 02 29 am

there's something off it seems header related (the crashes I see relate to constructors of objects created in .h files not getting called)

related: https://forums.developer.apple.com/thread/109826

@arturoc
Copy link
Member Author

arturoc commented Nov 9, 2018

@ofTheo, i'm traveling at the moment. if you merge patch-release into master the next day nightly build will have the changes.

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

Thanks @ofZach thats really helpful!
( On 10.13 with Xcode 10 I don't see any issues using the new build system. )

I found the file to force the legacy build in the Xcode template, but I think it will need a change to the Project Generator as the current one doesn't copy the file ( actually a folder project.xcworkspace ) over when generating projects. I'll add the folder to the patch-release branch and will merge to master so it will be easier to test. ( Thanks @arturoc ). Might need some help on the PG side :)

Vertical Sync is a weird one, I am guessing its a GLFW bug. I don't see it on 10.13 with Xcode 10.
I'll see if there is any mention of it on their GitHub.

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

Seems like V Sync is a glfw bug:
glfw/glfw#1337

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

interesting! can you try 10.13 and with the new build system, compile in debug (I don't know if I see the behavior in release). in particular, try an empty example, compile it to make it run, and then add an ofVideoGrabber to it in the h file and setup / update / draw. I get a crash in setup() since the constructor doesn't get called. I think there's something fishy with how it recompiles....

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

@ofZach just tried that test and I get a crash too.
I had only tried running the examples before.

So I guess the new build system is universally bad and not just bad on 10.14 :)

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

For the Vertical Sync issue.
If you put this in ofApp::update() does it enable it?

GLint                       sync = 1;
CGLContextObj               ctx = CGLGetCurrentContext();
CGLSetParameter(ctx, kCGLCPSwapInterval, &sync);

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

just tested and still no dice on fixing vsync :(

I wonder if a good temporary solution while we wait for a fix would be to either test for 10.14 and add ofSetFrameRate(60) and/or write up instructions about installing the 10.13 sdk....

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

it seems like maybe this is fixed in 10.14.2 ?

cocos2d/cocos2d-x#19080

"This is fixed in 10.14.2. I just installed the Developer Beta (10.14.2 Beta (18C31g)) and because of that, the issue can be closed."

@ofZach
Copy link
Contributor

ofZach commented Nov 9, 2018

I can try this beta out and report back....

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

Ah thats sort of annoying as there isn't much we can do about it but wait :)
I think I have the PG changes and new files in. Once they are merged and the CI builds the new PG app. I'll try another release.

@ofTheo
Copy link
Member

ofTheo commented Nov 9, 2018

Hmm. So the PG changes are in master, but the examples generated by create_packages.sh didn't seem to pull in those changes. I tested the PG locally and it copied the workspace files over enabling legacy build, but in the generated zip its still missing. Going to merge the patch-release with master and see if it comes through in the nightlies.

@ofTheo
Copy link
Member

ofTheo commented Nov 10, 2018

Here is a release to test: https://openframeworks.cc/versions/mojave/of_v0.10.0-patch-mojave-rc3_osx_release.zip

It should have the project files now for defaulting to legacy.

For some reason the last nightly didn't seem to generate the project files with the new Xcode files. So this zip was made by running the OS X Project Generator made by the test server.

If the next nightly still doesn't have the files I might need some help from @arturoc to track down the problem.

@ofZach
Copy link
Contributor

ofZach commented Nov 10, 2018

on mojave xcode 10 this looks good ! -- legacy mode is loading fine (orange pickaxe)

screen shot 2018-11-10 at 11 36 01 am

and camera permission etc all working.

quick note -- on Xcode 9.4.1 w/ mojave the plist doesn't load so there's permission errors w. apps that use camera (but I think this something we can just encourage people to upgrade to Xcode 10). the plist does work on apps compiled in Xcode 9.4.1 if you run the app outside of Xcode ¯_(ツ)_/¯

@ofTheo
Copy link
Member

ofTheo commented Nov 10, 2018

Thats great to hear! Thanks for testing it.

Interesting the plist parsing.
It seems to be a more fatal error on Xcode 9.2 ( see: #6172 ).

Its strange that Xcode would have an issue with extra keys in a plist. I would of assumed it would ignore keys it doesn't recognize. I wonder if we can do a per-Xcode version plist?

Will take a look....

@ofTheo
Copy link
Member

ofTheo commented Nov 11, 2018

Okay new zip. This should have a bunch of fixes to the Xcode template that was breaking some addons. Related to #6172

https://openframeworks.cc/versions/mojave/of_v0.10.0-patch-mojave-rc5_osx_release.zip

@ofTheo
Copy link
Member

ofTheo commented Nov 11, 2018

Okay all changes are in master.
The nightlies now have the right standalone PG bundled with them that copy over the new files.

However the build script that runs online is generating the project files the old way. It doesn't seem to be running the latest command line project generator from master.

@arturoc if you have any idea about it, that is the last thing left I think?

@ofTheo
Copy link
Member

ofTheo commented Nov 13, 2018

Okay - I just needed to recompile the PG on the ci server.
Looks like the next nightly will be all good to go.

Going to close this as I think all these issues should be address now.

@ofTheo ofTheo closed this as completed Nov 13, 2018
@arturoc
Copy link
Member Author

arturoc commented Nov 13, 2018

That's strange, the create_packages script should recompile the PG every time before creating the packages. i'll look into why it didn't but glad you got it working

@ofZach
Copy link
Contributor

ofZach commented Dec 10, 2018

sadly 10.14.2 doesn't fix the vsync issue.

@ofTheo do you think it would make sense to add some kind of check, like if compiled against 10.14 sdk use ofSetFrameRate(60) internally?

@ofTheo
Copy link
Member

ofTheo commented Dec 10, 2018

Oh wow that blows!
Would there be any downside of having ofSetFramerate(60.0) being set by default on all platforms?

I could imagine there could be runtime detection of 10.14 that sets 60 - but we could also default to vertical sync on and ofSetFramereate 60 being on?

It would be a change, but I can't imagine it would be a breaking change in anyway.

@arturoc
Copy link
Member Author

arturoc commented Dec 14, 2018

hey definitely don't add that for every possible platform, even if 60hz is the most common is not the default for every monitor and a lot do 59.95 which is almost the same but we would be sleeping here and there without need which could introduce some weirdness in frame based animation and even time based

I would just leave it as it is by now, and perhaps make a comment in the forum so people can find it saying that they need to fix the framerate manually by now if they are on osx 10.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants