-
Notifications
You must be signed in to change notification settings - Fork 120
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
macOS OpenGL initialization / security entitlements #109
Comments
@jmwright @adam-urbanczyk Interesting update: If I hardcode the absolute path of Therefore, const OSD_Path aDirPath (THE_SHADERS_FOLDER);
OSD_Directory aDir (aDirPath);
const TCollection_AsciiString aProgram = THE_SHADERS_FOLDER + "/Declarations.glsl";
OSD_File aProgramFile (aProgram); The macOS sandbox context must mangle the current path or oce's low level file access API (OSD_xxxxxxx) resolve an incorrect path when given a relative path spec. |
@jmwright @adam-urbanczyk Good news! All fixed! I added some logic to |
@michaelgale That's fantastic! Thank you! |
@jmwright Should I put all my macOS specific build assets into the CQ-Editor repo and issue a PR? |
@michaelgale If you're talking about things like the spec file, I would say yes. @adam-urbanczyk may have thoughts on the specifics of how to organize things though. |
@michaelgale it would be great if you could make a PR! Please try to keep the current structure of a spec file + runtime hooks. |
@adam-urbanczyk Ok sure.
|
This issue can be closed since the PR #111 addresses this problem with run time substitution of the environment variable for CSF Shaders. Platform specific guards ensure that this occurs only for macOS targets. |
When building a standalone binary of the CQ-Editor for macOS, the app may or may not crash depending on its launch context. That is:
lldb
launchd
when double-clicked in the Finderlaunchd
when launched from the terminal with theopen
commandEach mechanism may or may not trigger macOS gatekeeper security and execute the app inside a "sandbox" with path randomization. This path randomization is usually transparent from the point of view of the python introspection, but at a lower level, the
oce
core accesses the file system to initialize the OpenGL driver as follows:OCC/Core/Graphic3d.py
,ShadersFolder()
is called which in turn calls the binary object function_Graphic3d.Graphic3d_ShaderProgram_ShadersFolder(*args)
oce/Graphic3d_ShaderProgram.cxx
and it is as follows:Depending on runtime sandboxing, the path that this function infers may turn out to be incorrect or obscured. Therefore, when it tests
Exists()
at the end of the function it raises the error. It is difficult to tell if this function falls back on the hardcodedOCE_INSTALL_DATA_DIR
since that will defined when oce is built. If it is, then it is yet another mechanism to not find the Shaders folder.At the end of the day, the program crashes because OpenGL does not get initialized since it cannot find its Shaders/etc. resources in
oce/src
.The secondary mechanism of failure related to #108 is that the evaluation of security entitlements delays OpenGL driver initialization and creates a fatal race condition during app initialization due to early requests to draw axis lines in the 3D viewer.
The text was updated successfully, but these errors were encountered: