ANY possible way to run the clang compiler from a Sandboxed app?

邮差的信 提交于 2021-02-08 06:31:24

问题


OK, the question is fairly straightforward.

I have a sandboxed OSX app.

I want the user to be able to compile some C code (whatever he inputs).

But whenever I'm attempting a call to:

/usr/bin/env clang /the/path/to/the/source.c

I'm getting the following error in the logs:

xcrun: error: cannot be used within an App Sandbox.

Is there any way to circumvent this?


P.S. I've successfully done pretty much the same thing with Ruby, Python and PHP.


回答1:


If you want to keep your app sandboxed you could try to add a Temporary exception key to your entitlements file:

com.apple.security.temporary-exception.files.absolute-path.read-only

More information on that here

Another way to achieve it would be the more troublesome way of creating an helper app (XPC-service) which is not sandboxed. There are also some details about XPC-services here.



来源:https://stackoverflow.com/questions/26082365/any-possible-way-to-run-the-clang-compiler-from-a-sandboxed-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!